Kickstart is a network installation system for RHEL, Fedora and CentOS Linux distributions. Another good option is Cobbler which is a Linux provisioning server that centralizes and simplifies control of services including DHCP, TFTP, and DNS for the purpose of performing network-based operating systems installs. In this tutorial, I’m going to show you how to use kickstart file to install CentOS.
Create Kickstart file
An automated installation method to install CentOS / Fedora or RHEL is recommend to automate procedure. Using kickstart, a system administrator can create a single file containing the answers to all the questions that would normally be asked during a typical RHEL Linux installation. Use kickstart GUI tool called “Kickstart Configurator” (run system-config-kickstart command to start the tool) to create a file called ks.cfg as follows:
auth --useshadow --enablemd5 bootloader --location=mbr zerombr clearpart --all --initlabel text firewall --enabled --port=22:tcp firstboot --disable keyboard us network --device eth0 --bootproto static --ip 10.10.21.76 --netmask 255.255.255.240 --gateway 10.10.21.100 --nameserver 10.10.21.1,10.10.21.2 --noipv6 network --device eth1 --bootproto static --ip 123.1.2.6 --netmask 255.255.255.240 --gateway 123.1.2.100 --nameserver 10.10.21.1,10.10.21.2 --hostname centos.nixcraft.in --noipv6 lang en_US logging --level=info url --url=http://mirrors.nixcraft.in/centos/5.5/os/x86_64/ reboot rootpw --iscrypted $1$somepassword selinux --enforcing skipx timezone America/New_York install part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1 part swap --recommended %packages @core --nobase %post ( echo '10.0.0.0/8 via 10.10.21.100' > /etc/sysconfig/network-scripts/route-eth0 sed -i 's/LABEL=\//& console=ttyS0/' /etc/grub.conf echo 'S0:12345:respawn:/sbin/agetty ttyS0 115200' >> /etc/inittab echo "ttyS0" >> /etc/securetty echo 'IPV6INIT=no' >> /etc/sysconfig/network echo 'install ipv6 /bin/true' >> /etc/modprobe.conf ) 1>/root/post_install.log 2>&1
Upload this file to a web server as ks.cfg. You can use nfs server too.
virt-install: Install CentOS using Kickstart
Type the following command:
# virt-install \
-n centos \
-r 2048 \
--vcpus=1 \
--os-variant=rhel5.4 \
--accelerate \
-v \
-w bridge:br0 \
-w bridge:br1 \
--disk path=/emc/kvm/centos.img,size=100 \
-l http://mirrors.nixcraft.in/centos/5.5/os/x86_64/ \
-nographics \
-x "ks=http://10.10.21.3/static/ks.cfg ksdevice=eth0 ip=10.10.21.76 netmask=255.255.255.240 dns=10.10.21.1 gateway=10.10.21.100"
The -x option is used to pass additional kernel command line to the installer when performing a guest install. The ks option sets ks file location and rest are networking options so that installer can fetch ks.cfg and do automated installation for you.
- CentOS / Redhat: Install KVM Virtualization Software
- CentOS / Redhat: KVM Bridged Network Configuration
- KVM virt-manager: Install CentOS As Guest Operating System
- KVM virt-install: Install FreeBSD / CentOS As Guest Operating System
- KVM: Install CentOS / RHEL Using Kickstart File (Automated Installation)
- Troubleshooting KVM Virtualization Problem With Log Files
- KVM Virsh: Redirect FreeBSD Console To A Serial Port
- KVM: Starting / Stopping Guest Operating Systems With virsh Command
- Linux KVM: Disable virbr0 NAT Interface
- FreeBSD / OpeBSD Running in KVM Does Not Accept FTP Traffic
- KVM: Start a Virtual Machine / Guest At Boot Time
- KVM virt-install: Install OpenBSD As Guest Operating System
- Linux KVM: OpenBSD Guest Hangs At Starting tty Flags
- KVM Virtualization: Start VNC Remote Access For Guest Operating Systems
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 6 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Hi there,
Great articles! I’d like to auto install (pxe boot) all my KVM based VMs, using my Satellite/Cobbler server. But the problem seems to be that , to add a server into Cobbler we need “MAC” addresses of both interfaces in advance (so we could assign the DHCP/Static IP accordingly). Is it possible to create dummy VMs or assign pre-defined MAC during VM auto pxe install?
Thanks,
Nitin
I do believe it is possible to generate macs before you create the VM.
Why is the IP info required in both the kickstart as well as the virt-install? This doesn’t make sense to me.
because this IP address with ks.cfg as the same.
this file ks.cfg vm use the static IP Address,the dhcp server not use in the lan
Pardon my english…
what i think, installation with cobbler, in kickstart file, boot proto should be DHCP, and virt-install should have –pxe and remove ks line to get boot with LAN, now it’s work of PXE booted boot loader to provide ks file ex. “ks=http://10.10.21.3/static/ks.cfg”
hypothetical:
# virt-install
-n centos
-r 2048
–vcpus=1
–os-variant=rhel5.4
–accelerate
-v
-w bridge:br0
-w bridge:br1
–disk path=/emc/kvm/centos.img,size=100
-nographics
–pxe
Now VM booted with LAN, pxe provided IP from DHCP, VM gets a splash screen (boot loader .. see below)
# cat /var/lib/tftpboot/pxelinux.cfg/default
blah blah……
append initrd=images/centos/6.2/os/x86_64/images/pxeboot/initrd.img linux ks=http://10.10.21.3/static/ks.cfg
Pl. contribute your views, that will definitely get clear view at least mine or may be on more person
may be network args also need to provide
found this info after some googling..
Stop Default Network
# virsh net-destroy default
# virsh net-edit default
# virsh net-dumpxml default
default
566eadfd-74f3-4e0b-af85-0876d99541a1
# virsh net-start default
Add below switch with virt-install
-w network=default