This howto will describe how to setup Linux network install server. We will be using pxeboot and dhcp to allow for bare metal installation without the need for physical media. Network install servers are essential when large numbers of machines need to be setup or in cases where machines are frequently setup as well as for deployment of xen virtual machines.
I have used Centos 5.1 in this howto however i am sure it can be adapted to work with any other Linux distribution as the concepts remain the same. The main components that i have used are the following.
I will assume that you already have an installed bare bones Centos 5.1 system with the hostname server1.example.com. During this howto we will be using the fictitious domain example.com please substitute with your own domain, and the 192.168.1.0/24 network
For this how to we will be using a DNS server because our media is stored on a virtual host, however it is possible to skip DNS setup and just use ip addresses if the installation servers http server is only going to be used to serve the media.
# yum install bind bind-chroot
options {
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view single_view {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.rfc1912.zones";
zone "example.com" {
type master;
file "data/example.com.hosts";
};
zone "1.168.192.in-addr.arpa" {
type master;
file "data/1.168.192.in-addr.arpa.hosts";
};
};
$ttl 38400
@ IN SOA server1.example.com. root.example.com. (
2008012900
10800
3600
604800
38400 )
@ IN NS server1.example.com.
server1 IN A 192.168.1.2
kickstart IN A 192.168.1.2
$ttl 38400
@ IN SOA server1.example.com. root.example.com. (
2008012900
10800
3600
604800
38400 )
@ IN NS server1.example.com.
2 IN PTR server1.example.com.
# chkconfig --level 345 named on # service named start
We need a dhcp server to allow for pxebooting and automatic assignment of network parameters.
# yum install dhcp
option domain-name-servers 192.168.1.2;
allow booting;
allow bootp;
next-server 192.168.1.2;
filename "pxelinux.0";
subnet 192.168.1.0 netmask 255.255.255.0
{
range 192.168.1.50 192.168.1.250;
allow unknown-clients;
ignore client-updates;
}
# chkconfig --level 345 dhcpd on # service dhcpd start
The tftp server is used to serve the boot images that are required to pxe boot the machines to be installed.
# yum install tftp-server
# chkconfig --level 345 tftp-server on
# cp /usr/lib/syslinux/pxelinux.0 /tftpboot
# mkdir /tftpboot/{pxelinux.cfg,msgs,os}
# service xinetd restart
The http server is used to serve our install tree
# yum install httpd
NameVirtualHost *:80 <VirtualHost *:80> Servername server1.example.com </VirtualHost> <VirtualHost *:80> Servername kickstart.example.com DocumentRoot /srv/www ErrorLog logs/kickstart.example.com-error_log CustomLog logs/kickstart.example.com-access_log common <Directory /srv/www/> Options +Indexes </Directory> </VirtualHost>
You can setup as many distributions as you want, i will be setting up Centos to serve as an example on how it is done.
# mkdir -p /srv/www/centos/5.1/os/i386 * Copy files from the DVD or CD's
# mount /media/cdrom # cp /media/cdrom/* /srv/www/centos/5.1/os/i386
# mkdir /tftpboot/os/centos_5.1
# cp /media/cdrom/images/pxeboot/{vmlinuz,initrd.img} /tftpboot/os/centos_5.1
install url --url http://kickstart.example.com/centos/5.1/os/i386/
default centos5.1
prompt 1
timeout 600
display boot.msg
label centos5.1
kernel os/centos_5.1/vmlinuz
append ks=http://kickstart.example.com/centos_5.1.ks initrd=os/centos_5.1/initrd.img