Install RHEL 7 Guest on Centos 8 Server via Text Mode & Kickstart

This session we are going to go over and deploy is using an ISO and kickstart install. This is different than a PXE install and does not require a PXE nor TFTP setup. In this example everything we are accessing is over NFS mounts but could very well have been local.

Install using kickstart file over NFS

# virt-install --name rh7 --memory 10240 --vcpus=1 --disk path=/virtual/disks/centos8-2.qcow2,size=20 --os-variant rhel7.0 --network default --location /kickstart/data/ks/rh7 --initrd-inject /kickstart/data/ks/rh7/rh7-nfs-ks.cfg --extra-args="ks=file:/rh7-nfs-ks.cfg console=tty0 console=ttyS0,115200n8" --nographics
Starting install…
Retrieving file vmlinuz… | 6.3 MB 00:00:00
Retrieving file initrd.img… | 52 MB 00:00:00
Connected to domain rh7
Escape character is ^]
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.10.0-957.el7.x86_64 (mockbuild@x86-040.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Oct 4 20:48:51 UTC 2018
[ 0.000000] Command line: ks=file:/rh7-nfs-ks.cfg console=tty0 console=ttyS0,115200n8
[ 0.000000] e820: BIOS-provided physical RAM map:

[ OK ] Started Rebuild Hardware Database.
Starting installer, one moment…
anaconda 21.48.22.147-1 for Red Hat Enterprise Linux 7.6 started.
  • installation log files are stored in /tmp during the installation
  • shell is available on TTY2
  • when reporting a bug add logs from /tmp as separate text/plain attachments
    12:40:59 Not asking for VNC because of an automated install
    12:40:59 Not asking for VNC because text mode was explicitly asked for in kickstart

Starting automated install……………………
Checking software selection
Generating updated storage configuration
Checking storage configuration…

====================================================================================================================================================

Installation

1) [x] Language settings    2) [x] Time settings      (English (United States        (America/New_York timezone)
3) [x] Installation source 4) [x] Software selection
(NFS server 10.0.1.166) (Custom software selected)
5) [x] Installation Destination 6) [x] Kdump
(Automatic partitioning (Kdump enabled)selected) 8) [ ] User creation
7) [x] Network configuration (No user will be created)
(Wired (eth0) connected)

====================================================================================================================================================

Progress
Setting up the installation environment
.
Creating disklabel on /dev/vda
.
Creating xfs on /dev/vda1
.
Creating lvmpv on /dev/vda2
.
Creating swap on /dev/mapper/rhel_rhminisrv-swap
.
Creating xfs on /dev/mapper/rhel_rhminisrv-root
.
Running pre-installation scripts
.
Starting package installation process
Preparing transaction from installation source
Installing libgcc (1/1789)
Installing kernel-headers (2/1789)
Installing grub2-common (3/1789)
Installing fontpackages-filesystem (4/1789)
Installing redhat-release-server (5/1789)
Installing qt5-qttools-common (6/1789)
Installing setup (7/1789)
Installing filesystem (8/1789)
Installing telepathy-filesystem (9/1789)
...
Performing post-installation setup tasks
.
Configuring installed system
.
Writing network configuration
.
Creating users
.
Configuring addons
.
Generating initramfs

After the installation successfully completes you will get a login prompt since you are in a console session:

Red Hat Enterprise Linux Server 7.6 (Maipo)
Kernel 3.10.0-957.el7.x86_64 on an x86_64
rhminisrv login:

Checking the status of your VM

# virsh list

Id             Name             State
-------------------------------------------------------
16            rh7                 running

Connecting via console

# virsh console rh7

Connected to domain rh7
Escape character is ^]

Red Hat Enterprise Linux Server 7.6 (Maipo)
Kernel 3.10.0-957.el7.x86_64 on an x86_64

rhminisrv login:

Stopping and Starting a VM

Shutdown VM gracefully
# virsh shutdown 

Starts VM
# virsh start

That’s it, easy peasey!