Hi,

Jyoti Sensharma

Generally for testing new components, services or products we frequently need VM machines. Specially for testing open source components. Hence we need some kind of virtualbox setup locally to test these things quickly. Oracle VirtualBox is a general-purpose full virtualiser for x86 hardware, targeted at server, desktop and embedded use.

In this article we will see how quickly we can configure the Oracle VirtualBox and create a CentOS 7 VM. The same article can be referred to create any other OS VM like RHEL 6/7, Fedora, Suse etc

 

Download the Oracle VirtualBox from below link and install:
https://www.virtualbox.org/wiki/Downloads

Download CentOS 7 minimal version from below link:
http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1708.iso

Global VirtualBox Network Settings

In below steps we will add a new NAT Network and Host-Only Network which will help our VMs to get a public IP Address and they will be able to connect to the world wide network.

Step1: Navigate to VirtualBox >> Preferences >> Network

Step2: Add a new NAT Network.

Step3: Navigate to File >> Host Network Manager

Step4: Add a new Host-Only Network.

VM creation and its network settings

Step5:  Create a new VM in VitualBox with Type Linux for installing CentOS 7.

Step6: Setting 4GB RAM for this VM so that we can run some servers on this VM and test multiple things at a time.

Step7: In this stage we are fixing the memory utilisation of this VM by selecting Fixed Size, so that it should not consume more than the allocated memory.

Step8: Allocating 20GB memory for the hard disk of this VM

Step9:  Configure the network settings for this CentOS 7 Node1 vm as follows:

Step10: Start this node1 and install CentOS 7 in this vm.

Step11: Just in case if you want to make the IP Address Static “192.168.56.101” and IPV6 disabled then follow the below steps:

vi /etc/sysconfig/network-scripts/ifcfg-enp0s8

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp0s8
UUID=58c59ff3-31fa-4fa4-8259-430e5e122d52
DEVICE=enp0s8
ONBOOT=yes
IPADDR=192.168.56.101

Step12: Restart the network services:

service network restart

Step13: Repeat the above steps of “VM creation and its network setting” to create Node2.

Configure both the host to recognise each other by their hostnames:

Edit the “/etc/hosts” file:

vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.56.101	node1.example.com
192.168.56.102	node2.example.com

For Configuring passwordless ssh between these nodes refer the below article:

How to configure passwordless ssh between linux hosts

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.