Cobbler is a Linux installation server that allows for rapid setup of
network installation environments. It glues together and automates many
associated Linux tasks so you do not have to hop between many various
commands and applications when deploying new systems, and, in some
cases, changing existing ones. Cobbler can help with provisioning,
managing DNS and DHCP, package updates, power management, configuration
management orchestration, and much more.
Here in my example, my machine name is cobbler and its IP is 192.168.75.222 and its running CentOS 6.5 x86_64 version
1) For simplicity and testing purposes, disable SELinux
[root@cobbler ~]# vim /etc/sysconfig/selinux
selinux=disabled
2) Reboot your system after applying SELinux Changes
3) Install the EPEL Repo for Cobbler Packages
[root@cobbler ~]# rpm -ivh http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
4) Install the following packages
[root@cobbler ~]# yum install dhcp cobbler pykickstart mod_python tftp -y
5) Enable xinetd tftp and rsync services
[root@cobbler ~]# vim /etc/xinetd.d/tftp
disable = no <- change="" line="" no="" span="" this="" to="">
[root@cobbler ~]# vim /etc/xinetd.d/rsync
disable = no <- change="" line="" no="" span="" this="" to="">
6) Start the xinetd, httpd, cobbler services and start the necessary at boot time
[root@cobbler ~]# for i in xinetd httpd cobblerd; do service $i restart; chkconfig $i on; done;
[root@cobbler ~]# chkconfig tftp on
[root@cobbler ~]# chkconfig rsync on
7) Download the network boot-loaders for cobbler
[root@cobbler ~]# cobbler get-loaders
8) Change the default template of the dhcp file included with cobbler to match your network
[root@cobbler ~]# cp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.org
[root@cobbler ~]# vim /etc/cobbler/dhcp.template
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet 192.168.75.0 netmask 255.255.255.0 {
option routers 192.168.75.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.75.100 192.168.75.254;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.75.222;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
9) Change the cobbler setting file according to the below
[root@cobbler ~]# vim /etc/cobbler/settings
manage_dhcp: 1
next_server: 192.168.75.222
server: 192.168.75.222
10) Mount your CentOS 6.5 DVD to a mount point, here I am mounting on /mnt
[root@cobbler ~]# mount /dev/sr0 /mnt
11) Import the Distro details into cobbler using the below command (It takes time to copy the distro data into /var/www/cobbler/. So be patient)
[root@cobbler ~]# cobbler import --path=/mnt --name=CentOS_6.5_x86_64
12) Copy the default anaconda-ks.cfg to the default location of cobbler kickstart files
[root@cobbler ~]# cp anaconda-ks.cfg /var/lib/cobbler/kickstarts/centos65.ks
13) Modify the centos65.ks file to the following or according to your requirement
[root@cobbler ~]# vim /var/lib/cobbler/kickstarts/centos65.ks
install
url --url http://192.168.75.222/cobbler/ks_mirror/CentOS_6.5_x86_64/
lang en_US.UTF-8
zerombr
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$4t6CgzQlwQKVFUEb$.mWJx35kMLobSabwpoKzlVpTvmTjxapy5GjSJdWkWANgV9J0SE4tm/oYMQjOYFdAyp5FgpevxXmzyy5/3xcHS.
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone Asia/Kolkata
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
clearpart --linux --drives=sda
repo --name="CentOS" --baseurl=cdrom:sr0 --cost=100
%packages --nobase
@core
%end
14) Add the distro information to the cobbler for PXE Boot
[root@cobbler ~]# cobbler distro add --name=CentOS_6.5_x86_64 --kernel=/var/www/cobbler/ks_mirror/CentOS_6.5_x86_64/isolinux/vmlinuz --initrd=/var/www/cobbler/ks_mirror/CentOS_6.5_x86_64/isolinux/initrd.img
15) Add the kickstart profile to the distro
[root@cobbler ~]# cobbler profile add --name=CentOS_6.5_KS --distro=CentOS_6.5_x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos65.ks
16) Restart and synchronize the changes that were made into cobbler
[root@cobbler ~]# service cobblerd restart
[root@cobbler ~]# cobbler sync
17) Configure the firewall to allow ports 80 (HTTP) and 69 (TFTP)
[root@cobbler ~]# iptables -I INPUT -p tcp -s 192.168.75.0/24 -d 192.168.75.222 --dport 80 -j ACCEPT
[root@cobbler ~]# iptables -I INPUT -p udp -s 192.168.75.0/24 -d 192.168.75.222 --dport 69 -j ACCEPT
[root@cobbler ~]# service iptables save
18) Restart the below services once again to make sure all the changes are applied to the services
[root@cobbler ~]# for i in xinetd httpd cobblerd; do service $i restart; chkconfig $i on; done;
19) Boot a new linux machine and make sure it boots via Network and at the menu prompt select the CentOS_6.5_KS option
->->
Here in my example, my machine name is cobbler and its IP is 192.168.75.222 and its running CentOS 6.5 x86_64 version
1) For simplicity and testing purposes, disable SELinux
[root@cobbler ~]# vim /etc/sysconfig/selinux
selinux=disabled
2) Reboot your system after applying SELinux Changes
3) Install the EPEL Repo for Cobbler Packages
[root@cobbler ~]# rpm -ivh http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
4) Install the following packages
[root@cobbler ~]# yum install dhcp cobbler pykickstart mod_python tftp -y
5) Enable xinetd tftp and rsync services
[root@cobbler ~]# vim /etc/xinetd.d/tftp
disable = no <- change="" line="" no="" span="" this="" to="">
[root@cobbler ~]# vim /etc/xinetd.d/rsync
disable = no <- change="" line="" no="" span="" this="" to="">
6) Start the xinetd, httpd, cobbler services and start the necessary at boot time
[root@cobbler ~]# for i in xinetd httpd cobblerd; do service $i restart; chkconfig $i on; done;
[root@cobbler ~]# chkconfig tftp on
[root@cobbler ~]# chkconfig rsync on
7) Download the network boot-loaders for cobbler
[root@cobbler ~]# cobbler get-loaders
8) Change the default template of the dhcp file included with cobbler to match your network
[root@cobbler ~]# cp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.org
[root@cobbler ~]# vim /etc/cobbler/dhcp.template
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet 192.168.75.0 netmask 255.255.255.0 {
option routers 192.168.75.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.75.100 192.168.75.254;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.75.222;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}
9) Change the cobbler setting file according to the below
[root@cobbler ~]# vim /etc/cobbler/settings
manage_dhcp: 1
next_server: 192.168.75.222
server: 192.168.75.222
10) Mount your CentOS 6.5 DVD to a mount point, here I am mounting on /mnt
[root@cobbler ~]# mount /dev/sr0 /mnt
11) Import the Distro details into cobbler using the below command (It takes time to copy the distro data into /var/www/cobbler/. So be patient)
[root@cobbler ~]# cobbler import --path=/mnt --name=CentOS_6.5_x86_64
12) Copy the default anaconda-ks.cfg to the default location of cobbler kickstart files
[root@cobbler ~]# cp anaconda-ks.cfg /var/lib/cobbler/kickstarts/centos65.ks
13) Modify the centos65.ks file to the following or according to your requirement
[root@cobbler ~]# vim /var/lib/cobbler/kickstarts/centos65.ks
install
url --url http://192.168.75.222/cobbler/ks_mirror/CentOS_6.5_x86_64/
lang en_US.UTF-8
zerombr
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$4t6CgzQlwQKVFUEb$.mWJx35kMLobSabwpoKzlVpTvmTjxapy5GjSJdWkWANgV9J0SE4tm/oYMQjOYFdAyp5FgpevxXmzyy5/3xcHS.
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone Asia/Kolkata
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
clearpart --linux --drives=sda
repo --name="CentOS" --baseurl=cdrom:sr0 --cost=100
%packages --nobase
@core
%end
14) Add the distro information to the cobbler for PXE Boot
[root@cobbler ~]# cobbler distro add --name=CentOS_6.5_x86_64 --kernel=/var/www/cobbler/ks_mirror/CentOS_6.5_x86_64/isolinux/vmlinuz --initrd=/var/www/cobbler/ks_mirror/CentOS_6.5_x86_64/isolinux/initrd.img
15) Add the kickstart profile to the distro
[root@cobbler ~]# cobbler profile add --name=CentOS_6.5_KS --distro=CentOS_6.5_x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos65.ks
16) Restart and synchronize the changes that were made into cobbler
[root@cobbler ~]# service cobblerd restart
[root@cobbler ~]# cobbler sync
17) Configure the firewall to allow ports 80 (HTTP) and 69 (TFTP)
[root@cobbler ~]# iptables -I INPUT -p tcp -s 192.168.75.0/24 -d 192.168.75.222 --dport 80 -j ACCEPT
[root@cobbler ~]# iptables -I INPUT -p udp -s 192.168.75.0/24 -d 192.168.75.222 --dport 69 -j ACCEPT
[root@cobbler ~]# service iptables save
18) Restart the below services once again to make sure all the changes are applied to the services
[root@cobbler ~]# for i in xinetd httpd cobblerd; do service $i restart; chkconfig $i on; done;
19) Boot a new linux machine and make sure it boots via Network and at the menu prompt select the CentOS_6.5_KS option
->->
No comments:
Post a Comment