skip to Main Content

I recently managed to install
Centos7 with kickstart.cfg file by using virt-install at my Archlinux.

However, if I simply want to use similar approach with Centos 8 – it does not work at all.
I suspect that it is because of the fact that Centos8 does not have any minimal version and you need to download like 7GB iso fiel with graphical installer.

sudo virt-install --name k8s-1 
    --description "this is my Centos 8 " 
    --ram 2048 
    --vcpus 2 
    --disk path=/vm-disks/k8s-1.qcow2,size=15 
    --os-type linux 
    --os-variant "centos8" 
    --network bridge=virbr0 
    --graphics vnc,listen=127.0.0.1,port=5901 
    --location /cdimages/CentOS-8.1.1911-x86_64-dvd1.iso 
    --noautoconsole 
    --initrd-inject ks-1.cfg --extra-args="ks=file:/ks-1.cfg"
Setting input-charset to 'UTF-8' from locale.

Starting install...
Setting input-charset to 'UTF-8' from locale.
Retrieving file vmlinuz...                                                                                                                                                  | 7.7 MB  00:00:00     
Setting input-charset to 'UTF-8' from locale.
Retrieving file initrd.img...                                                                                                                                               |  59 MB  00:00:00     
Domain installation still in progress. You can reconnect to 
the console to complete the installation process.

Here is ks-1.cfg

# Install OS instead of upgrade
install
# Use network installation
cdrom
# Root password
rootpw Start123
# System authorization information
auth  --useshadow  --passalgo=sha512

# Firewall configuration
firewall --disabled
# SELinux configuration
selinux --permissive

# Installation logging level
logging --level=info
# Use text mode install
text
# Do not configure the X Window System
skipx
# System timezone, language and keyboard
timezone --utc Europe/Bratislava
lang en_US.UTF-8
# keyboard dk-latin1
# Network information
# network  --bootproto=static --ip=192.168.122.110 --device=eth0 --onboot=on
# If you want to configure a static IP:
network --device eth0 --hostname k8s-1 --bootproto=static --ip=192.168.122.111 --netmask=255.255.255.0 --gateway=192.168.122.1 --nameserver 192.168.122.1


# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=512
#part swap --fstype="swap" --recommended
part /var --fstype="ext4" --size=5120 --grow
part / --fstype="ext4" --size=1024 --grow
part /usr --fstype="ext4" --size=3072
part /home --fstype="ext4" --size=512
part /tmp --fstype="ext4" --size=1024

# Reboot after installation
reboot

%packages  --nobase
@core
# @base

%end

%post --log=/root/ks-post.log
#---- Install packages used by kubernetes
#yum install -y socat libseccomp-devel btrfs-progs-devel util-linux nfs-utils conntrack-tools.x86_64

#---- Set bridge-nf-call
echo "net.bridge.bridge-nf-call-ip6tables=1
net.bridge.bridge-nf-call-iptables=1" > /etc/sysctl.conf

#---- Add user RKE -----
groupadd docker
adduser rke
echo "rke:praqma" | chpasswd
usermod -aG docker rke


#---- Install our SSH key ----
mkdir -m0700 /home/rke/.ssh/
cat <<EOF >/home/rke/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9F5hTts3U+E10PHRxViM3PX+DZPgBIcL7Uj/Py+udJWehhobnJmj2EoaUYbykm7VdpjImLpjas2Vhb/gNZ+wVWGho1mzWoCPl2fZ7oLXrGdDHXhlyocvfX3XPB6Y1kbFlfh7+4bUaA7w2Dg4x8LO/iXlF34z6IOa2xgx1R70Xc/97lkRMhsKszRBzwGVin6qUqdVmdXg3d0dRUnq039+q8NWUcKAz2w6F/HO7u3N7NhsSLnlpQ9+AztLvHEPeRP6UNex9a8sSHo5Jzc/mjVKGfInfWjp3nru88mwM4UQRbhhW5IeLXgALCa++H4qZw1ivZtVadXBHjK4JMKC1UWD1 rancher@k8s
EOF


### Disabling swap (now and permently)
swapoff -a
sed -i '/^/swapfile/ d' /etc/fstab


### set permissions
chmod 0600 /home/rke/.ssh/authorized_keys
chown -R rke:rke /home/rke/.ssh

### fix up selinux context
restorecon -R /home/rke/.ssh/authorized_keys


### Install Docker
#yum install docker -y

#systemctl enable docker

%end

If you take a look to virtual-manager GUI you willalways see dracut shell error
enter image description here

2

Answers


  1. I had exactly the same issue. My solution:
    for some reason parameter --initrd-inject for virt-install breaks the process.
    So I removed it and load kickstart file via network with --extra-args "ks=http://192.168.xxx.xxx:8000/centos8_ks.cfg"
    Hint: to run simple web server for this installation you can execute python3 -m http.server 8000 in folder with your kickstart file.

    Of course you need to update your kickstart for CentOS-8 according to this – a lot has been changed.

    Login or Signup to reply.
  2. Another option is to create a small floppy image with label OEMDRV and with file ks.cfg on it and attach it as a CDROM: How to automate CentOS7 minimal kickstart installation using OEMDRV volume?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search