CentOS 7 – How to Install with Kickstart File in Offline Mode

centos7kickstart

I am trying to install CentOS 7 on my VM using Kickstart Configuration file ks.cfg.

All I need is to install CentOS 7 on my VM without using network (offline).

I have created a ks.cfg file with help of online links (see below) but its not working for me.

Following is my ks.cfg script which I am using for the CentOS 7 offline installation:

auth --enableshadow --passalgo=sha512     
cdrom  
graphical  
firstboot --enable
ignoredisk --only-use=vda  
keyboard --vckeymap=us --xlayouts='us'  
lang en_US.UTF-8  
network  --bootproto=static --device=eth0 --gateway=172.30.#.# --ip=172.30.#.# --nameserver=8.8.8.8 --netmask=255.255.255.0 --ipv6=auto --activate  
network  --hostname=localhost.localdomain
rootpw --iscrypted  "encrypted password"
services --enabled="chronyd"  
timezone America/New_York --isUtc  
user --groups=wheel --name=my_name --password="encrypted_password" --iscrypted --gecos="password"    
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=vda
autopart --type=lvm  
clearpart --none --initlabel  

%packages  
@^minimal  
@core  
chrony  
kexec-tools  
%end  

Problem I am facing is when my machine is in boot menu it is not installing CentOS 7 automatically and I have to write linux ks=cdrom:/ks.cfg in the grub menu. after entering this its shows

insert a CDROM containing ks.cfg

and then installation is starting but gets stuck in the Centos Installation loading window.
Nothing is happening after this step.

I am using a Kickstart script for automated installation of Centos7, so there shouldn't be any manual configuration to be done for this automated installation; e.g to write anything in boot menu to start the installation.

I need help to modify my script for the installation of CentOS without network.

Links I have used to initiate my ks.cfg file:

Best Answer

I know that this question is two months old, but I stumbled upon it while researching kickstart and might be able to help.

When you give the argument linux ks=cdrom:/ks.cfg you are telling grub to load linux with a kickstart file located on the root of the cdrom named ks.cfg. If you're using the standard install .iso and you haven't remastered the .iso to include the file, it will fail.

One possible solution would be to copy your ks.cfg to a removable usb thumb drive, and boot your VM with the thumb drive attached to the VM, not the host. Once you get to your grub screen issue linux ks=hd:sdb1:/ks.cfg. This will tell your VM to boot from the Centos .iso BUT load your kickstart file from the root of your USB drive (/dev/sdb in this case).

Answer was adapted from https://linuxhint.com/install-centos-7-kickstart/ by Shahriar Shovan

Related Topic