Installing RHEL7 or CentOS7 on a PC is fairly easy to do. In this tutorial, we will review the installation process step-by-step. Today’s focus will
In today’s tutorial, we will install CentOS8 on KVM. The install process is fairly straightforward and we will cover it here step-by-step. We will follow a similar format to the “Install RHEL7 or CentOS7 on a PC” article. The difference is, our CentOS8 instance will run in our KVM virtual environment.
It is important to note that we will install CentOS8 on a qcow2 formatted disk. This will allow us certain advantages that are not available with raw formatted disk images. For example, we can create snapshots using a qcow2 image. Or, apply AES encryption to our image for data security. Both of these features are not possible with a raw disk image.
Image by Miguel A. Padrinan from Pexels
First things first, we’re using the wget utility to download the latest copy of the CentOS8 iso. If the following command (below) does not work for you, simply install wget using yum (RHEL7/CentOS7), dnf (RHEL8/CentOS8/Fedora35), or apt-get (Ubuntu), depending on your Linux distribution:
In addition, we have created an isos directory under /var/tmp to store our CentOS8 iso. Also, the latest CentOS8 iso is 11GB in size. Therefore, your chosen location for download, needs to accommodate this file.
admin@kvm-host1:/var/tmp/isos $ sudo wget http://mirror.umd.edu/centos/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-20220223-dvd1.iso
Secondly, we’re using the qemu-img utility to create the qcow2 disk image that will serve as storage for our CentOS8 virtual machine (below). Also, we will allocate 75GB to our new disk image named dev-infotechys-5.img. It will reside under the /var/lib/libvirt/images directory (default image store for KVM).
admin@kvm-host1:/var/lib/libvirt/images $ sudo qemu-img create -f qcow2 dev-infotechys-5.img 75G
Formatting 'dev-infotechys-5.img', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=80530636800 lazy_refcounts=off refcount_bits=16
Now that we’ve downloaded the CentOS8 iso and created a qcow2 disk image, we can now proceed with the installation.
First, launch the virt-manager on your KVM host as the root user.
root@kvm-host1:~ # virt-manager
Next, click the computer monitor icon (circled in red below) to continue.
Photo by admingeek from Infotechys
Next, you will be prompted to choose how you would like to install the operating system. Since we downloaded the ISO locally, we’ll go with the first option highlighted: Local install media (ISO image or CDROM). Then, click the [Forward] button to continue.
Then, you will be prompted to choose the ISO you would like to use for the install. Click the [Browse] button and select the path to your ISO file. Or, enter it in the text box. For this tutorial, the CentOS8 ISO is located under /var/tmp/isos. Click the [Forward] button to continue.
Photo by admingeek from Infotechys
In step 3 of 5, you will be prompted to choose the memory and CPU settings for your CentOS8 instance. For this demonstration, we entered 4096 MB or 4GB for the RAM and 2 CPUs or cores. Click the [Forward] button to continue.
Photo by admingeek from Infotechys
In step 4 of 5, you will be prompted to decide how you want to set up a disk image for your CentOS8 virtual machine. You’ll notice that the “Create a disk image” option is selected by default. We are not going to select this option because we created a qcow2 disk image (dev-infotechys-5.img) earlier–that we’d like to use.
Instead, choose the “Select or create custom option” below it and click the [Manage] button to continue. You will be presented with another window listing the contents of /var/lib/libvirt/images. Select your qcow2 image and click the [Choose Volume] button to continue.
Photo by admingeek from Infotechys
In step 5 of 5, we are about ready to begin the installation. There are just a few remaining housekeeping details we need to attend to.
First, enter a name for your CentOS8 instance. We decided to go with vm5-dev-infotechys.com…naturally. Choose a name that suits you. Next, click the checkbox to select the “Customize configuration before Install” option. It will allow us to ensure everything checks out before we proceed with install.
Finally, select the “Bridge device” option from the dropdown menu and enter in your bridge interface. For our KVM host, the bridge interface is br03. Your interface will likely be different. Click the [Finish] button to continue.
Photo by admingeek from Infotechys
As you can see (above), everything looks good. We’ve even added a brief note in the description textbox, stating the type of VM we are building. We are now ready to proceed with the CentOS8 Installer portion. Click the [Begin Installation – Green Check mark] button to continue.
At the initial CentOS8 installer screen, you will be presented with the option to either Install CentOS Linux 8 or Test this Media & Install CentOS Linux 8. Press the [UP] arrow to highlight the first option (Install CentOS Linux 8) and the [Enter] key to continue.
Photo by admingeek from Infotechys
Next, you will arrive at the Welcome to CentOS Linux 8 screen. Select the language and region that suits you or click the [Continue] button to proceed with the default options.
Photo by admingeek from Infotechys
At the CentOS installation summary window, you will be presented with a few options. First, let’s address the options highlighted in red text.
Photo by admingeek from Infotechys
Click the Installation Destination option under the SYSTEM category to continue. Next, click the disk icon (under Local Standard Disks) to select it with a check mark. Then, click the Custom radio button (under Storage Configuration) and the blue [Done] button to continue.
Photo by admingeek from Infotechys
The manual disk partitioning procedure will include the following changes:
Changing the volume group name is a fairly easy procedure but, first, we need to ensure that all existing partitions are wiped from the disk as (seen in the image below).
Photo by admingeek from Infotechys
Click the plus (“+”) sign to proceed with creating a partition. We will change the volume group name as part of this process.
Photo by admingeek from Infotechys
Click the down arrow next to the text box labeled “Mount point:” and select the “/” for the root partition (as shown above). Then, enter the size you want allocated to root in the “Desired Capacity:” text box.
Photo by admingeek from Infotechys
Referring to the “Partition Specifications” section, we’ll assign 15GiB to root and click the [Add mount point] button to continue.
Photo by admingeek from Infotechys
To Change the volume group name (above), click the down arrow next to the Volume Group and click the “Create a new volume group” option. Then, enter the new name (vg00) in the text box labeled Name: and click the “Save” button to continue.
Photo by admingeek from Infotechys
Next, repeat the same steps for creating the remaining partitions: Allocate 2GB to /boot, 4GB to swap, and the remaining storage to /extras. When provisioning the /extras partition, enter /extras into the text box labeled “Mount point:” as it is not listed in the drop down menu.
Photo by admingeek from Infotechys
Click the “Done” button and the “Accept Changes” button to continue.
This part of the installation is going to be the easiest as we are not going to make any changes. We will leave the default “Server with GUI” option selected.
Photo by admingeek from Infotechys
Now that we’ve completed the disk partitioning, we can proceed with configuring the hostname and network settings. For the purposes of this demonstration, we’ll keep things simple and go with DHCP for the network setting. Also, in the hostname text box at the bottom of the page, enter the hostname you’d like to use and click the “Apply” button to confirm the change.
Next, click the switch at the top right-hand corner of the screen (circled in red) to “ON”. This will activate DHCP. As a result, the IP address, subnet mask, default route, and DNS address for your machine will populate automatically.
Click the “Done” button to continue.
Photo by admingeek from Infotechys
This part of the installation process is self-explanatory. Set a root password for your CentOS8 instance and create an administrative user account (for sudo access to root).
Photo by admingeek from Infotechys
Both options are located under the USER SETTINGS category. The CentOS8 on KVM Installation is 95% complete at this point.
Photo by admingeek from Infotechys
Upon completion of the USER SETTINGS portion, the [Begin Installation] button should highlighted in blue. This indicates we are cleared to begin the CentOS8 package installation and system configuration process.
Photo by admingeek from Infotechys
From this point onward, the CentOS package installer will begin to install all the necessary packages required for a CentOS8 Server with GUI Instance. This is a good place to take a break and walk away from your terminal as this process can take several minutes to complete.
Once the installation is complete, your will be prompted to reboot your machine. Click the [Reboot System] button to continue.
Photo by admingeek from Infotechys
Upon reboot, your will be prompted once more to accept the End User License Agreement or EULA. Click the icon next to the License Information to continue. Then, click the checkbox to agree with the terms and the blue [Done] button to continue.
Photo by admingeek from Infotechys
Then, click the checkbox to agree with the terms and the blue [Done] button to continue.
Photo by admingeek from Infotechys
Photo by admingeek from Infotechys
Finally, click the [FINISH CONFIGURATION] button to continue. Your machine should boot to a login screen and thus, bring us to the end of this tutorial.
Photo by admingeek from Infotechys
Congratulations! You’ve just completed a successful install of a CentOS8 virtual machine on KVM. As part of this process we reviewed some system configuration and administration topics like network and hostname configuration, logical volume manager (LVM), and custom disk partitioning. Was this article helpful to you? If so, leave us some feedback in the comments section. We’d love to hear from you.
Related Posts
Installing RHEL7 or CentOS7 on a PC is fairly easy to do. In this tutorial, we will review the installation process step-by-step. Today’s focus will
In this article, we will review installing and using Git on Linux machines. Besides minor differences in syntax, the install commands and procedures are similar
In this tutorial, we will install gedit on CentOS7. We are going to use yum for the installation so it’s a straightforward process. The same