Installing Rocky Linux

Introduction

Rocky is a distribution Linux , which replaced CentOS after the decision of RedHat to change the distribution model of CentOS 8 and above , and this distribution is developed by a community from large IT companies such as Amazon.

Rocky on Ubuntu

You can install virtualbox in Ubuntu with the command

sudo apt install virtualbox

You can start VirtualBox with the command

virtualbox

Host-only Adapter

To be able to create a Host-only Adapter you need to create a virtual network through which such adapters will communicate.

In the main VirtualBox window click File → Host Network Manager → Create

Creating a host-only adapter in VirtualBox, image from website www.aredel.com

Click Properties

Creating a host-only adapter in VirtualBox, image from website www.aredel.com

Check the values on the Adapter tab

Creating a host-only adapter in VirtualBox, image from website www.aredel.com

Check the values on the DHCP Server tab

Creating a host-only adapter in VirtualBox, image from website www.aredel.com

Go to the settings of the required virtual OS → Select Network → Select the required adapter → Connect it to the network you have just created

Creating a host-only adapter in VirtualBox, image from website www.aredel.com

You have the Auto capture keyboard option turned on. This will cause the Virtual Machine to automatically capture the

This means that when you move the cursor over the window of a running virtual machine it will be captured and will work as the mouse cursor in that OS.

To return the cursor back, it is usually enough to press the right CTRL. In the lower right corner of the virtual machine window a hint is usually visible.

Installation from a downloaded image

You can download the image from the website www.rocky.org

Rocky 8 image download site, image from website www.aredel.com
Mirror for downloading Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing Rocky Linux, image from website www.aredel.com
Installing Rocky

Installing an image from the network

New

Installing an image over the VirtualBox network, image from website www.aredel.com

Come up with a name and choose Red Hat (64-bit) from the list if this has not happened automatically

Installing an image over the VirtualBox network, image from website www.aredel.com

Leave the Memory size at the default. In this example - 1024 MB

Create a virtual hard disk now → Create

Hard disk file type → VDI (VirtualBox Disk Image) → Next

Storage on physical hard disk → Dynamically allocated → Next

File location and size → 8.00 GB → Create

When you reach the screen below, click Settings → Network

Installing an image over the VirtualBox network, image from website www.aredel.com

Attached to: NAT Network.

At least one NAT Network must be created in VirtualBox beforehand

Installing an image over the VirtualBox network, image from website www.aredel.com

Adapter 2 → Enable Network Adapter → Attached to: Host-only Adapter

At least one Host-only network must be created in VirtualBox beforehand (File - )

Installing an image over the VirtualBox network, image from website www.aredel.com

Click Start

If you have already installed from some images, a list to choose from may appear

Installing an image over the VirtualBox network, image from website www.aredel.com

Choose the Minimal image

Installing an image over the VirtualBox network, image from website www.aredel.com

Install CentOS 7 → Enter

English → English (United States)

Date Time → Helsinki → Done

Network & Host Name

Change Host name and enable both adapters

Installing an image over the VirtualBox network, image from website www.aredel.com

Done

Installing an image over the VirtualBox network, image from website www.aredel.com

Installation Destination - just open it and click Done

Installation Source

Installing an image over the VirtualBox network, image from website www.aredel.com

→ On the network:

http://mirror.gnu.fi/centos/7.9.2009/os/x86_64/

Pay attention to the url. Last time you had to download from the same one but instead of os there was isos for a network installation you need exactly os

Done

Installing an image over the VirtualBox network, image from website www.aredel.com

Software Selection

Installing an image over the VirtualBox network, image from website www.aredel.com

Minimal Install → Done

Installing an image over the VirtualBox network, image from website www.aredel.com

Begin Installation

Installing an image over the VirtualBox network, image from website www.aredel.com

Reboot

Installing an image over the VirtualBox network, image from website www.aredel.com

Configuration after installation

After rebooting, run

sudo yum -y update
yum install -y redhat-lsb-core net-tools epel-release kernel-headers kernel-devel
yum groupinstall -y "Development Tools"

Connecting to the virtual machine

Run

ip a s

Or

nmcli conn show

To examine the network connections.

If some interface, for example enp0s3, is down, you can bring it up with the command

nmcli conn up enp0s3

To avoid enabling the network interface manually every time, you can set ONBOOT yes in the settings

Alternatively you can go to /etc/sysconfig/network-scripts/ and edit the file ifcfg-enp0s3 using vi or, as root, use sed

sudo sed -i s/ONBOOT=no/ONBOOT=yes/ /etc/sysconfig/network-scripts/ifcfg-enp0s3

If the command above is not entirely clear to you, study the article «Basics of sed»

You can check whether ONBOOT was changed to yes with the command

grep ONBOOT !$

You can study a more detailed instruction in the article «Network Configuration in CentOS»

Increasing the screen resolution

To simply enlarge the screen it is enough to go to

Settings → Display → Screen

And increase Scale Factor

It will become clearer, but the resolution will stay the same.

To increase the resolution you need to install Guest Additions following the instructions in the next paragraph.

Guest Additions

The next important step is installing Guest Additions.

Before starting it, make sure that you have enabled ONBOOT=yes in the network interface settings.

In the top menu click

Devices → Insert Guest Additions CD image…

