特殊:Badtitle/NS100:Installation/OnNFSDrive:修订间差异
小 New page: {{From|https://help.ubuntu.com/community/Installation/OnNFSDrive}} {{Languages|php5}} ==== Introduction & warning ==== This page describes installing Ubuntu on a NFS server. The client(s)... |
小无编辑摘要 |
||
第19行: | 第19行: | ||
# mkdir /ubuntu | # mkdir /ubuntu | ||
</nowiki></ | </nowiki></pre> | ||
==== Get debootstrap scripts ==== | ==== Get debootstrap scripts ==== | ||
第31行: | 第31行: | ||
# cd debootstrap-0.2.39ubuntu22 | # cd debootstrap-0.2.39ubuntu22 | ||
# make | # make | ||
</nowiki></ | </nowiki></pre> | ||
==== Run debootstrap ==== | ==== Run debootstrap ==== | ||
第39行: | 第39行: | ||
<pre><nowiki> | <pre><nowiki> | ||
# DEBOOTSTRAP_DIR=`pwd` ./debootstrap --arch i386 hoary /ubuntu http://archive.ubuntulinux.org/ubuntu hoary | # DEBOOTSTRAP_DIR=`pwd` ./debootstrap --arch i386 hoary /ubuntu http://archive.ubuntulinux.org/ubuntu hoary | ||
</nowiki></ | </nowiki></pre> | ||
(JonathanLozinski notes that this did not seem to work on edgy-server, however simply "DEBOOTSTRAP_DIR=`pwd` ./debootstrap --arch i386 edgy /ubuntu" did seem to do as intended. ) | (JonathanLozinski notes that this did not seem to work on edgy-server, however simply "DEBOOTSTRAP_DIR=`pwd` ./debootstrap --arch i386 edgy /ubuntu" did seem to do as intended. ) | ||
第53行: | 第53行: | ||
<pre><nowiki> | <pre><nowiki> | ||
# echo HOSTNAME > /ubuntu/etc/hostname | # echo HOSTNAME > /ubuntu/etc/hostname | ||
</nowiki></ | </nowiki></pre> | ||
==== Set up fstab ==== | ==== Set up fstab ==== | ||
第61行: | 第61行: | ||
<pre><nowiki> | <pre><nowiki> | ||
# nano /ubuntu/etc/fstab | # nano /ubuntu/etc/fstab | ||
</nowiki></ | </nowiki></pre> | ||
Here is a decent fstab to get started with: | Here is a decent fstab to get started with: | ||
第71行: | 第71行: | ||
/dev/fd0 /mnt/floppy auto user,noauto,sync,exec,umask=000 0 0 | /dev/fd0 /mnt/floppy auto user,noauto,sync,exec,umask=000 0 0 | ||
/dev/cdrom /mnt/cdrom auto user,noauto,exec,ro 0 0 | /dev/cdrom /mnt/cdrom auto user,noauto,exec,ro 0 0 | ||
</nowiki></ | </nowiki></pre> | ||
==== Enter the install environment ==== | ==== Enter the install environment ==== | ||
第78行: | 第78行: | ||
# chroot /ubuntu | # chroot /ubuntu | ||
# mount /proc | # mount /proc | ||
</nowiki></ | </nowiki></pre> | ||
Set the root password: | Set the root password: | ||
第86行: | 第86行: | ||
Enter new UNIX password: | Enter new UNIX password: | ||
Retype new UNIX password: | Retype new UNIX password: | ||
</nowiki></ | </nowiki></pre> | ||
==== Compile kernel for your system ==== | ==== Compile kernel for your system ==== | ||
第113行: | 第113行: | ||
# umount /proc | # umount /proc | ||
# exit | # exit | ||
</nowiki></ | </nowiki></pre> | ||
==== Get PXELinux, dhcpd and tftpd ==== | ==== Get PXELinux, dhcpd and tftpd ==== | ||
第126行: | 第126行: | ||
DEFAULT kernel-2.6.10 | DEFAULT kernel-2.6.10 | ||
APPEND root=/dev/nfs nfsroot=192.168.0.150:/ubuntu ip=dhcp | APPEND root=/dev/nfs nfsroot=192.168.0.150:/ubuntu ip=dhcp | ||
</nowiki></ | </nowiki></pre> | ||
You should atleast replace the server address. It is the address of the NFS server. Put pxelinux.0 and kernel-2.6.10 in the tftp server root directory. Put the configuration file "default" in directory "pxelinux.cfg". | You should atleast replace the server address. It is the address of the NFS server. Put pxelinux.0 and kernel-2.6.10 in the tftp server root directory. Put the configuration file "default" in directory "pxelinux.cfg". | ||
第137行: | 第137行: | ||
filename "/pxelinux.0"; | filename "/pxelinux.0"; | ||
} | } | ||
</nowiki></ | </nowiki></pre> | ||
I give a fixed address for this to set NFS exports more securitely. You should replace the IP and the MAC address of the client. The MAC address can be seen with "ifconfig" on computers running Linux. Restart dhcp server to apply the changes. | I give a fixed address for this to set NFS exports more securitely. You should replace the IP and the MAC address of the client. The MAC address can be seen with "ifconfig" on computers running Linux. Restart dhcp server to apply the changes. | ||
第146行: | 第146行: | ||
<pre><nowiki> | <pre><nowiki> | ||
/ubuntu 192.168.0.204(rw,no_root_squash,async) | /ubuntu 192.168.0.204(rw,no_root_squash,async) | ||
</nowiki></ | </nowiki></pre> | ||
Restart NFS-server to apply the changes. | Restart NFS-server to apply the changes. |
2007年5月13日 (日) 12:24的版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/Installation/OnNFSDrive }} |
点击翻译: |
English {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/af | • {{#if: php5|Afrikaans| [[::Installation/OnNFSDrive/af|Afrikaans]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/ar | • {{#if: php5|العربية| [[::Installation/OnNFSDrive/ar|العربية]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/az | • {{#if: php5|azərbaycanca| [[::Installation/OnNFSDrive/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/bcc | • {{#if: php5|جهلسری بلوچی| [[::Installation/OnNFSDrive/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/bg | • {{#if: php5|български| [[::Installation/OnNFSDrive/bg|български]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/br | • {{#if: php5|brezhoneg| [[::Installation/OnNFSDrive/br|brezhoneg]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/ca | • {{#if: php5|català| [[::Installation/OnNFSDrive/ca|català]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/cs | • {{#if: php5|čeština| [[::Installation/OnNFSDrive/cs|čeština]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/de | • {{#if: php5|Deutsch| [[::Installation/OnNFSDrive/de|Deutsch]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/el | • {{#if: php5|Ελληνικά| [[::Installation/OnNFSDrive/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/es | • {{#if: php5|español| [[::Installation/OnNFSDrive/es|español]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/fa | • {{#if: php5|فارسی| [[::Installation/OnNFSDrive/fa|فارسی]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/fi | • {{#if: php5|suomi| [[::Installation/OnNFSDrive/fi|suomi]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/fr | • {{#if: php5|français| [[::Installation/OnNFSDrive/fr|français]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/gu | • {{#if: php5|ગુજરાતી| [[::Installation/OnNFSDrive/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/he | • {{#if: php5|עברית| [[::Installation/OnNFSDrive/he|עברית]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/hu | • {{#if: php5|magyar| [[::Installation/OnNFSDrive/hu|magyar]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/id | • {{#if: php5|Bahasa Indonesia| [[::Installation/OnNFSDrive/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/it | • {{#if: php5|italiano| [[::Installation/OnNFSDrive/it|italiano]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/ja | • {{#if: php5|日本語| [[::Installation/OnNFSDrive/ja|日本語]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/ko | • {{#if: php5|한국어| [[::Installation/OnNFSDrive/ko|한국어]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/ksh | • {{#if: php5|Ripoarisch| [[::Installation/OnNFSDrive/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/mr | • {{#if: php5|मराठी| [[::Installation/OnNFSDrive/mr|मराठी]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/ms | • {{#if: php5|Bahasa Melayu| [[::Installation/OnNFSDrive/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/nl | • {{#if: php5|Nederlands| [[::Installation/OnNFSDrive/nl|Nederlands]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/no | • {{#if: php5|norsk| [[::Installation/OnNFSDrive/no|norsk]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/oc | • {{#if: php5|occitan| [[::Installation/OnNFSDrive/oc|occitan]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/pl | • {{#if: php5|polski| [[::Installation/OnNFSDrive/pl|polski]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/pt | • {{#if: php5|português| [[::Installation/OnNFSDrive/pt|português]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/ro | • {{#if: php5|română| [[::Installation/OnNFSDrive/ro|română]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/ru | • {{#if: php5|русский| [[::Installation/OnNFSDrive/ru|русский]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/si | • {{#if: php5|සිංහල| [[::Installation/OnNFSDrive/si|සිංහල]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/sq | • {{#if: php5|shqip| [[::Installation/OnNFSDrive/sq|shqip]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/sr | • {{#if: php5|српски / srpski| [[::Installation/OnNFSDrive/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/sv | • {{#if: php5|svenska| [[::Installation/OnNFSDrive/sv|svenska]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/th | • {{#if: php5|ไทย| [[::Installation/OnNFSDrive/th|ไทย]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/tr | • {{#if: php5|Türkçe| [[::Installation/OnNFSDrive/tr|Türkçe]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/vi | • {{#if: php5|Tiếng Việt| [[::Installation/OnNFSDrive/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/yue | • {{#if: php5|粵語| [[::Installation/OnNFSDrive/yue|粵語]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/zh | • {{#if: php5|中文| [[::Installation/OnNFSDrive/zh|中文]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/zh-hans | • {{#if: php5|中文(简体)| [[::Installation/OnNFSDrive/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: php5 | php5 | {{#if: | :}}Installation/OnNFSDrive}}/zh-hant | • {{#if: php5|中文(繁體)| [[::Installation/OnNFSDrive/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:php5|:Installation/OnNFSDrive|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :Installation/OnNFSDrive/zh | | {{#ifexist: Installation/OnNFSDrive/zh | | {{#ifeq: {{#titleparts:Installation/OnNFSDrive|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Installation/OnNFSDrive|1|-1|}} | zh | | }}
Introduction & warning
This page describes installing Ubuntu on a NFS server. The client(s) running Ubuntu don't need anything wroten on the harddisk. This configuration has some extra requirements:
- A pre-configured NFS-server. GNU/Linux on a 500MHz/512MB computer will do fine.
- 100Mbit/s network. System will work very slowly with 10MBit/s.
- Client with atleast 256MB RAM, preferrably 512MB OR a harddisk for a swap partition.
- Some Linux experience and ability to compile your own kernel.
Set up the install directory
Create a directory for Ubuntu on the NFS server. This directory will be the root for storing all files needed by the clients. I will use /ubuntu in this tutorial.
$ su Password: # mkdir /ubuntu
Get debootstrap scripts
1. Grab the latest debootstrap_*.tar.gz from http://archive.ubuntulinux.org/ubuntu/pool/main/d/debootstrap/ Save the archive into the /tmp directory.
2. Uncompress and extract the archive, then cd into the newly created directory and build the program:
# cd /tmp # tar zxvf debootstrap_0.2.39ubuntu22.tar.gz # cd debootstrap-0.2.39ubuntu22 # make
Run debootstrap
You should run the debootstrap you just built, which requires a slightly odd invocation:
# DEBOOTSTRAP_DIR=`pwd` ./debootstrap --arch i386 hoary /ubuntu http://archive.ubuntulinux.org/ubuntu hoary
(JonathanLozinski notes that this did not seem to work on edgy-server, however simply "DEBOOTSTRAP_DIR=`pwd` ./debootstrap --arch i386 edgy /ubuntu" did seem to do as intended. )
The Ubuntu debootstrap will now run the warty scripts. If your network is unreliable, you may need to run debootstrap multiple times to get all the files. It resumes where it left off.
Near the end of debootstrap's copious output, you should see "Base system installed successfully". If not, remove everything in /mnt/ubuntu apart from the lost+found directory and try again.
Set up the host name
Of course, you should replace HOSTNAME in the command below with the desired name for your machine.
# echo HOSTNAME > /ubuntu/etc/hostname
Set up fstab
Create your fstab. It should include procfs, sysfs and possibly cdrom and fd0. Root is not included.
# nano /ubuntu/etc/fstab
Here is a decent fstab to get started with:
/proc /proc proc defaults 0 0 /sys /sys sysfs defaults 0 0 /dev/fd0 /mnt/floppy auto user,noauto,sync,exec,umask=000 0 0 /dev/cdrom /mnt/cdrom auto user,noauto,exec,ro 0 0
Enter the install environment
# chroot /ubuntu # mount /proc
Set the root password:
# passwd Enter new UNIX password: Retype new UNIX password:
Compile kernel for your system
This step is not described fully here. I used kernel 2.6.10 with gentoo patches, just because I had it compiled for my system already. There are some important settings you have to make:
1. Compile your network card driver in the kernel, not as a module. 2. Enable "IP: kernel level autoconfiguration" in Device Drivers -> Networking support -> Networking options 3. Enable NFS in Filesystems -> Network file systems: Enable "NFS File system support" and "Root file system on NFS"
If you get "Warning: Unable to open initial console" on the boot and it hangs, try to also:
1. Enable "Preliminary device filesystem" in Filesystems -> Pseudo filesystems 2. Enable "Mount devfs automatically on boot"
kernel UPDATE: dapper & later users
Since dapper, it is not necessary to recompile the kernel, since initramfs is used on the initial ramdisk. Go to /etc/mkinitramfs/initramfs.conf (in the chroot) and change "BOOT=local" to "BOOT=nfs". Then install any linux-image, the initrd generated will be nfs-bootable. Alternatively, call update-initrd to regenerate initrd if you have kernel already installed.
Make sure to send both kernel image ("/boot/vmliunuz-VERSION") and initrd ("/boot/initrd.img-VERSION") when netbooting, in the next step.
Getting out of chroot
In chrooted enviroment umount /proc and then exit:
# umount /proc # exit
Get PXELinux, dhcpd and tftpd
This step is not described fully here. You need PXELinux from http://syslinux.zytor.com/pxe.php , a TFTPD or other tftp server and DHCPD or other dhcp server.
- Alternatively you can download the Netboot image for Dapper from http://archive.ubuntu.com/ubuntu/dists/dapper/main/installer-i386/current/images/netboot/netboot.tar.gz extract it, copy the pxelinux.0 file and the pxelinux.cfg directory to your tftpd root (mine is /ubuntu) and edit the pxelinux.cfg/default file as described as follows.
Configure PXELinux. A decent configuration file would be like:
TIMEOUT 50 DEFAULT kernel-2.6.10 APPEND root=/dev/nfs nfsroot=192.168.0.150:/ubuntu ip=dhcp
You should atleast replace the server address. It is the address of the NFS server. Put pxelinux.0 and kernel-2.6.10 in the tftp server root directory. Put the configuration file "default" in directory "pxelinux.cfg".
Configure dhcpd to provide the boot image. A decent configuration would be like:
host netbooted { hardware ethernet 00:0C:F1:98:1B:A6; fixed-address 192.168.0.204; filename "/pxelinux.0"; }
I give a fixed address for this to set NFS exports more securitely. You should replace the IP and the MAC address of the client. The MAC address can be seen with "ifconfig" on computers running Linux. Restart dhcp server to apply the changes.
Configure NFS exports
Add a suitable line in /etc/exports:
/ubuntu 192.168.0.204(rw,no_root_squash,async)
Restart NFS-server to apply the changes.
Boot
Configure the client to "Boot from network". It should load PXELinux and in 5 seconds start loading Ubuntu.
How To Setup The Ubuntu Desktop on this System
(ToDo !!) - this means how to setup the above system to be exactly like a Ubuntu Desktop Installation on the Client machine as the above only installs a similar system without the xserver/gnome/etc. and apt-get install ubuntu-desktop does not work out of the box. workaroud for the time beeing :
- Setup NFS Server create the directory /ubuntu and export it described as above
- Install Ubuntu Desktop via NetbootImage/CD on Client machine
- Boot into it mount the /ubuntu directory via NFS
- get a root shell and copy the entire / to the mounted NFS directory
- chroot into the NFS dir, mount proc and uninstall all linux-image-...
- edit /etc/mkinitramfs/initramfs.conf and /etc/fstab as described above
- install linux-image
- configure pxelinux
- reboot via pxe
CategoryDocumentation