VirtualBox is a powerful virtualization tool specially designed to allow Operating Systems such as Windows, Linux, MacOS, Solaris and Open Solaris to run on it as virtual Machines.
In this context, we shall look into how to install CentOS 8 Linux distribution on VirtualBox.
VirtualBox is owned by Oracle and it is designed to run virtual machines on your physical machine without needing to reinstall your Operating System. It is an Open Source Software and completely free to use. An Operating System (OS) and applications which runs in a Virtual Machine (VM)is able to run as if it is on a Physical machine by means of VirtualBox.
To install VirtualBox, you need to visit the VirtualBox's official Download Center and select the version based on your Operating System such as Windows. Now you can download VirtualBox to your computer.
After the download process is completed, you can proceed with running the installer in order to install VirtualBox on your Machine.
You need to start by downloading an ISO installation image of CentOS 8 from CentOS official website and follow the steps below;
Now click on "CentOS Linux DVD ISO" button which will take you to the mirror link for your geographical area. You should click the link to the .iso file. Next, save the file by clicking OK on the prompt screen.
The download process for CentOS 8 ISO installation image will begin automatically which could take some time to complete.
To create a VirtualBox virtual Machine, follow the steps below;
1. Begin by opening VirtualBox and then click on "New" to create a new Virtual Machine.
2. Now, enter a name for the Virtual Machine (VM) followed by selecting the "Type" as Linux as well as the "Version" as Red Hat (64-bit). Then click on Next to continue the process.
3. In the next page, you can set the Memory size. Here you can set the amount of Memory in RAM for your new VM. For a headless server, 1 GB (1024MB) is sufficient. Click the Next button to continue to the next phase.
4. In the next page, you can create a virtual hard disk by selecting "Create a virtual hard disk now" followed by clicking on the "Create" button. This will take you to the "Hard disk file type" page where you do not need to modify the default settings.
5. Continue by clicking on the "Next" button which will take you to the "Storage on physical hard disk" page where you do not need to change the default settings. Next click on the Next button to continue.
6. On the "File Location and size" page, you can set the virtual hard disk size. For instance you can set it as 20GB.
Then, click on "Create" to complete the process of creation of the new VM.
7. Now click on "Settings" and go to the "Storage" Section. Here you can click on "Empty" in "Controller:IDE". Then click on the CD icon and click on "Choose Virtual Optical Disk File".
8. Next, select the "CentOS 8 ISO installation image" and click on "Open". Then click on "OK".
9. To start the newly created VM, click on "Start".
This will start the VM and will display the GRUB boot menu.
To install CentOS 8 Linux, follow the steps below;
1. Start by selecting "Install CentOS Linux" from the GRUB menu followed by pressing Enter.
2. Now Select your language and click on Continue.
3. Next, click on "Installation Destination". Here you can select the virtual hard drive and select "Automatic" from the "Storage Configuration" section. Then click on "Done".
4. Now you can click on "Network & Host Name" where you can enter a host name and click on "Apply" followed by the Done button to complete.
5. For graphical user interface on CentOS 8 server, you can start the installation with the settings you have already. otherwise if you need to install a headless CentOS 8 server, you can click on "Software Selection".
6. Now, select "Server" followed by clicking on Done button.
7. You can set up your time zone by clicking on "Time & Date".
8. Now you can select your "Region" and "City" followed by clicking on Done button.
9. Now you can start the Installation of CentOS 8 by clicking on "Begin Installation". This will start the installation process.
10. You can create a new login user by clicking on "User Creation". Then type in your personal information and check "Make this user administrator" followed by clicking on Done button.
11. Now you will see that the installation is processing and once completed do a reboot by clicking on "Reboot".
You might experience a second booting of the VirtualBox VM from CentOS 8 Installation disk again. To prevent this from happening, click on Devices > Optical Drives > Remove disk from virtual drive.
12. Next, click on "Force Unmount".
13. Now, you can click on Machine > Reset. This will reset the VM.
14. Continue by clicking on "Reset" to confirm the prompt.
This will boot the VM from the virtual hard drive.
As soon as CentOS 8 boots, enter the username and password which you have previously configured during the earlier stage of the installation.
Now your CentOS 8 Linux Kernel will be ready.
Sometimes, the network connection on your newly created VM will be inactive. To activate it, you need to configure the network interface to start automatically on boot by using the nmtui command as shown below;
Now you can select "Edit a connection" and click on Enter to continue.
Here you can select the network interface which you can select "<Edit…>" and press "Enter".
Next, check "Automatically connect" and press the <Spacebar> followed by <OK>. Press <Enter>. To exit, press the "Esc" button on your keyboard twice.
To test the network interface to see if it has an IP address, run the command below;
You will get an output with an IP address assigned via DHCP.
You can also try to ping an domain such as google.com to the following command;
ping -c 5 google.com
You will see that the internet connectivity is working.
Now this is how to install CentOS 8 in a VirtualBox virtual machine (VM).