Creating a Network Install Server on RHEL 8

Reading Time: 3 minutes

If you’re using KVM with virt-manager to manage your virtual machines, there are basically two ways to install the Guest OS:

  • Using a Local Media (ISO image or CD/DVD).
  • Using a Network Install Server (via HTTP, HTTPS, or FTP).

This article shows how to configure an HTTP server, providing it as a Network Install Server to install Red Hat Enterprise Linux on the virtual machines (GuestOS).

We’ve written an article explaining all the necessary steps to install KVM on RHEL 8https://dpcvirtualtips.com/running-vms-on-rhel-8/.

Step-by-step to create the HTTP Server

1- Install Apache (httpd) and enable/start the httpd daemon:

dnf install -y httpd
systemctl enable --now httpd
systemctl status httpd

2- Add a firewall rule to allow external access to the httpd daemon:

firewall-cmd --permanent --add-service=http
firewall-cmd --reload
firewall-cmd --list-services

3- Create a local directory in /var/www/html to store all RHEL 8 installation files.
We need to mount the installation ISO and copy all content to the created directory. Let’s do that:

# Create the directory "rhel8-install":
cd /var/www/html/
mkdir rhel8-install

# Create a temp dir to mount the DVD ISO:
mkdir /mnt/ISO
mount -o loop /ISOs/rhel-8.10-x86_64-dvd.iso /mnt/ISO/

# Copy the entire content to the destination dir:
cp -r /mnt/ISO/.* /var/www/html/rhel8-install/

# Unmount the ISO:
umount /mnt/ISO

# Remove the httpd welcome file and restart the httpd daemon:
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.old
systemctl restart httpd

4- The next step is to create a virtual host file for our Red Hat installation directory.
Create the configuration file “/etc/httpd/conf.d/rhel8-install.conf” and add the following content:

<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    ServerName rhel8-install.lab.local
    DocumentRoot /var/www/html/rhel8-install

    <Directory /var/www/html/rhel8-install>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>

    ErrorLog /var/log/httpd/rhel8-install-error.log
    CustomLog /var/log/httpd/rhel8-install-access.log combined
</VirtualHost>

Afterward, restart the httpd daemon:

systemctl restart httpd

5- Add a firewall rule allowing HTTP access through the NAT interface (192.168.122.1) used by the KVM:

firewall-cmd --zone=libvirt --add-service=http --permanent
firewall-cmd --reload

6- In the KVM hypervisor, open Firefox and access the http page using the IP 192.168.122.1:

7- Execute the virt-manager and create a new virtual machine:

That’s it for now 🙂