Hello guys,

Today I am gonna write about automated CentOS installation. Every single amateur sysadmin trying these installation

Use virtual machine. Because they have clone system. Install the system after that just clone it. That’s it.

This is not such a good idea. Why?

When you clone the whole OS, basically you have to change hostname, or static ip…

Use container system. You can create an OS really fast way to.

Hey brother, we are talking about Operating System, not container. You have to create a Bare-Metal system for Docker or rkt.



What a magical word, right?

This is really magical tool, you can install 1 to 10000 server in same time without type anything. Maybe, you heard Anaconda. You can see this word when you install CentOS, Fedora or Red Hat.

Anyway, I want to show, how?


First of all, I will use CentOS 7.4.1708 minimal version, but you can find this feature at Fedora or Red Hat Enterprise Linux.

What should you do right now?

I will give you the file, you just copy it. That’s it.

This is just a boilerplate

# ks.cfg


# System authorization information
auth --enableshadow --passalgo=sha512

# Use CDROM installation media

# Use text install

# It is not run the Setup Agent on first boot
# I don't recommended this 'firstboot --enable'
# This one set the setting after that waiting your command for install.
#firstboot --enable
ignoredisk --only-use=sda

# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'

# System language
lang en_US.UTF-8

# Network information
network --bootproto=dhcp --device=enp0s3 --ipv6=auto --activate
network --hostname=<HOSTNAME>.example.com

# Root password

# System services
services --enabled="chronyd"

# System timezone
timezone America/Los_Angeles --isUtc

# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda

# Partition clearing information
clearpart --none --initlabel

# Disk partitioning information
# This partitioning for 8GB Harddisk
part /boot --fstype="xfs" --ondisk=sda --size=476
part pv.198 --fstype="lvmpv" --ondisk=sda --size=7715
volgroup centos --pesize=4096 pv.198
logvol swap --fstype="swap" --size=953 --name=swap --vgname=centos
logvol / --fstype="xfs" --size=6271 --name=root --vgname=centos
logvol /home --fstype="xfs" --size=476 --name=home --vgname=centos



%addon com_redhat_kdump --enable --reserve-mb='auto'


pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty

After that,

you have to upload this file (ks.cfg) to FTP, HTTP or NFS server. I will use PHP Built-in Server.

php -S ks.cfg


Insert CentOS disk to your Bare-Metal/Virtual server, don’t press to Install CentOS 7. Just press tab.


like this, after that, delete whole content and write those content to there

vmlinuz initrd=initrd.img inst.ks=http://<IPADDR>:<PORT>/path/to/ks/file



after that you will see this output, this means successfully will start the installation


When done the installation, just press enter. Don’t forget the remove CentOS installation CD. Reboot it. Than





Nowadays sysadmins use different automation tool but this tool can save your time. Also it is easy to use and has easy to read cfg file.