CentOS installation as kickstart pxe server

From Teknologisk videncenter
Revision as of 16:24, 10 March 2009 by Heth (talk | contribs) (Installation of CentOS 5.2)
Jump to: navigation, search

Introduction

Installation of Centos 5.2 as a PXE server to install Centos Servers via the network.
The reason for this project is that we need to teach the students Linux Clustering, and the students need to install a CentOS cluster. This server will reduce the time needed to install several cluster nodes.

Installation of CentOS 5.2

Find a suitable server with at least 1GB of ram and two NIC's of which one should be 1000BASET.

Harddisk partitionering

SATA Harddisk sda 115 GB SATA Harddisk sdb 305 GB

Hard disk partitions
Harddisk Mount point Type Size
sda / ext3 5.000 MB
sda /boot ext3 4.000 MB
sda /var ext3 25.000 MB
sda /tmp ext3 25.000 MB
sda /usr ext3 40.000 MB
sdb /home ext3 150.000 MB
sda swap swap 5.000 MB
sdb swap swap 5.000 MB

Choosing installation categories

  • Desktop - Gnome
  • Desktop - KDE
  • Server
  • Server - GUI

No Selinux firewall. Running in secure environment.

Post installation

Upgrading software

Update the installed software to newest versions.

[root@localhost]# yum update
[root@localhost ~]#

Permit ssh login as root

Uncomment the #PermitRootLogin yes line in /etc/ssh/sshd_config file and restart sshd

[root@localhost ~]# vi +/PermitRootLogin /etc/ssh/sshd_config
[root@localhost ~]# service sshd restart

Changing hostname

Changing the hostname to ks.tekkom.dk

[root@localhost ~]# hostname ks.tekkom.dk
[root@localhost ~]# vi /etc/sysconfig/network

Preparing for network installation

Copying the ISO images to the server

Make a directory for NFS export or FTP access. Copy the dvd or the six cd's iso image to it.

[root@localhost home]# mkdir /home/iso
[root@localhost home]# dd if=/dev/hda of=/home/iso/disk1
[root@localhost home]# dd if=/dev/hda of=/home/iso/disk2
[root@localhost home]# dd if=/dev/hda of=/home/iso/disk3
[root@localhost home]# dd if=/dev/hda of=/home/iso/disk4
[root@localhost home]# dd if=/dev/hda of=/home/iso/disk5
[root@localhost home]# dd if=/dev/hda of=/home/iso/disk6

export ISO images directory via NFS

Export /home/iso directory read-only and start NFS daemons. Now and permanently.

[root@ks init.d]# echo "/home/iso *(ro,no_root_squash)" >> /etc/export
[root@ks init.d]# chkconfig --level 345 nfs on
[root@ks init.d]# service nfs start
Starter NFS-tjenester:                                     [     O.k.    ]
Starter NFS-kvoter:                                        [     O.k.    ]
Starter NFS-dæmonen:                                       [     O.k.    ]
Starter NFS mountd:                                        [     O.k.    ]

Network access

edit /etc/sysconfig/network-scripts/ifcfg-eth1 to contain

DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
HWADDR=00:0e:0c:cf:d2:cb
NETMASK=255.255.255.0
IPADDR=172.20.0.1
TYPE=Ethernet

NAT through the server

Allow masqerading from eth1 (172.20.0.0/24) network to outside eth0 (dhcp) network. Add the following lines to /etc/rc.local

#  Enable IP Forwading between Interfaces (Routing)
echo "1" > /proc/sys/net/ipv4/ip_forward
# Allow the internal hosts to connect to any IP address on the outside 0.0.0.0/24
iptables -t nat -A POSTROUTING -s 172.20.0.0/24 -d 0.0.0.0/0 -o eth0 -j MASQUERADE 

Installing additional services

[root@ks init.d]# yum install tftp-server
[root@ks init.d]# yum install dhcp

TFTP server setup

DHCPD server setup

Change /etc/dhcpd.conf to the contain the scope shown below:

ddns-update-style interim;
not authoritative;

option domain-name "tekkom.dk";
option domain-name-servers 172.16.4.77;
option subnet-mask 255.255.255.0;
subnet 172.20.0.0 netmask 255.255.255.0 {
        authoritative;
        range 172.20.0.10 172.20.0.90;
        next-server 172.20.0.1;
        option routers 172.20.0.1;
        allow unknown-clients;
        allow booting;
        allow bootp;
        filename "pxelinux.0";
}

Start the dhcpd daemon now and permanently.

[root@ks ~]# chkconfig --level 345 dhcpd on
[root@ks ~]# service dhcpd start
Starter dhcpd:                                             [     O.k.    ]

Links

Nice page describing PXE from Centos Kickstart