Difference between revisions of "CentOS installation as kickstart pxe server"
m (→Prepare for centos installation) |
m (→DHCPD server setup) |
||
(12 intermediate revisions by the same user not shown) | |||
Line 18: | Line 18: | ||
|sda || /boot || ext3 || align="right"| 4.000 MB | |sda || /boot || ext3 || align="right"| 4.000 MB | ||
|- | |- | ||
− | | | + | |sda || swap || swap || align="right"| 5.000 MB |
− | |- | + | |- |
|sda || /tmp || ext3 || align="right"| 25.000 MB | |sda || /tmp || ext3 || align="right"| 25.000 MB | ||
|- | |- | ||
Line 25: | Line 25: | ||
|- | |- | ||
|sdb || /home || ext3 || align="right"| 100.000 MB | |sdb || /home || ext3 || align="right"| 100.000 MB | ||
− | |||
− | |||
|- | |- | ||
+ | |sdb || /var || ext3 || align="right"| 100.000 MB | ||
+ | |- | ||
|sdb || swap || swap || align="right"| 5.000 MB | |sdb || swap || swap || align="right"| 5.000 MB | ||
|- | |- | ||
Line 39: | Line 39: | ||
No Selinux firewall. Running in secure environment. | No Selinux firewall. Running in secure environment. | ||
− | |||
= Post installation = | = Post installation = | ||
== Upgrading software == | == Upgrading software == | ||
Update the installed software to newest versions. | Update the installed software to newest versions. | ||
− | < | + | <source lang=cli> |
− | [root@localhost]# yum update | + | [root@localhost]# <input>yum update</input> |
− | </ | + | </source> |
== Permit ssh login as root == | == Permit ssh login as root == | ||
Uncomment the ''#PermitRootLogin yes'' line in ''/etc/ssh/sshd_config'' file and restart ''sshd'' | Uncomment the ''#PermitRootLogin yes'' line in ''/etc/ssh/sshd_config'' file and restart ''sshd'' | ||
− | < | + | <source lang=cli> |
− | [root@localhost ~]# vi +/PermitRootLogin /etc/ssh/sshd_config | + | [root@localhost ~]# <input>vi +/PermitRootLogin /etc/ssh/sshd_config</input> |
− | [root@localhost ~]# service sshd restart | + | [root@localhost ~]# <input>service sshd restart</input> |
− | </ | + | </source> |
== Changing hostname == | == Changing hostname == | ||
Changing the hostname to ''ks.tekkom.dk'' | Changing the hostname to ''ks.tekkom.dk'' | ||
− | < | + | <source lang=cli> |
− | [root@localhost ~]# hostname ks.tekkom.dk | + | [root@localhost ~]# <input>hostname ks.tekkom.dk</input> |
− | [root@localhost ~]# vi /etc/sysconfig/network | + | [root@localhost ~]# <input>vi /etc/sysconfig/network</input> |
− | </ | + | </source> |
= Preparing for network installation = | = Preparing for network installation = | ||
== Copying the ISO images to the server == | == 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. | Make a directory for [[NFS]] export or [[FTP]] access. Copy the [[dvd]] or the six cd's [[iso]] image to it. | ||
=== Prepare for centos installation === | === Prepare for centos installation === | ||
− | < | + | <source lang=cli> |
− | [root@localhost home]# mkdir /var/ftp/install | + | [root@localhost home]# <input>mkdir -p /var/ftp/install/centos52</input> |
− | + | [root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk1</input> | |
− | [root@localhost home]# dd if=/dev/hda of=/var/ftp/install/centos52/disk1 | + | [root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk2</input> |
− | [root@localhost home]# dd if=/dev/hda of=/var/ftp/install/centos52/disk2 | + | [root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk3</input> |
− | [root@localhost home]# dd if=/dev/hda of=/var/ftp/install/centos52/disk3 | + | [root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk4</input> |
− | [root@localhost home]# dd if=/dev/hda of=/var/ftp/install/centos52/disk4 | + | [root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk5</input> |
− | [root@localhost home]# dd if=/dev/hda of=/var/ftp/install/centos52/disk5 | + | [root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk6</input> |
− | [root@localhost home]# dd if=/dev/hda of=/var/ftp/install/centos52/disk6 | + | </source> |
− | </ | ||
== export ISO images directory via NFS == | == export ISO images directory via NFS == | ||
Export ''/home/iso'' directory ''read-only'' and start NFS daemons. Now and permanently. | Export ''/home/iso'' directory ''read-only'' and start NFS daemons. Now and permanently. | ||
− | < | + | <source lang=cli> |
− | [root@ks init.d]# echo "/home/iso *(ro,no_root_squash)" >> /etc/export | + | [root@ks init.d]# <input>echo "/home/iso *(ro,no_root_squash)" >> /etc/export</input> |
− | [root@ks init.d]# chkconfig --level 345 nfs on | + | [root@ks init.d]# <input>chkconfig --level 345 nfs on</input> |
− | [root@ks init.d]# service nfs start | + | [root@ks init.d]# <input>service nfs start</input> |
Starter NFS-tjenester: [ O.k. ] | Starter NFS-tjenester: [ O.k. ] | ||
Starter NFS-kvoter: [ O.k. ] | Starter NFS-kvoter: [ O.k. ] | ||
Starter NFS-dæmonen: [ O.k. ] | Starter NFS-dæmonen: [ O.k. ] | ||
Starter NFS mountd: [ O.k. ] | Starter NFS mountd: [ O.k. ] | ||
− | </ | + | </source> |
+ | == start ftp server == | ||
+ | ''vsftpd'' homedirectory ''/var/ftp''. Start vsftp now and permanently. | ||
+ | <source lang=cli> | ||
+ | [root@ks ~]# <input>chkconfig --level 345 vsftpd on</input> | ||
+ | [root@ks ~]# <input>service vsftpd start</input> | ||
+ | Starter vsftpd for vsftpd: [ O.k. ] | ||
+ | </source> | ||
+ | |||
== Network access == | == Network access == | ||
edit ''/etc/sysconfig/network-scripts/ifcfg-eth1'' to contain | edit ''/etc/sysconfig/network-scripts/ifcfg-eth1'' to contain | ||
− | < | + | <source lang=cli> |
DEVICE=eth1 | DEVICE=eth1 | ||
ONBOOT=yes | ONBOOT=yes | ||
Line 94: | Line 100: | ||
IPADDR=172.20.0.1 | IPADDR=172.20.0.1 | ||
TYPE=Ethernet | TYPE=Ethernet | ||
− | </ | + | </source> |
== NAT through the server == | == 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 | Allow masqerading from eth1 (172.20.0.0/24) network to outside eth0 (dhcp) network. Add the following lines to /etc/rc.local | ||
− | < | + | <source lang=cli> |
# Enable IP Forwading between Interfaces (Routing) | # Enable IP Forwading between Interfaces (Routing) | ||
echo "1" > /proc/sys/net/ipv4/ip_forward | 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 | # 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 | iptables -t nat -A POSTROUTING -s 172.20.0.0/24 -d 0.0.0.0/0 -o eth0 -j MASQUERADE | ||
− | </ | + | </source> |
== Installing additional services == | == Installing additional services == | ||
− | < | + | <source lang=cli> |
[root@ks init.d]# yum install tftp-server | [root@ks init.d]# yum install tftp-server | ||
[root@ks init.d]# yum install dhcp | [root@ks init.d]# yum install dhcp | ||
− | </ | + | </source> |
=== TFTP server setup === | === TFTP server setup === | ||
Edit ''/etc/xinetd.d/tftp'' and change disable from ''yes'' to ''no'', and restart ''xinetd''. | Edit ''/etc/xinetd.d/tftp'' and change disable from ''yes'' to ''no'', and restart ''xinetd''. | ||
− | < | + | <source lang=cli> |
− | [root@ks ~]# vi /etc/xinetd.d/tftp | + | [root@ks ~]# <input>vi /etc/xinetd.d/tftp</input> |
− | [root@ks ~]# service xinetd restart | + | [root@ks ~]# <input>service xinetd restart</input> |
Stopper xinetd: [ O.k. ] | Stopper xinetd: [ O.k. ] | ||
Starter xinetd: [ O.k. ] | Starter xinetd: [ O.k. ] | ||
− | </ | + | </source> |
=== DHCPD server setup === | === DHCPD server setup === | ||
Change ''/etc/dhcpd.conf'' to the contain the scope shown below: | Change ''/etc/dhcpd.conf'' to the contain the scope shown below: | ||
− | < | + | <source lang=cli> |
ddns-update-style interim; | ddns-update-style interim; | ||
− | + | authoritative; | |
option domain-name "tekkom.dk"; | option domain-name "tekkom.dk"; | ||
Line 137: | Line 143: | ||
filename "pxelinux.0"; | filename "pxelinux.0"; | ||
} | } | ||
− | </ | + | </source> |
Start the dhcpd daemon now and permanently. | Start the dhcpd daemon now and permanently. | ||
− | < | + | <source lang=cli> |
− | [root@ks ~]# chkconfig --level 345 dhcpd on | + | [root@ks ~]# <input>chkconfig --level 345 dhcpd on</input> |
− | [root@ks ~]# service dhcpd start | + | [root@ks ~]# <input>service dhcpd start</input> |
Starter dhcpd: [ O.k. ] | Starter dhcpd: [ O.k. ] | ||
− | </ | + | </source> |
+ | |||
= Preparing for PXE boot = | = Preparing for PXE boot = | ||
== Copy pxe boot files to tftp server directory == | == Copy pxe boot files to tftp server directory == | ||
Copy the PXE boot file to TFTP directory. Create ''/tftpboot/centos52'' directory and copy the pxeboot files from CentOS installation cd 1 (or DVD) | Copy the PXE boot file to TFTP directory. Create ''/tftpboot/centos52'' directory and copy the pxeboot files from CentOS installation cd 1 (or DVD) | ||
− | < | + | <source lang=cli> |
− | [root@ks ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot | + | [root@ks ~]# <input>cp /usr/lib/syslinux/pxelinux.0 /tftpboot</input> |
− | [root@ks ~]# mkdir /tftpboot/centos | + | [root@ks ~]# <input>mkdir /tftpboot/centos</input> |
− | [root@ks ~]# cp /media/CentOS_5.2_Final/images/pxeboot/* /tftpboot/centos52/ | + | [root@ks ~]# <input>cp /media/CentOS_5.2_Final/images/pxeboot/* /tftpboot/centos52/</input> |
− | </ | + | </source> |
== Create the PXE menu == | == Create the PXE menu == | ||
Copy the COM executable file to tftp server root. And create directory to hold menufile. | Copy the COM executable file to tftp server root. And create directory to hold menufile. | ||
− | < | + | <source lang=cli> |
− | cp /usr/lib/syslinux/menu.c32 /tftpboot | + | [root@ks ~]# <input>cp /usr/lib/syslinux/menu.c32 /tftpboot</input> |
− | [root@ks ~]# mkdir /tftpboot/pxelinux.cfg | + | [root@ks ~]# <input>mkdir /tftpboot/pxelinux.cfg</input> |
− | </ | + | </source> |
Create ''/tftpboot/pxelinux.cnf/default'' configuration file with the following content. | Create ''/tftpboot/pxelinux.cnf/default'' configuration file with the following content. | ||
− | < | + | <source lang=cli> |
default menu.c32 | default menu.c32 | ||
prompt 0 | prompt 0 | ||
Line 166: | Line 173: | ||
LABEL CentoS 5.2 i386 | LABEL CentoS 5.2 i386 | ||
MENU LABEL CentOS 5.2 i386 | MENU LABEL CentOS 5.2 i386 | ||
− | KERNEL | + | KERNEL centos/i386/5.2/vmlinuz |
− | append vga=normal initrd= | + | append vga=normal initrd=centos5.2/initrd.img ramdisk_size=32768 method=ftp://172.20.0.1/install/centos5.2 |
− | </ | + | </source> |
+ | == Create kickstart auto configuration files == | ||
+ | run: '''system-config-kickstart''' and save files in '''/var/ftp/install/centos52/kickstart''' (vsftp default homepath is /var/ftp). | ||
+ | |||
+ | Add the menuitem below to '''/tftpboot/pxelinux.cnf/default''' file | ||
+ | <source lang=cli> | ||
+ | LABEL CentoS 5.2 i386 Full cluster software automatic | ||
+ | MENU LABEL CentOS 5.2 i386 Full cluster software automatic | ||
+ | KERNEL centos52/vmlinuz | ||
+ | append vga=normal initrd=centos52/initrd.img ramdisk_size=32768 method=ftp://192.168.22.4/install/centos52 ks=ftp://192.168.22.4/install/centos52/kickstart/fullcluster.cfg | ||
+ | </source> | ||
= Links = | = Links = | ||
[http://shirwablog.com/?p=26 Nice page describing PXE from Centos Kickstart] | [http://shirwablog.com/?p=26 Nice page describing PXE from Centos Kickstart] | ||
+ | {{Source cli}} | ||
+ | |||
+ | |||
+ | [[Category:Linux]][[Category:Cluster]][[Category:CentOS]][[category:PXE]] |
Latest revision as of 06:31, 25 April 2012
Contents
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
Harddisk | Mount point | Type | Size |
---|---|---|---|
sda | / | ext3 | 5.000 MB |
sda | /boot | ext3 | 4.000 MB |
sda | swap | swap | 5.000 MB |
sda | /tmp | ext3 | 25.000 MB |
sda | /usr | ext3 | 40.000 MB |
sdb | /home | ext3 | 100.000 MB |
sdb | /var | ext3 | 100.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]# <input>yum update</input>
Permit ssh login as root
Uncomment the #PermitRootLogin yes line in /etc/ssh/sshd_config file and restart sshd
[root@localhost ~]# <input>vi +/PermitRootLogin /etc/ssh/sshd_config</input>
[root@localhost ~]# <input>service sshd restart</input>
Changing hostname
Changing the hostname to ks.tekkom.dk
[root@localhost ~]# <input>hostname ks.tekkom.dk</input>
[root@localhost ~]# <input>vi /etc/sysconfig/network</input>
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.
Prepare for centos installation
[root@localhost home]# <input>mkdir -p /var/ftp/install/centos52</input>
[root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk1</input>
[root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk2</input>
[root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk3</input>
[root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk4</input>
[root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk5</input>
[root@localhost home]# <input>dd if=/dev/hda of=/var/ftp/install/centos52/disk6</input>
export ISO images directory via NFS
Export /home/iso directory read-only and start NFS daemons. Now and permanently.
[root@ks init.d]# <input>echo "/home/iso *(ro,no_root_squash)" >> /etc/export</input>
[root@ks init.d]# <input>chkconfig --level 345 nfs on</input>
[root@ks init.d]# <input>service nfs start</input>
Starter NFS-tjenester: [ O.k. ]
Starter NFS-kvoter: [ O.k. ]
Starter NFS-dæmonen: [ O.k. ]
Starter NFS mountd: [ O.k. ]
start ftp server
vsftpd homedirectory /var/ftp. Start vsftp now and permanently.
[root@ks ~]# <input>chkconfig --level 345 vsftpd on</input>
[root@ks ~]# <input>service vsftpd start</input>
Starter vsftpd for vsftpd: [ 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
Edit /etc/xinetd.d/tftp and change disable from yes to no, and restart xinetd.
[root@ks ~]# <input>vi /etc/xinetd.d/tftp</input>
[root@ks ~]# <input>service xinetd restart</input>
Stopper xinetd: [ O.k. ]
Starter xinetd: [ O.k. ]
DHCPD server setup
Change /etc/dhcpd.conf to the contain the scope shown below:
ddns-update-style interim;
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 ~]# <input>chkconfig --level 345 dhcpd on</input>
[root@ks ~]# <input>service dhcpd start</input>
Starter dhcpd: [ O.k. ]
Preparing for PXE boot
Copy pxe boot files to tftp server directory
Copy the PXE boot file to TFTP directory. Create /tftpboot/centos52 directory and copy the pxeboot files from CentOS installation cd 1 (or DVD)
[root@ks ~]# <input>cp /usr/lib/syslinux/pxelinux.0 /tftpboot</input>
[root@ks ~]# <input>mkdir /tftpboot/centos</input>
[root@ks ~]# <input>cp /media/CentOS_5.2_Final/images/pxeboot/* /tftpboot/centos52/</input>
Create the PXE menu
Copy the COM executable file to tftp server root. And create directory to hold menufile.
[root@ks ~]# <input>cp /usr/lib/syslinux/menu.c32 /tftpboot</input>
[root@ks ~]# <input>mkdir /tftpboot/pxelinux.cfg</input>
Create /tftpboot/pxelinux.cnf/default configuration file with the following content.
default menu.c32
prompt 0
timeout 300
MENU TITLE Mercantec PXE Menu for Tekkom.
LABEL CentoS 5.2 i386
MENU LABEL CentOS 5.2 i386
KERNEL centos/i386/5.2/vmlinuz
append vga=normal initrd=centos5.2/initrd.img ramdisk_size=32768 method=ftp://172.20.0.1/install/centos5.2
Create kickstart auto configuration files
run: system-config-kickstart and save files in /var/ftp/install/centos52/kickstart (vsftp default homepath is /var/ftp).
Add the menuitem below to /tftpboot/pxelinux.cnf/default file
LABEL CentoS 5.2 i386 Full cluster software automatic
MENU LABEL CentOS 5.2 i386 Full cluster software automatic
KERNEL centos52/vmlinuz
append vga=normal initrd=centos52/initrd.img ramdisk_size=32768 method=ftp://192.168.22.4/install/centos52 ks=ftp://192.168.22.4/install/centos52/kickstart/fullcluster.cfg