Install CentOS 7 on VirtualBox

Contents
Introduction
Host-only Adapter
Auto Capture
Netinstall
Remote connection to VM
Increase Screen Size
Guest Additions

Introduction

CentOS 7 is a last CentOS, that got support from RedHat for its full lifecycle up to now it is one of the most popular Linux .rpm distros therefor many users install it on VirtualBox to test software developed for RedHat

Centos 7 on Ubuntu

VirtualBox can be installed on Ubuntu by running

sudo apt install virtualbox

To start VirtualBox execute

virtualbox

Host-only Adapter

To create Host-only Adapter it is neccessary to have a virtual network for such adapters to communicate

In the VirtualBox main window press FileHost Network ManagerCreate

Create host-only adapter in VirtualBox image from website www.aredel.com

Click Properties

Create host-only adapter in VirtualBox image from website www.aredel.com

Check values in the Adapter tab

Create host-only adapter in VirtualBox image from website www.aredel.com

Check values in the DHCP Server tab

Create host-only adapter in VirtualBox image from website www.aredel.com

Open settings of virtual OS → Choose Network → Choose adapter → Connect it to network you have created before

Create 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

It means that when you hover mourse cursor over Virtual Machine image it will be captured and work as mouse cursor in this OS.

To get cursore back you need to click right CTRL. Usually there is a hint in bottom right corner.

Install image from network

New

Install image via network VirtualBox image from website www.aredel.com

Choose name and select Red Hat (64-bit) from the list

Install image via network VirtualBox image from website www.aredel.com

Leave Memory size default value. In this example it is 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 progress to the screen below - click SettingsNetwork

Install image via network VirtualBox image from website www.aredel.com

Attached to: NAT Network.

At least one NAT Network should be created in VirtualBox in advance

Install image via network VirtualBox image from website www.aredel.com

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

At least on Host-only should be created in VirtualBox (File - )

Install image via network VirtualBox image from website www.aredel.com

Click Start

If you have installed VMs from some images - they are available in the list.

Install image via network VirtualBox image from website www.aredel.com

Choose Minimal image

Install image via network VirtualBox 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 turn on both adapters

Install image via network VirtualBox image from website www.aredel.com

Done

Install image via network VirtualBox image from website www.aredel.com

Installation Destination - go there and click Done

Installation Source

Install image via network VirtualBox image from website www.aredel.com

→ On the network:

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

Notice url. It is specific for netinstall. For download we used isos instead of os

os is for netinstall

Done

Install image via network VirtualBox image from website www.aredel.com

Software Selection

Install image via network VirtualBox image from website www.aredel.com

Minimal Install → Done

Install image via network VirtualBox image from website www.aredel.com

Begin Installation

Install image via network VirtualBox image from website www.aredel.com

Reboot

Install image via network VirtualBox image from website www.aredel.com

Connect to virtual machine

After reboot execute

ip a s

Or

nmcli conn show

To check network connections

If an interface, e.g. enp0s3, is off, you can turn it on by executing

nmcli conn up enp0s3

To turn interface on automatically with system start write ONBOOT yes

As an option you can change directory to /etc/sysconfig/network-scripts/ and edit file ifcfg-enp0s3 with vi or use sed as root

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

If you have problems understanding command above - read the «sed basics» article.

To test if ONBOOT was changed to yes execute

grep ONBOOT !$

More detailed instructions you can find in «Network Configuration в CentOS»

After installation

After installation is done I recommend to use

sudo yum update

Increase screen size

To increase screen resolution you can visit

SettingsDisplayScreen

It is possible to increase Scale Factor

Size will be larger but resolution stays the same.

Guest Additions should be installed to increase resolution.

Guest Additions

To install Guest Additions.

In top menu click

DevicesInsert Guest Additions CD image…

Will appear

Click Run

Then based on Virtualbox version console can or can not start.

If it did not start run it yourself and become a superuser

Execute

mount

Find line with VBOXADDITIONS and execute

/run/media/andrei/VBOXADDITIONS… run

It installation started automatically - wait for it to finish.

It can stuck - then open second terminal and run

reboot

After successfull installation mouse cursore capture should work better. Also it should become possible to switch to full screen mode Usually it is done by pressing

Host + F

Host is usually the same button that release captured mouse cursor.

In this example it is right CTRL.

Clone Virtual Machine

To clone VM it should be Powered Off

Then Clone (Ctrl - O) should be used from context menau

Even if you request new MAC address clone can have same machine-id

This can lead to IP address duplication in NAT-Network

On both machines execute

cat /etc/machine-id

4ab7d70cacd0d33ca5bc9b2344e5e328

And compare them

Share in social media: