2009年10月14日星期三

CentOS PXE server setup.

Here we use FTP server.
1. Install DHCP server
yum install dhcp
vi /etc/dhcpd.conf
We can use /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample as an example or check my last post.
2. Install TFTP server
yum install tftp-server
vi /etc/xinetd.d/tftp
change the line to be: disable = no
3.Create Network installation source
yum install vsftpd
mkdir –p /var/ftp/install/centos/x86_64/5.3/
mount –t iso9660 -o loop CentOS-5.3-x86_64-bin-DVD.iso /media/cdrom/
cp –avr /media/cdrom/* /var/ftp/install/centos/x86_64/5.3/
4.start the DHCP,TFTP, VSFTP servers
/etc/init.d/dhcpd restart
/etc/init.d/xinetd restart
/etc/init.d/vsftpd restart

5. Setup tftp boot files
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
mkdir –p /tftpboot/images/centos/x86_64/5.3/
cp /var/ftp/install/centos/
x86_64/5.3/images/pxeboot/vmlinuz images/centos/x86_64/5.3/
cp /var/ftp/install/centos/x86_64/5.3/images/pxeboot/initrd images/centos/x86_64/5.3/
6.Create PXE menu
cp /usr/lib/syslinux/menu.c32 /tftpboot
mkdir /tftpboot/pxelinux.cfg
touch /tftpboot/pxelinux.cfg/default
vi /tftpboot/pxelinux.cfg/default
This is a concise version. More details can be found through here.

Ubuntu PXE boot server setup.

Here I use HTTP server for the PXE boot.
1. Install Ubuntu 9.04 server.
2. Install DHCP server and modify the configure file.
apt-get install dhcp3-server
vi /etc/dhcp3/dhcpd.conf

The new dhcpd.conf should look like:
option domain-name-servers 145.253.2.75, 193.174.32.18;

default-lease-time 86400;
max-lease-time 604800;

authoritative;

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.49;
next-server 192.168.0.1;
filename "pxelinux.0";
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
}

2. Install TFTP server
apt-get install tftpd-hpa
vi /etc/default/tftpd-hpa

change the line to be: RUN_DAEMON=”yes”

mount -t iso9660 -o loop Ubuntu-install.iso /media/cdrom/

cp -r /media/cdrom/netboot/* /var/lib/tftpboot/

vi /var/lib/tftpboot/pxelinux.cfg/default

3.Install APACHE2 server:

apt-get install apache2

mkdir -p /var/www/install/ubuntu/9.04/

cp -r /media/cdrom/* /var/www/install/ubuntu/9.04/

4. Start all the servers

/etc/init.d/dhcpd restart

/etc/init.d/tftpd-hpa restart

/etc/init.d/apache2 restart

Now, we can install the ubuntu 9.04 through 192.168.0.1.

Notice: when the installation comes to select a mirror, go to the first line and input the server information for 192.168.0.1.