Table of Contents
Install Rocky Linux 8 on Oracle Virtual Box
With CentOS 8 support ending on December 31, 2021, A new Operating System has been born thanks to the open-source community. Rocky Linux is a community Linux operating system that is compatible with RedHat Enterprise Linux 8 (RHEL 8). This means that CentOS users will not be worried anymore as they are covered with this 100% bug-for-bug Operating System.
Rocky Linux is already available for download and can already be used as an alternative to run your production workloads. At the moment of writing this article, the latest version of Rocky Linux is version 8.4.
This guide covers how to install Rocky Linux 8.4 on VirtualBox. We assume that you already have the VirtualBox application installed in your lab environment. You can also install Rocky Linux 8 on different virtualization platforms such as VMWare, XEN. This operating system can also be installed on a physical host.
The steps below will guide us on how to install Rocky Linux 8 on VirtualBox.
This article assumes that you already downloaded and installed Oracle Virtual Box on your workstation and you have basic working knowledge of Oracle Virtual Box.
Step 1: Download Rocky Linux ISO
Download the latest version of Rocky Linux ISO image available on the Rocky Linux 8 release page.
Choose an ISO image to download depending on the CPU architecture of your environment. Select the Minimal version if you wish to install Rocky Linux 8 server version and DVD if you want to install the Desktop version of Rocky Linux 8.
You can also download these images using WGET feature on Linux terminal as shown below:
# CLI download with wget # DVD curl -O https://download.rockylinux.org/pub/rocky/8.4/isos/x86_64/Rocky-8.4-x86_64-dvd1.iso # Minimal ISO curl -O https://download.rockylinux.org/pub/rocky/8.4/isos/x86_64/Rocky-8.4-x86_64-minimal.iso # Network install ISO curl -O https://download.rockylinux.org/pub/rocky/8.4/isos/x86_64/Rocky-8.4-x86_64-boot.iso
Once the installation is complete, proceed to the next step which involves creating the resources on VirtualBox.
Step 2: Create a New Virtual Machine on Virtual Box
Open your VirtualBox application and proceed to create a new Virtual Machine. In the Tools menu, click "New" or press CTRL+N to initiate the creation of a new VM.
2.1: Configure Name and Operating System
On the interface that pops up:
- Allocate the VM a name
- Choose the Machine Folder where the VM's disk will reside
- Select Linux as the type of VM
- Choose Red Hat (64 bit) for the version.
2.2: Allocate Memory to Rocky Linux VM on VirtualBox
Allocate Memory to the VM depending on the available resources on your host machine. A minimum of 1024MB for Rocky Linux server and 2048MB for Rocky Linux Desktop is advised. This is for the optimal working of the VMs. This however depends on the available resources on your host computer.
2.3: Create a Virtual Hard disk for Rocky Linux on VirtualBox
Create a virtual hard disk for the Rocky Linux VM. Again, you are required to allocate the size of the disk depending on the available disk space on your host machine. The minimum disk recommended for the Rocky Linux VM is 8GB.
Select the "Create a virtual hard disk now" option then click "Create".
On the next menu, choose "VHD(Virtual Hard Disk)" then click "Next"
Choose the "Dynamically allocated" option to use Thin Provisioning.
Choose the disk size as discussed earlier. In my case, I'll use 20GB. Then click "Create".
Step 3: Configure Network for Rocky Linux on VirtualBox
We need to configure networking on the created VM to allow it to communicate with other VMs on VirtualBox or allow reachability from the outside network. Go to the Settings menu of the VM then choose Network to configure the network.
VirtualBox provides several network adapters but the most commonly used adapters are briefly discussed below:
- NAT - Host machine translates network traffic to the VM using Network Address Translation(NAT).
- Bridged adapter - Bridges the network connections from the host adapters whereby the VM can communicate directly with other devices on the network. For the case of DHCP enabled network, the VM will be able to obtain an IP directly from the DHCP server. You however need to map the network interface with a host adapter that is currently active. For example, if you are using WIFI on your host machine, ensure that the virtual network adapter is attached to the WIFI adapter of the host machine.
- Internal network - This can be used to create a different kind of software-based network which is visible to selected virtual machines, but not to applications running on the host or to the outside world.
- NAT Network. A NAT network is a type of internal network that allows outbound connections. This means that you can also reach a VM with a NAT Network adapter from the host machine.
3.1: Using Bridged Adapter on VirtualBox
To use a bridged adapter:
- Choose "Bridged Adapter" option for "Attached to" entry.
- Select the host network adapter that you wish to bridge
- Turn through the advanced options to do any more changes to the adapter. The is optional.
- Ensure that you have checked the "Enable Network Adapter" box.
Step 4: Attach Rocky Linux 8 ISO Image to VirtualBox VM
- The next step is to attach the ISO image we downloaded at Step 1 to the VirtualBox VM we have created.
- Head over to the VM's settings, click on Storage then click on the "Controller: IDE".
- To insert an ISO image, click on the "Empty" entry as shown in the image below then click on the icon on the right at the Optical Drive option.
- Select the "Choose a disk file..." option to locate your ISO image.
- Navigate to the folder where the image was downloaded then choose the image.
Step 5: Allocate vCPU to VirtualBox VM
On the VM settings, navigate to System then Processor. Here, You can configure the CPU architecture for the Rocky Linux VM. You can also configure the number of vCPUs the VM will have.
If you want to use virtualization inside virtualization, enable the Nested VT-x/AMD-V option as shown below;
Step 6: Install Rocky Linux on VirtualBox
After the VM configuration, we can proceed to install Rocky Linux 8 on VirtualBox. Click on the Start icon to boot the VM.
6.1: Select boot device
You will be taken to the Boot device selection menu. At this point, choose the ISO image that we had mounted earlier then start.
You will be greeted with the Rocky Linux installer menu where you will be required to choose to Install Rocky Linux. Choose the option highlighted below to initiate the installation process for Rocky Linux 8.
6.2: Select Language
Once the installer loads the files, you will be presented with a Graphical interface where you will be required to choose your Language as shown below:
6.3: Select Date and Time
Select your preferred language then proceed to the next page. Configure TimeZone at the Time & Date option.
6.4: Configure Partition
Configure disk partitioning at the "Installation Destination" tab.
Choose automatic partitioning for the disk to automatically partition the root disk.
6.5: Configure network and hostname
Configure the hostname and the Network under Network & Hostname settings.
In the network settings, configure the hostname and click Apply.
Switch on the network adapter to connect to a network. If you used a bridged network, the VM should pick network configurations from your DHCP server.
6.6: Create password for root user
Should you want to configure static network settings, use the "configure" button to access the manual network interface configuration. Add a root password for Rocky Linux root user.
6.7: Begin Rocky Linux 8 Installation
Use a strong password for the root user then click "Done" to proceed with the installation. Click on Begin Installation to initiate the installation process.
The installation process should take some time before it completes. This also depends on the type of installation (minimal, DVD, network) that you are doing.
6.8: Reboot the VM post installation
The fastest installation is for a minimal installation as this installs only the bare-minimum requirements for a Rocky Linux server. You will be required to download and install other software packages after a complete installation of the operating system.
You will be prompted to reboot your system once installation is complete:
6.9: Boot into Rocky Linux Kernel
When you reboot, the mounted ISO image unmounts itself automatically and the VM boots from the Operating System installed on the virtual hard disk.
Rocky Linux boots to a shell where you can now login.
6.10: Login to Rocky Linux after installation
Use the root password that you configured during the installation.
There you go. You can proceed to install updates and other applications that you wish to deploy.
# dnf update -y
In this guide, we have demonstrated how to deploy Rocky Linux 8.4 on VirtualBox. You can go on and try the latest version of Rocky Linux which is 8.4. As discussed, it is clear that Rocky Linux is the replacement of the much-loved CentOS whose support will end on December 31, 2021. Consider moving your applications which are currently running on CentOS to Rocky Linux. In our next guide, we shall cover how to migrate from CentOS to Rocky Linux 8.