How to setup a network install server
January 29, 2008 at 08:53 PM | categories: Kickstart, Howto, RHEL, Centos, Linux | View CommentsThis 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.
- http server - apache
- tftp server
- dhcp server - isc dhcp
- dns server - isc bind
Installation of software
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
DNS server
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.
Install bind
# yum install bind bind-chroot
Configure bind and add the example.com zone, make the changes below to the file /var/named/chroot/etc/named.conf
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";
};
};
Add this to the file /var/named/chroot/var/named/data/example.com.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
Add this to the file /var/named/chroot/var/named/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.
2 IN PTR server1.example.com.
Setup bind to start at boot
# chkconfig --level 345 named on
# service named start
DHCP server
We need a dhcp server to allow for pxebooting and automatic assignment of network parameters.
Install dhcp server
# yum install dhcp
Configure the dhcp server make changes to /etc/dhcpd.conf to look like below
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;
}
Enable dhcp server to start at boot
# chkconfig --level 345 dhcpd on
# service dhcpd start
Tftp server
The tftp server is used to serve the boot images that are required to pxe boot the machines to be installed.
Install tftp server
# yum install tftp-server
Configure tftp-server to start at boot
# chkconfig --level 345 tftp-server on
Copy syslinux image to tftp server directory
# cp /usr/lib/syslinux/pxelinux.0 /tftpboot
Create pxeboot directory structure
# mkdir /tftpboot/{pxelinux.cfg,msgs,os}
Start tftp server
# service xinetd restart
Http server
The http server is used to serve our install tree
Install apache
# yum install httpd
Configure virtual hosts, Since i need to allow for the server to be used for other purposes i am going to setup virtualhosts. The first virtual host is the default virtual host and the second one is the one that will be serving our network install. Edit the file /etc/httpd/conf/httpd.conf and add the following.
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>
Setup distributions
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.
Centos 5.1
Create directories to hold the install tree
# 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
Create the directory to hold pxe boot images
# mkdir /tftpboot/os/centos_5.1
Copy pxeboot images to server
# cp /media/cdrom/images/pxeboot/{vmlinuz,initrd.img} /tftpboot/os/centos_5.1
Create a minimal kickstart to point to http installation, create file /srv/www/centos_5.1.ks and add the following
install
url --url http://kickstart.example.com/centos/5.1/os/i386/
Add Centos 5.1 to tftpboot menu, edit the file /tftpboot/pxelinux/default and add the following
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
blog comments powered by Disqus