In previous versions of RedHat (going back to RH6… not RHEL, RH!) I would mirror the core OS and update repo’s to my machine. And EPEL and extras and… I started doing this when I only had a 640Kb DSL, so it made sense; build a new machine locally! Now I have a gigabit connection I want to see if I can do a pure network based build with nothing local. Rocky 9 is a great place to start.
And, because I’m a scripter, I want to use virt-install.
The problem I’m having is in trying to work out what to put into the the kickstart file and the virt-install command line.
The best I’ve been able to come up with, so far, is
virt-install .... -l https://dl.rockylinux.org/pub/rocky/9.0/BaseOS/x86_64/kickstart/ -x "inst.ks=http://my.server/ks.cfg ksdevice=en2s0 ip=dhcp console=ttyS0,9600"
And in the kickstart file I have (amongst a lot more)
url --url https://dl.rockylinux.org/pub/rocky/9.0/BaseOS/x86_64/kickstart
repo --name=AppStream --mirrorlist https://mirrors.rockylinux.org/mirrorlist?repo=rocky-AppStream-9.0&arch=x86_64
Now this seems to start; the build process finds the stage2 loader and seems to start… but then just prints a load of “.”. I even left it overnight and the console was full of
With previous versions I’ve downloaded and copied the DVD to a local web server and pointed
virt-install and kickstart to that; it works but requires maintenance (patches, etc) which I’d like to avoid now I have fast internet. I documented that process at GitHub - sweharris/centos8-local: How I build CentOS 8 VMs locally
But I can’t seem to work out the right sequence of options for the URLs for a pure internet-based install!
What am I missing?
So I think I’ve solved this. I think part of my problem was pointing specifically to 9.0 (and not “9”) and using the wrong repo mirror entry.
So this is how the install is kicked off
virt-install --noreboot -n test9 -r 3073 '--vcpus=1' '--os-variant=rhel7.0' --accelerate -v '--network=bridge=br-lan,target=v-test9' --disk path=/dev/Raid68/vm.test9 -l https://dl.rockylinux.org/pub/rocky/9/BaseOS/x86_64/kickstart/ --nographics -x 'inst.ks=http://10.0.0.137/CentOS/kickstart/rocky9.cfg ksdevice=ens2 ip=dhcp console=ttyS0,9600'
The LV it points to is 10Gb in size (which is smaller than the docs says is needed, but it seems to work). The bridge is for my LAN.
After that completes, I then do a couple of virsh commands to reduce memory (down to 512Mb; Rocky 9 runs in that easily, it just won’t install in it), then restart.
$ free -h
total used free shared buff/cache available
Mem: 453Mi 72Mi 262Mi 2.0Mi 132Mi 380Mi
Swap: 1.0Gi 0B 1.0Gi
$ sudo fdisk -l
Disk /dev/vda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2b9be1ea
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 2099199 2097152 1G 83 Linux
/dev/vda2 2099200 4196351 2097152 1G 82 Linux swap / Solaris
/dev/vda3 4196352 20971519 16775168 8G 83 Linux
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/vda3 7.8G 957M 6.5G 13% /
And the complete kickstart file. It doesn’t look like I can do a mirrorlist in the
url line, so have to hard-code a server.
url --url https://dl.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os
# url --mirrorlist https://mirrors.rockylinux.org/mirrorlist?repo=BaseOS-9&arch=x86_64
repo --name=AppStream --mirrorlist https://mirrors.rockylinux.org/mirrorlist?repo=AppStream-9&arch=x86_64
network --onboot yes --device eth0 --bootproto dhcp --ipv6 auto
rootpw --iscrypted Wouldntyouwanttoknow
timezone --utc America/New_York
clearpart --all --initlabel
part /boot --fstype=ext4 --asprimary --size=1024
part swap --asprimary --size=1024
part / --fstype=ext4 --asprimary --grow --size=1
%addon com_redhat_kdump --disable --reserve-mb='auto'