If you are not clicking there for the first time, you will get an error because the Guest Additions CD image is already created and occupies your virtual CD-ROM - in this case go straight to the next step

Next the system may ask you to download Guest Additions.

Just follow the instructions and then wait for the installation to finish. There may be a black screen for a while.

Then a dialog box will appear suggesting Open Autorun Prompt

Click OK

A message will appear: This medium contains software intended to be automatically started. Would you like to run it?

Click Run

Installing Guest Additions in VirtualBox, image from website www.aredel.com

Enter the password

Installing Guest Additions in VirtualBox, image from website www.aredel.com

Next, depending on the Virtualbox version, the console may or may not start.

If it started by itself, wait until the installation finishes.

Installing Guest Additions in VirtualBox, image from website www.aredel.com

The installation takes quite a long time. Wait at least ten minutes.

It may hang - then open a second terminal and run reboot there

Before rebooting you can check whether Guest Additions were installed

lsmod | grep -i vbox

Wait until something similar appears (at least the first two lines)

vboxsf 81005 0 vboxguest 349038 2 vboxsf vboxvideo 35867 0 drm_kms_helper 186531 2 vmwgfx,vboxvideo ttm 96673 2 vmwgfx,vboxvideo drm 456166 6 ttm,drm_kms_helper,vmwgfx,vboxvideo

If it did not start, start it yourself and become the superuser. Run

su -
mount

find the line with VBOXADDITIONS and run

/run/media/andrei/VBOXADDITIONS… run

Example:

mount | grep VBox

/dev/sr0 on /run/media/andrei/VBox_GAs_6.1.18 type iso9660 (ro,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8,dmode=0500,mode=0400,uhelper=udisks2)

ls /run/media/andrei/

VBox_GAs_6.1.18

/run/media/andrei/VBox_GAs_6.1.18/V

Press tab to explore the options

VBoxDarwinAdditionsUninstall.tool VBoxWindowsAdditions-amd64.exe VBoxWindowsAdditions-x86.exe VBoxLinuxAdditions.run VBoxWindowsAdditions.exe

We choose VBoxLinuxAdditions.run and then the command looks like this:

/run/media/andrei/VBox_GAs_6.1.18/VBoxLinuxAdditions.run

Verifying archive integrity... All good. Uncompressing VirtualBox 6.1.18 Guest Additions for Linux........ VirtualBox Guest Additions installer Copying additional installer modules ... Installing additional modules ... VirtualBox Guest Additions: Starting. VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while. VirtualBox Guest Additions: To build modules for other installed kernels, run VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup <version> VirtualBox Guest Additions: or VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all VirtualBox Guest Additions: Building the modules for kernel 3.10.0-1160.24.1.el7.x86_64.

Now the OS needs to be rebooted

reboot

After a successful installation the mouse capture should work better. The ability to switch to full-screen mode should also appear.

Usually switching to full-screen mode is done by pressing Host + F. Host is usually the same key that released the captured mouse cursor. In my case it is the right CTRL.

Guest Additions will allow you, for example, to stretch the screen as you wish

Examples of VirtualBox adapter configuration, image from website www.aredel.com

Next you should increase the screen resolution.

You can go to the settings by clicking in the upper right corner.

Examples of VirtualBox adapter configuration, image from website www.aredel.com

Then you need to go to Devices → Display and choose Resolution

Examples of VirtualBox adapter configuration, image from website www.aredel.com

After a successful Guest Additions installation I advise making a clone of your virtual machine and using it. And leave the original version «in reserve» so that in case of a failure you do not install everything again, but simply make a new clone.

Cloning the virtual machine

To clone the machine it is enough to shut it down and use Clone (Ctrl - O) from the context menu.

Even if you request separate MAC addresses the clone may keep the same machine-id

This leads to duplication of the IP address in the NAT-Network

On both machines run

cat /etc/machine-id

4ab7d70cacd0d33ca5bc9b2344e5e328

And compare them with each other

Adapters

Examples of VirtualBox adapter configuration, image from website www.aredel.com

Examples of VirtualBox adapter configuration, image from website www.aredel.com

Examples of VirtualBox adapter configuration, image from website www.aredel.com

Examples of VirtualBox adapter configuration, image from website www.aredel.com

After installation and reboot you will most likely have to go again into NETWORK & HOST NAME and enable the adapters

Examples of VirtualBox adapter configuration, image from website www.aredel.com

Errors

When you click

Devices → Insert Guest Additions CD image…

An error may appear

Unable to insert the virtual optical disk /usr/share/virtualbox/VBoxGuestAdditions.iso into the machine CentOS7_Desktop2. Could not mount the media/drive '/usr/share/virtualbox/VBoxGuestAdditions.iso' (VERR_PDM_MEDIA_LOCKED). Result Code: NS_ERROR_FAILURE (0x80004005) Component: ConsoleWrap Interface: IConsole {872da645-4a9b-1727-bee2-5585105b9eed} Callee: IMachine {85632c68-b5bb-4316-a900-5eb28d3413df}

Most likely your virtual CD-ROM is already occupied by something. For example, you already added Guest Additions and forgot about it.

Find the CD-ROM, for example on the desktop, and do Eject

Article author: Andrei Olegovich

Try Claude Pro free for 7 daysSign up through this referral link and get 7 full days of Claude Pro for free.