Using Cobbler on Linux can quickly establish a Linux network installation environment, significantly lowering the technical barrier for Linux network installations. So how do we install Cobbler on a Linux system? Let’s learn together.
Introduction to Cobbler
Cobbler is an open-source project supported by Redhat, used for deploying and installing systems. Therefore, it has good support for Redhat-based operating systems, but very poor support for Ubuntu. Many settings in Cobbler are only effective for Redhat, and due to the differences in installation among various distributions, Cobbler seems to have a tense relationship with Ubuntu.
Cobbler is not just a PXE server; it can also manage DNS (bind) and DHCP. In general, DHCP is not allowed in data centers or production environments, but PXE requires DHCP. Therefore, we need to allocate IP addresses based on MAC addresses so that DHCP does not affect the network.
1. Install Cobbler
First, configure the EPEL repository: http://mirrors.ustc.edu.cn/fedora/epel/6/i386/
[root@60sec /]# yum -y install cobbler
[root@60sec /]# service httpd start
Starting httpd: [ OK ]
[root@60sec /]# service cobblerd start
Starting Cobbler daemon: [ OK ]
2. Run the Cobbler Check Command to Check for Issues and Resolve Them One by One
[root@60sec /]# vim /etc/cobbler/settings
next_server: 192.168.83.137
server: 192.168.83.137
manage_tftpd: 0
[root@60sec /]# yum -y install syslinux
[root@60sec /]# chkconfig rsync on
[root@60sec /]# yum -y install pykickstart
[root@60sec /]# openssl passwd -1 -salt ‘openssl rand -hex 4’
Password:
$1$openssl $.oduSwbhLj6jqAwVsLo/H1
[root@60sec /]# vim /etc/cobbler/settings
default_password_crypted: “penssl $.oduSwbhLj6jqAwVsLo/H1”
[root@60sec /]# cd /usr/share/syslinux/
[root@60sec syslinux]# cp -r ./* /var/lib/cobbler/loaders/
3. Install the DHCP Service
[root@60sec /]# yum -y install dhcp
[root@60sec /]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
[root@60sec /]# vim /etc/dhcp/dhcpd.conf
option domain-name “60sec.com”;
option domain-name-servers 192.168.83.137;
default-lease-time 43300;
max-lease-time 86500;
subnet 192.168.83.0 netmask 255.255.255.0 {
range 192.168.83.50 192.168.83.100;
option routers 192.168.83.137;
}
next-server 192.168.83.137;
filename=”pxelinux.0″;
[root@60sec /]# service dhcpd start
Starting dhcpd: [ OK ]
4. Start the TFTP Service
[root@60sec /]# chkconfig tftp on
[root@60sec /]# service xinetd start
Starting xinetd: [ OK ]
5. Define Distro, Mount CD-ROM, and Import
[root@60sec /]# mount -r /dev/cdrom /media/
[root@60sec /]# cobbler import –name=centos-6.5-x86_64 –path=/media
6. If You Have a Kickstart File, Use “–kickstart=/path/to/kickstart_file” to Import, You Can Also Use the Following Command to Check
You can use system-config-kickstart to create a kickstart file. The default kickstart files for Cobbler are located in /var/lib/cobbler/kickstarts/ and can be customized according to different needs.
[root@60sec mnt]# ksvalidator centos6.x86_64.cfg
7. Set Profile; Profile Can Be Understood as Categorizing According to Installation Requirements
[root@60sec mnt]# cobbler profile add –name=CenTos-6.5-x86_64-basic –distro=centos-6.5-x86_64 –kickstart=/mnt/centos6.x86_64.cfg
[root@60sec mnt]# cobbler profile list
CenTos-6.5-x86_64-basic
Centos-6.5-x86_64
[root@60sec mnt]# cobbler sync
[root@60sec mnt]# service cobblerd restart
You can modify the relevant information
[root@60sec mnt]# vim /var/lib/tftpboot/pxelinux.cfg/default
8. Recreate the Virtual Machine for Testing
These are the specific steps for installing Cobbler on Linux. By following the steps outlined above, you can easily install Cobbler. Isn’t it quite easy? Go ahead and give it a try!