• Get In Touch
May 31, 2017

How to Install and Configure Cobbler on CentOS 7

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Cobbler is free and open source Linux installation server Which allows rapid setup of network installation environments. You can install operating systems automatically on multiple systems simultaneously over the network using Cobbler. Cobbler can help with provisioning, managing DNS and DHCP, package updates, power management, configuration management orchestration, and much more. OS installation in Cobbler is based on the Kickstart file and used start installation on clients or systems.

Requirements

Cobbler does not require any special kind of hardware to install. You’ll only need a CentOS 7 server and a root user privileges over it. You can switch from non root user to root user using sudo -i .

Update System

It is highly recommended to install Cobbler on a freshly updated server and system. So you are requested to upgrade available packages and update your system. Simply run below given command and it’ll do the job for you.

“yum -y update`

Next, enable the EPEL repository using following command.

yum -y install epel-release

Install Cobbler

Before installing Cobbler on your server you’ll need to install the Apache web server and to do so run following command.

yum -y install httpd

Next, run the following command to install Cobbler along with its required dependent packages.

yum -y install cobbler cobbler-web dnsmasq syslinux pykickstart xinetd

Next, you’ll need to start Cobbler and the Apache web server and enable them to run at boot time. Run following command to do so.

systemctl start cobblerd
systemctl enable cobblerd
systemctl start httpd
systemctl enable httpd

Next, you’ll need to disable SELinux services and run following commnad to disable it temporarily.

setenforce 0

Modify Firewall Rules

You’ll need to modify and change firewall rules and to do so run following commands one after another.

firewall-cmd --add-port=80/tcp --permanent

firewall-cmd --add-port=443/tcp --permanent

firewall-cmd --add-service=dhcp --permanent

firewall-cmd --add-port=69/tcp --permanent

firewall-cmd --add-port=69/udp --permanent

firewall-cmd --add-port=4011/udp --permanent

firewall-cmd --reload

Configure Cobbler

We have successfully installed Cobbler on your CentOS 7 server now let’s configure it.

First of all you’ll need to generate an encrypted root password and to do so run following command.

openssl passwd -1

[root@sajid ~]# openssl passwd -1
Password:
Verifying - Password:
$1$j9/aR8Et$uovwBsGM.cLGcwR.Nf7Qq0
 [root@sajid ~]#

Next, update this encrypted root password in settings file /etc/cobbler/settings under the parameter default_password_crypted .
You’ll also need to enable Cobbler’s DHCP, DNS,PXE and TFTP feature by changing the parameter value from 0 to 1.

You can use any text editor to edit /etc/cobbler/settings file, here we are using nano text editor. You can also install it yum -y install nano

nano /etc/cobbler/settings

default_password_crypted: "$1$j9/aR8Et$uovwBsGM.cLGcwR.Nf7Qq0"
manage_dhcp: 1
manage_dns: 1
pxe_just_once: 1
next_server: YourServerIP
server: YourServerIP

Next, you’ll need to edit /etc/cobbler/dhcp.template to update subnet for the dhcp server. Run following command to edit this file.

nano /etc/cobbler/dhcp.template

-----------------------------------------------
subnet 172.168.10.0  netmask 255.255.255.0 {
     option routers             172.168.10.5;
     option domain-name-servers 172.168.10.5;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        172.168.10.80 172.168.10.140;
     default-lease-time         21700;
     max-lease-time             43100;
     next-server                $next_server;

     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";
          }
     } 
}
--------------------------------------------

Save the file and exit from the text editor.

Next, update the IP address range in the /etc/cobbler/dnsmasq.template file and run following command to edit this file.

nano /etc/cobbler/dnsmasq.template

Update your IP range then save the file and exit from the text editor.

dhcp-range=192.168.10.80,192.168.10.140

Next, you’ll need to restart your Cobbler and xinetd service and sync these changes to cobbler. Run following commands to do so.

systemctl restart cobblerd
systemctl restart xinetd
systemctl enable xinetd
cobbler check
cobbler sync

Next, you’ll need to create a directory and copy the ISO file of CentOS 7 and run the commands below to import ISO to Cobbler.

mkdir /mnt/iso
mount -o loop CentOS-7-x86_64-DVD-1511.iso /mnt/iso/
cobbler import --arch=x86_64 --path=/mnt/iso --name=CentOS7

You can import ISO files of other Linux flavors also. In case if you are getting signature errors while importing, then run the below command to resolve the issue.

cobbler signature update

Next, you’ll need to verify the Distro list and run following command to view the Distro list.

cobbler distro list

You should see the following output.

CentOS7-x86_64

Create Kickstart File

You’ll need to create a Kickstart file for CentOS 7 with a name CentOS7.ks. /var/lib/cobbler/kickstarts is the default location of kickstart files.

Now create a CentOS7.ks file using any text editor, here we are using the nano text editor.

nano /var/lib/cobbler/kickstarts/CentOS7.ks

Add the following content to the file then save and exit from the text editor.

Replace server IP, root password and other details with your own ones.

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use HTTP installation media
url --url="http://172.168.10.5/cblr/links/CentOS7-x86_64/"

# Root password
rootpw --iscrypted $1$j9/aR8Et$uovwBsGM.cLGcwR.Nf7Qq0

# Network information
network --bootproto=dhcp --device=eth0 --onboot=on

# Reboot after installation
reboot

# System authorization information
auth useshadow passalgo=sha512

# Use graphical install
graphical

firstboot disable

# System keyboard
keyboard us

# System language
lang en_US

# SELinux configuration
selinux disabled

# Installation logging level
logging level=info

# System timezone
timezone Europe/Amsterdam

# System bootloader configuration
bootloader location=mbr

clearpart --all --initlabel
part swap --asprimary --fstype="swap" --size=1024
part /boot --fstype xfs --size=500
part pv.01 --size=1 --grow
volgroup root_vg01 pv.01
logvol / --fstype xfs --name=lv_01 --vgname=root_vg01 --size=1 --grow

%packages
@^minimal

@core
%end
%addon com_redhat_kdump --disable --reserve-mb='auto'
%end

Finally sync the updated profile to cobbler server and to do so run folllowing command.

cobbler profile edit --name=CentOS7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7.ks
cobbler sync

Web Interface

Open up your favorite web browser and visit http://YourServerIP/cobbler_web/
Use Cobbler as both username and password.

Boot the Clients with PXE

Basic configuration of Cobbler is finished now boot the system with pxe on which you want to perform automatic os installation.

Finally Select the CentOS 7 as OS and press enter and you’ll see that OS installation is started.

Conclusion

In this tutorial you learned to install Cobbler and configure it on your CentOS 7 server. We hope now you have enough knowledge that you can use Cobbler to install OS on multiple system simultaneously.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]