CentOS / RHEL 7 : How to Automated OS Installation using Kickstart Method

Automated OS Installation Advantages:-
  1. Install More than one server yet the same time
  2. Save lot of time by creating auto answer file
  3. Multiple Distributions also supported
  4. Post installation scripts helps in automating more tasks
Kickstart Method uses below protocols:-
 FTP
 NFS
 HTTP

Step 1: Mount ISO and Dump Media Source files

First choose the protocol which your going to use for this Kickstart method installation, above mentioned protocols will be supported. HTTP, HTTPS, NFS and FTP.
FTP protocol use /var/ftp/pub/as default path
CD/DVD media mounting using,

# mount /dev/sr0 /run/media/root/RHEL-7.1 Server.x86_64
# cd /run/media/root/RHEL-7.1\ Server.x86_64/Packages

Step:-2 install FTP server

# rpm –ivh vsftpd-3.0.2-9.el7.x86_64
#cd /run/media/root/RHEL-7.1\ Server.x86_64/
#cp –rvf * /var/ftp/pub

Step:-3 Create yum repository

# cd /etc/yum.repos.d/
#rm -rf packagekit-media.repo
[root@classroom yum.repos.d]# ls
yum.repo

create new repository :-
[root@classroom yum.repos.d]# vim rhel7.repo
[rhel7]
name=rhel7-repo
baseurl=ftp://classroom.example.com/pub/
enabled=1
gpgcheck=0

[root@classroom yum.repos.d]# yum repolist

Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management.
repo id repo name status
rhel7 rhel7-repo 4,371
repolist: 4,371

Step 4 :-Installation and generate Kickstart file / Auto Answer File

# yum install system-config-kickstart –y

Step 5:- Generating Auto Answer File
[root@classroom ~]# system-config-kickstart



Now save the kickstart configuration file into /var/ftp/pub/ks.cfg and disable selinux and Firewalld

# setenforce 0
# systemctl stop firewalld
# systemctl disable firewalld

Step 6:- configure dhcp server

DHCP Server Profile
Packages : dhcp*
Service : dhcpd.service
Config file : /etc/dhcp/dhcpd.conf
Port Number: 67
Installing DHCP server required packages using yum

[root@mail ~]# yum install dhcp* -y
[root@mail ~]# systemctl enable dhcpd
[root@mail ~]# systemctl start dhcpd
Job for dhcpd.service failed. See 'systemctl status dhcpd.service' and 'journalctl -xn' for
details.
you may receive above error some times don’t worry after we set and DHCP server
configuration restart service will work normally

[root@mail ~]# firewall-cmd --permanent --add-service=dhcp
success
[root@mail ~]# firewall-cmd --reload
success

Copy the sample configuration file to main configuration file.

[root@mail ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example
/etc/dhcp/dhcpd.conf
cp: overwrite ‘/etc/dhcp/dhcpd.conf’? y
Now edit the config file /etc/dhcp/dhcpd.conf

[root@mail ~]# vim /etc/dhcp/dhcpd.conf

Default Line number 48
# A slightly different configuration for an internal subnet.
subnet 192.168.72.0 netmask 255.255.255.0 {
range 192.168.72.10 192.168.72.254 ;
option domain-name-servers classroom.example.com ;
option domain-name " classroom.example.com ";
option routers 192.168.72.1 ;
option broadcast-address 192.168.72.255 ;
default-lease-time 600;
max-lease-time 7200;
}

Step 7:- Restart the dhcpd service and test

[root@mail ~]# systemctl restart dhcpd
[root@mail ~]# systemctl status dhcpd
It is shown active (running ) state.
[root@mail ~]# dhcpd configtest

[root@classroom ~]# systemctl restart vsftpd
[root@classroom ~]# systemctl enable vsftpd

Then go to VMware workstation Edit -> virtual network editor
And configure all machine host only and create net VM in vmware workstation
And go to client side and press Esc on starting VM
Boot path:- linux ks=ftp://192.168.72.10/pub/ks.cfg then after start kickstart installation automatically







1 comment:

T he primary difference is that  Linux  and  Unix  are two different Operating Systems though they both have some common commands. Let...