特殊:Badtitle/NS100:UbuntuOnCluster:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
(未显示同一用户的2个中间版本) | |||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/UbuntuOnCluster}} | {{From|https://help.ubuntu.com/community/UbuntuOnCluster}} | ||
{{Languages|UbuntuHelp:UbuntuOnCluster}} | {{Languages|UbuntuHelp:UbuntuOnCluster}} | ||
This page documents the process of automatically installing | <<Include(Tag/Unsupported)>> | ||
<<Include(Tag/ContentCleanup)>> | |||
Per the above, please see and update [https://bugs.launchpad.net/bugs/238383] if changed. | |||
''This article is very outdated. Either needs to be updated or deleted.'' | |||
This page documents the process of automatically installing Ubuntu on a cluster of machines. This means one machine will be manually set up as the install server, and all others will be install Ubuntu when booting. The version used here is hoary, and the installer used is debian-installer (The default Ubuntu installer). No tricks like FAI or kickstart are needed. | |||
Prerequisites on the server: | Prerequisites on the server: | ||
* Ubuntu-base install | * Ubuntu-base install | ||
* An | * An Ubuntu [http://www.ubuntu.com/getubuntu/download .iso] | ||
* nat active on the server | * nat active on the server ''or'' all machines must receive a public dhcp IP address | ||
* Several packages need to be installed | * Several packages need to be installed | ||
=== Stage 1: Preparing DHCP & PXE booting === | === Stage 1: Preparing DHCP & PXE booting === | ||
First you will | 1. First, you will need the MAC addresses for all machines, so they will get unique and constant IP addresses and hostnames. | ||
Now install the packages <code><nowiki>dhcp3-server</nowiki></code> and <code><nowiki>tftpd-hpa</nowiki></code> | 2. Now install the packages <code><nowiki>dhcp3-server</nowiki></code> and <code><nowiki>tftpd-hpa</nowiki></code> (see [https://help.ubuntu.com/8.04/add-applications/C/index.html Add Applications]). | ||
Once you have this list, you can edit your /etc/dhcp3/dhcpd.conf | 3. Once you have this list, you can edit your /etc/dhcp3/dhcpd.conf. | ||
PXE booting requires that the .iso file is mounted locally, I mounted it under /var/lib/tftpboot/ubuntu/ | |||
<pre><nowiki>mkdir /var/lib/tftpboot/ubuntu | NOTE: PXE booting requires that the .iso file is mounted locally, I mounted it under /var/lib/tftpboot/ubuntu/ | ||
<pre><nowiki> | |||
mkdir /var/lib/tftpboot/ubuntu | |||
echo '/data/ubuntu-5.04-install-i386.iso /var/lib/tftpboot/ubuntu/ auto defaults,loop 0 0' >> /etc/fstab | echo '/data/ubuntu-5.04-install-i386.iso /var/lib/tftpboot/ubuntu/ auto defaults,loop 0 0' >> /etc/fstab | ||
mount -a</nowiki></pre> | mount -a</nowiki></pre> | ||
The next step is setting up the PXE configuration. You will need to create two files: one for installing and one for booting from the local disk (ie: booting the installed system). Create /var/lib/tftpboot/pxelinux.cfg and put these files there. | |||
As you can see, the default action is to run the installer. You can also set a few options in here (the kernel command line). As space can be limited, you may save some space on the kernel command line by creating symlinks to relevant files: | |||
As you can see, the default action is to run the installer. You can also set a few options in here (the kernel command line) | <pre><nowiki> | ||
<pre><nowiki>cd /var/lib/tftpboot | cd /var/lib/tftpboot | ||
ln -s ubuntu/install/netboot/ubuntu-installer/i386/initrd.gz | ln -s ubuntu/install/netboot/ubuntu-installer/i386/initrd.gz | ||
ubuntu/install/netboot/ubuntu-installer/i386/linux | ubuntu/install/netboot/ubuntu-installer/i386/linux | ||
第24行: | 第30行: | ||
ubuntu/install/netboot/ubuntu-installer/ | ubuntu/install/netboot/ubuntu-installer/ | ||
</nowiki></pre> | </nowiki></pre> | ||
You can see that in the example config files these symlinks are used. | You can see that in the example config files, these symlinks are used. | ||
=== Stage 2: Setting up nis and nfs === | === Stage 2: Setting up nis and nfs === | ||
For cluster machines, nis and nfs are usually used to share login information and parts of the filesystem | For cluster machines, nis and nfs are usually used to share login information and parts of the filesystem, so it is necessary to install both on the server. You will need the packages <code><nowiki>nis nfs-kernel-server</nowiki></code>. | ||
Note: the nis package (not nis itself) is quite buggy, it will try to start ypbind | Note: the nis package (not nis itself) is quite buggy, and it will automatically try to start ypbind. It also completely ignores preseed, so in a following step we will create a new version of this package. You just have to wait a bit for ypbind to time out. | ||
When the nis setup asks for a domain, pick one you like. As soon as ypbind times out, stop nis again with | When the nis setup asks for a domain, pick one you like. As soon as ypbind times out, stop nis again with | ||
<pre><nowiki> | <pre><nowiki> | ||
invoke-rc.d nis stop</nowiki></pre> | invoke-rc.d nis stop</nowiki></pre> | ||
Now you need to edit /etc/default/nis and enable the nis server | Now you need to edit /etc/default/nis and enable the nis server. You also need to initialize the nis database with | ||
<pre><nowiki> | <pre><nowiki> | ||
/usr/lib/yp/ypinit -m</nowiki></pre> | /usr/lib/yp/ypinit -m</nowiki></pre> | ||
第37行: | 第43行: | ||
<pre><nowiki> | <pre><nowiki> | ||
invoke-rc.d nis start</nowiki></pre> | invoke-rc.d nis start</nowiki></pre> | ||
For NFS, you need to edit /etc/exports in order to export required parts of the filesystem. | For NFS, you need to edit /etc/exports in order to export required parts of the filesystem. Exporting /home and /data, should look like: | ||
<pre><nowiki> | <pre><nowiki> | ||
# /etc/exports: the access control list for filesystems which may be exported | # /etc/exports: the access control list for filesystems which may be exported | ||
第46行: | 第52行: | ||
<pre><nowiki> | <pre><nowiki> | ||
invoke-rc.d nfs restart</nowiki></pre> | invoke-rc.d nfs restart</nowiki></pre> | ||
=== Stage 3: Setting up local mirror and proxy === | === Stage 3: Setting up a local mirror and proxy === | ||
Installing from a local mirror and using an http proxy for the rest greatly improves the speed of subsequent installs. Since apt-proxy is quite broken, | Installing from a local mirror and using an http proxy for the rest greatly improves the speed of subsequent installs. Since apt-proxy is quite broken, you should use squid as a generic http proxy. To recover the reboot, install php or use a CGI script. | ||
You will need the packages: <code><nowiki>apache2 libapache2-mod-php4 squid</nowiki></code> | You will need the packages: <code><nowiki>apache2 libapache2-mod-php4 squid</nowiki></code> | ||
This example has only one external IP address, so only the master server is connected to the internet. The other machines are only connected to the master (and via NAT they can reach the net). If you do not want a public proxy, make sure squid installer only uses eth1, the internal interface. You can tell apache to do so to by editing /etc/apache2/ports.conf. | |||
<pre><nowiki>invoke-rc.d apache2 stop | <pre><nowiki> | ||
invoke-rc.d apache2 stop | |||
echo 'Listen 192.168.0.1:80' > /etc/apache2/ports.conf | echo 'Listen 192.168.0.1:80' > /etc/apache2/ports.conf | ||
echo 'Listen 127.0.0.1:80' >> /etc/apache2/ports.conf | echo 'Listen 127.0.0.1:80' >> /etc/apache2/ports.conf | ||
invoke-rc.d apache start</nowiki></pre> | invoke-rc.d apache start</nowiki></pre> | ||
You should also edit the squid config | You should also edit the squid config. | ||
Now make the apache server an | Now make the apache server an Ubuntu archive by symlinking into the .iso | ||
<pre><nowiki> | <pre><nowiki> | ||
ln -s /var/lib/tftpboot/ubuntu/ubuntu /var/www/ubuntu</nowiki></pre> | ln -s /var/lib/tftpboot/ubuntu/ubuntu /var/www/ubuntu</nowiki></pre> | ||
=== Stage 4: preseed === | === Stage 4: preseed === | ||
Having everything in place on the server, | Having everything in place on the server, you can now take care of the client configuration. The tftpboot will launch the Ubuntu installer. This installer usually asks questions, but the answers can be preseeded in a so called preseed file. | ||
Points for possible changes: language, package selection (which is an aptitude pattern), first-created user account, and partition manager setup. Go over these settings and adapt them to your needs. | |||
Points for possible changes: language, package selection (which is an aptitude pattern), first-created user account and partition manager setup. Go over these settings and adapt them to your needs. | |||
=== Stage 5: Surviving the reboot === | === Stage 5: Surviving the reboot === | ||
The installer reboots after the basic install, which means that the installer will be launched again. Of course you don't want this, which is why | The installer reboots after the basic install, which means that the installer will be launched again. Of course you don't want this, which is why it is necessary to create a registration system. As you can see in the preseed file, the preseed/late-command has been set to <code><nowiki>wget http://192.168.0.1/register.php</nowiki></code>. This does nothing on the client side, but the php script creates a PXE boot file for this machine which instructs it to boot from the local drive. If you want to reinstall a certain machine all you have to do is remove the associated PXE boot file and it will use the default again. | ||
In order for this to work, the <code><nowiki>www-data</nowiki></code> user must have write access to /var/lib/tftpboot/pxelinux.cfg | In order for this to work, the <code><nowiki>www-data</nowiki></code> user must have write access to /var/lib/tftpboot/pxelinux.cfg. | ||
<pre><nowiki> | <pre><nowiki> | ||
chown :www-data /var/lib/tftpboot/pxelinux.cfg | chown :www-data /var/lib/tftpboot/pxelinux.cfg | ||
第71行: | 第77行: | ||
<pre><nowiki> | <pre><nowiki> | ||
<?php | <?php | ||
function _dechex($x) { return sprintf("%02s",dechex($x)); } | function _dechex($x) { return sprintf("%02s",dechex($x)); } | ||
$host = strtoupper(implode('',array_map(_dechex,explode('.',$_SERVER['REMOTE_ADDR'])))); | $host = strtoupper(implode('',array_map(_dechex,explode('.',$_SERVER['REMOTE_ADDR'])))); | ||
copy("/var/lib/tftpboot/pxelinux.cfg/localboot", "/var/lib/tftpboot/pxelinux.cfg/$host"); | copy("/var/lib/tftpboot/pxelinux.cfg/localboot", "/var/lib/tftpboot/pxelinux.cfg/$host"); | ||
?></nowiki></pre> | ?></nowiki></pre> | ||
=== Stage 6: postinstall === | === Stage 6: postinstall === | ||
The postinstall script can be used to do anything you like. I used it to install a correct nis package on the clients, create a correct NIS config and more bootstrapping things. | The postinstall script can be used to do anything you like. I used it to install a correct nis package on the clients, create a correct NIS config and more bootstrapping things. | ||
Creating a correct NIS package is done as follows (for | Creating a correct NIS package is done as follows (for Breezy this won't be necessary: the package has been fixed). | ||
<pre><nowiki> | <pre><nowiki> | ||
mkdir nispackage | mkdir nispackage | ||
第97行: | 第103行: | ||
<pre><nowiki> | <pre><nowiki> | ||
#!/bin/bash | #!/bin/bash | ||
# Step 1: Initial mount | # Step 1: Initial mount | ||
mkdir /data | mkdir /data | ||
mount -t nfs 192.168.0.1:/data /data -o rw,soft,bg,rsize=32768,wsize=32768,tcp,timeo=600,intr | mount -t nfs 192.168.0.1:/data /data -o rw,soft,bg,rsize=32768,wsize=32768,tcp,timeo=600,intr | ||
# Step 2: Install and configure NIS | # Step 2: Install and configure NIS | ||
aptitude -y install portmap libslp1 | aptitude -y install portmap libslp1 | ||
第107行: | 第115行: | ||
echo '+::::::::' >> /etc/shadow | echo '+::::::::' >> /etc/shadow | ||
echo '+:::' >> /etc/group | echo '+:::' >> /etc/group | ||
# Repair failing boot sequence (nis with nfs error) | # Repair failing boot sequence (nis with nfs error) | ||
DIR=`pwd` | DIR=`pwd` | ||
第112行: | 第121行: | ||
ln -s ../init.d/mountnfs.sh S20mountnfs.sh | ln -s ../init.d/mountnfs.sh S20mountnfs.sh | ||
cd $DIR | cd $DIR | ||
# Step 2: Correct mounting | # Step 2: Correct mounting | ||
umount /data | umount /data | ||
第117行: | 第127行: | ||
echo 'enterprise:/data /data nfs rw,soft,bg,rsize=32768,wsize=32768,tcp,timeo=600,intr' >> /etc/fstab | echo 'enterprise:/data /data nfs rw,soft,bg,rsize=32768,wsize=32768,tcp,timeo=600,intr' >> /etc/fstab | ||
mount -a | mount -a | ||
# Step 3: Correct sources.list and update | # Step 3: Correct sources.list and update | ||
cp /data/sources.list /etc/apt/sources.list | cp /data/sources.list /etc/apt/sources.list | ||
aptitude update | aptitude update | ||
aptitude -y upgrade | aptitude -y upgrade | ||
# Step 4: Installing other things and remove the installer log which contains a cleartext password | # Step 4: Installing other things and remove the installer log which contains a cleartext password | ||
aptitude -y install linux-686-smp manpages-dev | aptitude -y install linux-686-smp manpages-dev | ||
rm /var/log/installer/debconf-seed | rm /var/log/installer/debconf-seed | ||
rm /var/log/installer/cdebconf/questions.dat | rm /var/log/installer/cdebconf/questions.dat | ||
# Step 5: Enable scheduled scripts | # Step 5: Enable scheduled scripts | ||
echo '0 * * * * root test -x /data/upgrade && /data/upgrade' >> /etc/crontab | echo '0 * * * * root test -x /data/upgrade && /data/upgrade' >> /etc/crontab | ||
# Step 6: reboot, we installed a new kernel | # Step 6: reboot, we installed a new kernel | ||
reboot | reboot | ||
</nowiki></pre> | </nowiki></pre> | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2008年12月16日 (二) 20:25的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/UbuntuOnCluster }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/af | • {{#if: UbuntuHelp:UbuntuOnCluster|Afrikaans| [[::UbuntuOnCluster/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/ar | • {{#if: UbuntuHelp:UbuntuOnCluster|العربية| [[::UbuntuOnCluster/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/az | • {{#if: UbuntuHelp:UbuntuOnCluster|azərbaycanca| [[::UbuntuOnCluster/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/bcc | • {{#if: UbuntuHelp:UbuntuOnCluster|جهلسری بلوچی| [[::UbuntuOnCluster/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/bg | • {{#if: UbuntuHelp:UbuntuOnCluster|български| [[::UbuntuOnCluster/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/br | • {{#if: UbuntuHelp:UbuntuOnCluster|brezhoneg| [[::UbuntuOnCluster/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/ca | • {{#if: UbuntuHelp:UbuntuOnCluster|català| [[::UbuntuOnCluster/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/cs | • {{#if: UbuntuHelp:UbuntuOnCluster|čeština| [[::UbuntuOnCluster/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/de | • {{#if: UbuntuHelp:UbuntuOnCluster|Deutsch| [[::UbuntuOnCluster/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/el | • {{#if: UbuntuHelp:UbuntuOnCluster|Ελληνικά| [[::UbuntuOnCluster/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/es | • {{#if: UbuntuHelp:UbuntuOnCluster|español| [[::UbuntuOnCluster/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/fa | • {{#if: UbuntuHelp:UbuntuOnCluster|فارسی| [[::UbuntuOnCluster/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/fi | • {{#if: UbuntuHelp:UbuntuOnCluster|suomi| [[::UbuntuOnCluster/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/fr | • {{#if: UbuntuHelp:UbuntuOnCluster|français| [[::UbuntuOnCluster/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/gu | • {{#if: UbuntuHelp:UbuntuOnCluster|ગુજરાતી| [[::UbuntuOnCluster/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/he | • {{#if: UbuntuHelp:UbuntuOnCluster|עברית| [[::UbuntuOnCluster/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/hu | • {{#if: UbuntuHelp:UbuntuOnCluster|magyar| [[::UbuntuOnCluster/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/id | • {{#if: UbuntuHelp:UbuntuOnCluster|Bahasa Indonesia| [[::UbuntuOnCluster/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/it | • {{#if: UbuntuHelp:UbuntuOnCluster|italiano| [[::UbuntuOnCluster/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/ja | • {{#if: UbuntuHelp:UbuntuOnCluster|日本語| [[::UbuntuOnCluster/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/ko | • {{#if: UbuntuHelp:UbuntuOnCluster|한국어| [[::UbuntuOnCluster/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/ksh | • {{#if: UbuntuHelp:UbuntuOnCluster|Ripoarisch| [[::UbuntuOnCluster/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/mr | • {{#if: UbuntuHelp:UbuntuOnCluster|मराठी| [[::UbuntuOnCluster/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/ms | • {{#if: UbuntuHelp:UbuntuOnCluster|Bahasa Melayu| [[::UbuntuOnCluster/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/nl | • {{#if: UbuntuHelp:UbuntuOnCluster|Nederlands| [[::UbuntuOnCluster/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/no | • {{#if: UbuntuHelp:UbuntuOnCluster|norsk| [[::UbuntuOnCluster/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/oc | • {{#if: UbuntuHelp:UbuntuOnCluster|occitan| [[::UbuntuOnCluster/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/pl | • {{#if: UbuntuHelp:UbuntuOnCluster|polski| [[::UbuntuOnCluster/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/pt | • {{#if: UbuntuHelp:UbuntuOnCluster|português| [[::UbuntuOnCluster/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/ro | • {{#if: UbuntuHelp:UbuntuOnCluster|română| [[::UbuntuOnCluster/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/ru | • {{#if: UbuntuHelp:UbuntuOnCluster|русский| [[::UbuntuOnCluster/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/si | • {{#if: UbuntuHelp:UbuntuOnCluster|සිංහල| [[::UbuntuOnCluster/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/sq | • {{#if: UbuntuHelp:UbuntuOnCluster|shqip| [[::UbuntuOnCluster/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/sr | • {{#if: UbuntuHelp:UbuntuOnCluster|српски / srpski| [[::UbuntuOnCluster/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/sv | • {{#if: UbuntuHelp:UbuntuOnCluster|svenska| [[::UbuntuOnCluster/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/th | • {{#if: UbuntuHelp:UbuntuOnCluster|ไทย| [[::UbuntuOnCluster/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/tr | • {{#if: UbuntuHelp:UbuntuOnCluster|Türkçe| [[::UbuntuOnCluster/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/vi | • {{#if: UbuntuHelp:UbuntuOnCluster|Tiếng Việt| [[::UbuntuOnCluster/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/yue | • {{#if: UbuntuHelp:UbuntuOnCluster|粵語| [[::UbuntuOnCluster/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/zh | • {{#if: UbuntuHelp:UbuntuOnCluster|中文| [[::UbuntuOnCluster/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/zh-hans | • {{#if: UbuntuHelp:UbuntuOnCluster|中文(简体)| [[::UbuntuOnCluster/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UbuntuOnCluster | UbuntuHelp:UbuntuOnCluster | {{#if: | :}}UbuntuOnCluster}}/zh-hant | • {{#if: UbuntuHelp:UbuntuOnCluster|中文(繁體)| [[::UbuntuOnCluster/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:UbuntuOnCluster|:UbuntuOnCluster|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :UbuntuOnCluster/zh | | {{#ifexist: UbuntuOnCluster/zh | | {{#ifeq: {{#titleparts:UbuntuOnCluster|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:UbuntuOnCluster|1|-1|}} | zh | | }}
<<Include(Tag/Unsupported)>> <<Include(Tag/ContentCleanup)>> Per the above, please see and update [1] if changed. This article is very outdated. Either needs to be updated or deleted. This page documents the process of automatically installing Ubuntu on a cluster of machines. This means one machine will be manually set up as the install server, and all others will be install Ubuntu when booting. The version used here is hoary, and the installer used is debian-installer (The default Ubuntu installer). No tricks like FAI or kickstart are needed. Prerequisites on the server:
- Ubuntu-base install
- An Ubuntu .iso
- nat active on the server or all machines must receive a public dhcp IP address
- Several packages need to be installed
Stage 1: Preparing DHCP & PXE booting
1. First, you will need the MAC addresses for all machines, so they will get unique and constant IP addresses and hostnames.
2. Now install the packages dhcp3-server
and tftpd-hpa
(see Add Applications).
3. Once you have this list, you can edit your /etc/dhcp3/dhcpd.conf.
NOTE: PXE booting requires that the .iso file is mounted locally, I mounted it under /var/lib/tftpboot/ubuntu/
mkdir /var/lib/tftpboot/ubuntu echo '/data/ubuntu-5.04-install-i386.iso /var/lib/tftpboot/ubuntu/ auto defaults,loop 0 0' >> /etc/fstab mount -a
The next step is setting up the PXE configuration. You will need to create two files: one for installing and one for booting from the local disk (ie: booting the installed system). Create /var/lib/tftpboot/pxelinux.cfg and put these files there. As you can see, the default action is to run the installer. You can also set a few options in here (the kernel command line). As space can be limited, you may save some space on the kernel command line by creating symlinks to relevant files:
cd /var/lib/tftpboot ln -s ubuntu/install/netboot/ubuntu-installer/i386/initrd.gz ubuntu/install/netboot/ubuntu-installer/i386/linux ubuntu/install/netboot/pxelinux.0 ubuntu/install/netboot/ubuntu-installer/
You can see that in the example config files, these symlinks are used.
Stage 2: Setting up nis and nfs
For cluster machines, nis and nfs are usually used to share login information and parts of the filesystem, so it is necessary to install both on the server. You will need the packages nis nfs-kernel-server
.
Note: the nis package (not nis itself) is quite buggy, and it will automatically try to start ypbind. It also completely ignores preseed, so in a following step we will create a new version of this package. You just have to wait a bit for ypbind to time out.
When the nis setup asks for a domain, pick one you like. As soon as ypbind times out, stop nis again with
invoke-rc.d nis stop
Now you need to edit /etc/default/nis and enable the nis server. You also need to initialize the nis database with
/usr/lib/yp/ypinit -m
You can now start the nis services again
invoke-rc.d nis start
For NFS, you need to edit /etc/exports in order to export required parts of the filesystem. Exporting /home and /data, should look like:
# /etc/exports: the access control list for filesystems which may be exported # to NFS clients. See exports(5). /home 192.168.0.0/255.255.0.0(rw,async) /data 192.168.0.0/255.255.0.0(rw,async)
Now restart the nfs server.
invoke-rc.d nfs restart
Stage 3: Setting up a local mirror and proxy
Installing from a local mirror and using an http proxy for the rest greatly improves the speed of subsequent installs. Since apt-proxy is quite broken, you should use squid as a generic http proxy. To recover the reboot, install php or use a CGI script.
You will need the packages: apache2 libapache2-mod-php4 squid
This example has only one external IP address, so only the master server is connected to the internet. The other machines are only connected to the master (and via NAT they can reach the net). If you do not want a public proxy, make sure squid installer only uses eth1, the internal interface. You can tell apache to do so to by editing /etc/apache2/ports.conf.
invoke-rc.d apache2 stop echo 'Listen 192.168.0.1:80' > /etc/apache2/ports.conf echo 'Listen 127.0.0.1:80' >> /etc/apache2/ports.conf invoke-rc.d apache start
You should also edit the squid config. Now make the apache server an Ubuntu archive by symlinking into the .iso
ln -s /var/lib/tftpboot/ubuntu/ubuntu /var/www/ubuntu
Stage 4: preseed
Having everything in place on the server, you can now take care of the client configuration. The tftpboot will launch the Ubuntu installer. This installer usually asks questions, but the answers can be preseeded in a so called preseed file. Points for possible changes: language, package selection (which is an aptitude pattern), first-created user account, and partition manager setup. Go over these settings and adapt them to your needs.
Stage 5: Surviving the reboot
The installer reboots after the basic install, which means that the installer will be launched again. Of course you don't want this, which is why it is necessary to create a registration system. As you can see in the preseed file, the preseed/late-command has been set to wget http://192.168.0.1/register.php
. This does nothing on the client side, but the php script creates a PXE boot file for this machine which instructs it to boot from the local drive. If you want to reinstall a certain machine all you have to do is remove the associated PXE boot file and it will use the default again.
In order for this to work, the www-data
user must have write access to /var/lib/tftpboot/pxelinux.cfg.
chown :www-data /var/lib/tftpboot/pxelinux.cfg chmod g+w $_
This is the register.php script:
<?php function _dechex($x) { return sprintf("%02s",dechex($x)); } $host = strtoupper(implode('',array_map(_dechex,explode('.',$_SERVER['REMOTE_ADDR'])))); copy("/var/lib/tftpboot/pxelinux.cfg/localboot", "/var/lib/tftpboot/pxelinux.cfg/$host"); ?>
Stage 6: postinstall
The postinstall script can be used to do anything you like. I used it to install a correct nis package on the clients, create a correct NIS config and more bootstrapping things. Creating a correct NIS package is done as follows (for Breezy this won't be necessary: the package has been fixed).
mkdir nispackage cd nispackage apt-get source nis cd nis-3.12/debian
- Open the file
postinst
- comment out line 61 (the one with
db_input
- just before line 64 (the one with
if [ "$RET
add a line containing RET=domain where domain is the NIS domain you chose - comment out line 106 (The one with
db_text
)
Now enter the following sequence of commands:
cd .. apt-get build-dep nis dpkg-buildpackage
Copy the newly generated .deb (to be found in the nispackage folder) file to a location where the clients can retrieve them (either with wget or an nfs mount) The postinstallscript itself should be placed in /var/www Mine looks like this:
#!/bin/bash # Step 1: Initial mount mkdir /data mount -t nfs 192.168.0.1:/data /data -o rw,soft,bg,rsize=32768,wsize=32768,tcp,timeo=600,intr # Step 2: Install and configure NIS aptitude -y install portmap libslp1 dpkg -i /data/nis_3.12-3_i386.deb cp /data/nsswitch.conf /etc/nsswitch.conf echo '+::::::' >> /etc/passwd echo '+::::::::' >> /etc/shadow echo '+:::' >> /etc/group # Repair failing boot sequence (nis with nfs error) DIR=`pwd` cd /etc/rc2.d ln -s ../init.d/mountnfs.sh S20mountnfs.sh cd $DIR # Step 2: Correct mounting umount /data echo 'enterprise:/home /home nfs rw,soft,bg,rsize=32768,wsize=32768,tcp,timeo=600,intr' >> /etc/fstab echo 'enterprise:/data /data nfs rw,soft,bg,rsize=32768,wsize=32768,tcp,timeo=600,intr' >> /etc/fstab mount -a # Step 3: Correct sources.list and update cp /data/sources.list /etc/apt/sources.list aptitude update aptitude -y upgrade # Step 4: Installing other things and remove the installer log which contains a cleartext password aptitude -y install linux-686-smp manpages-dev rm /var/log/installer/debconf-seed rm /var/log/installer/cdebconf/questions.dat # Step 5: Enable scheduled scripts echo '0 * * * * root test -x /data/upgrade && /data/upgrade' >> /etc/crontab # Step 6: reboot, we installed a new kernel reboot