Tuesday, May 26, 2009

Automatic installation via PXE

This post is more howto than regular blog. I tried to setup PXE based automatic installation server.
There are some docu pages:
but they're both old and step-by-step doesn't work.

First of all, download openSUSE11.1.iso and create installation source:
wget http://download.opensuse.org/distribution/11.1/iso/openSUSE-11.1-DVD-i586.iso
mkdir /srv/www/htdocs/11.1
mount -o loop,uid=wwwrun openSUSE-11.1-DVD-i586.iso /srv/www/htdocs/11.1

Install apache web server:
zypper in apache2

Configure apache to use symlinks:
in /etc/apache2/default-server.conf, in section <Directory "/srv/www/htdocs">
change "Options None" to "Options FollowSymLinks"
restart apache:
rcapache2 restart

Note: my PXE server mas IP address. PXE client will have IP address and 08:00:27:B9:42:52 MAC address

Install DHCP server
zypper in dhcp-server

Configure DHCP server, to offer PXE, dhcpd.conf:
option domain-name-servers;
option routers;
default-lease-time 14400;
ddns-update-style none;
subnet netmask {
default-lease-time 14400;
max-lease-time 172800;
group { # id="pxe-client"
filename "pxelinux.0";
host PXEclient { hardware ethernet 08:00:27:B9:42:52; }

rcdhcpd restart

Install yast2-tftp-server and configure tftp service:
yast2 tftp (confirm to create /tftpboot)

Install syslinux and copy into /tftpboot:
zypper in syslinux
cp /usr/share/syslinux/pxelinux.0 /tftpboot/
rcxinetd restart

Copy and configure isolinux:
mkdir /tftpboot/pxelinux.cfg
cp iso/boot/i386/loader/isolinux.cfg /tftpboot/pxelinux.cfg/default

Copy kernel and initrd
cp iso/boot/i386/loader/linux
cp iso/boot/i386/loader/initrd

Edit config file to boot this as default:
default linux
label linux
append initrd=initrd splash=silent showopts install= insecure=1

implicit 1
display message
prompt 1
timeout 40

Configure your client (in BIOS setup) to "Boot from LAN", "PXE", "network boot" or something similar (depends on BIOS version).
Now we can start installation. On the last dialog, check "create reference profile" checkbox and click OK. When this will be done, copy profile from /root/autoyast.xml on your PXE server as /srv/www/htdocs/AY.xml.

Now you can update your /tftpboot/pxelinux.cfg/default (add autoyast option):
append initrd=initrd splash=silent showopts install= insecure=1 autoyast=

Ok, the result is what we wanted:
When you reboot client machine, it will be be automatically reinstalled to default installation (from autoyast profile). If you comment filename option (and restart dhcp server), client machine will only boot into installed system.

I hope it's clean to understand/reproduce and I hope it will help to somebody.
If not, I'm looking for your feedback ;-)