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:
http://en.opensuse.org/SuSE_install_with_PXE_boot
http://en.opensuse.org/SDB:Network_Installation_of_SuSE_Linux_via_PXE_Boot
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 172.168.1.1 IP address. PXE client will have 172.168.1.2 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 172.168.1.1;
option routers 172.168.1.1;
default-lease-time 14400;
ddns-update-style none;
subnet 172.168.1.0 netmask 255.255.255.0 {
range 172.168.1.2 172.168.1.30;
default-lease-time 14400;
max-lease-time 172800;
}
group { # id="pxe-client"
next-server 172.168.1.1;
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:
/tftpboot/pxelinux.cfg/default:
default linux
label linux
append initrd=initrd splash=silent showopts install=http://172.168.1.1/11.1 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=http://172.168.1.1/11.1 insecure=1 autoyast=http://172.168.1.1/AY.xml



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 ;-)

4 comments:

kinclong2 said...

Hi,

Nice guidance!
BTW, How to create bootable .ISO file from partitions contain installed OpenSuse 11.1? I want to use it as the base OS of all computing nodes in a computer cluster?

Thank!

marry said...

Blogs are so informative where we get lots of information on any topic. Nice job keep it up!!
_____________________________

International Finance Dissertation

Dissertation Writing service said...

This kind of information is very limited on internet. Nice to find the post related to my searching criteria. Your updated and informative post will be appreciated by blog loving people.

Dissertation Samples

stacy said...

This is my Good luck that I found your post which is according to my search and topic, I think you are a great blogger, thanks for helping me outta my problem..
Dissertation Writing Service