Hello everyone,
I hope that if you have opened this post then you must have used the VirtualBox earlier or planning to use it for the first time. The concept of virtualization is really interesting and I personally like it as it let me create a virtual environment of my production environment and do the R&Ds. Recently I was trying to achieve something and that required a virtual machine with a Linux OS.
Earlier whenever I had configured any Linux OS on VM, I used to take help from other sites or some YouTube videos so this time I decided to draft all the steps by myself and publish it. So this post will basically tell you how you can install and set up your VM on your own.
I will be installing the Oracle Linux 7, and all the steps will be the same for RedHat Enterprise Linux 7 and CentOS 7 since all the three are pretty much the same.
Prerequisite
Before you start the installation, download the following software:-
1. Oracle VM VirtualBox
2. Oracle Linux ISO
Also, install the Oracle VM VirtualBox Extension Pack along with the VirtualBox. I have used Oracle Linux 7.8 but you can choose any version. The latest is version 8. To download the Oracle Linux, go to the Oracle Software Delivery Cloud page, create your personal account and download it. You can download every Oracle software from there.
Installing VirtualBox is easy. You just have to click next and set your desired location where you want to install it and then you are done with that. I will be demonstrating the configuration of VM and then installing Linux in it.
When you will launch Oracle VM VirtualBox after installation, you will get the following page as shown below.

Click on Add to create a new virtual machine instance. Fill in the details asked in the dialog box. Select Type as Linux and Version as Oracle (64 bit) and click Next.
Now, the dialog box will appear where we have to specify the RAM that we want to allocate to the virtual machine. Since my laptop has a good amount of memory, I have assigned 6 GB (6144 MB).

Next we will create the virtual hard disk. Select the second option.

Next one is to choose the hard disk file type. We will be going with the first one, that is, VDI (VirtualBox Disk Image).

Next we have to specify that what type of storage we want, fixed or dynamic. It is better to choose Dynamic storage as it will occupy the space when the virtual machine will be running.

Our new virtual machine is created. Some small changes need to be done in settings and then the VM will be ready for OS installation.
Open the setting of VM, select General –> Advanced, change Shared Clipboard, and Drag’n’Drop to Bidirectional.

Go to the Network tab and change the adapter type to Bridge Adapter and click OK. If you want to access your VM through SSH then you need to set up internal and external IP. My task needs that so I have performed those steps and you can check out the post on Network setup.

We are done with the Settings. Now Start the machine. You will be asked to insert the disk image or the ISO file. In the image, you can see that I have selected V995537-01.iso which is 4.46 GB. You will see the image file which you will insert.

The Linux configuration process begins. The first dialog box is of Language selection. Choose it according to your Country. In my case, I have selected English (India).

Next, configure the Installation Destination. When you will click it, a new dialogue box will open as shown below.

Here, we will be creating a new partition so that our root directory remains unaffected. So click on the option “Click here to create them automatically” to go to the partitioning page.

Currently, you can see that the root has 44 GiB of space. We will be doing some modifications here so that we can create our own partition. Assign values as per your requirement.
/boot = 1024 MiB
/ = 18 GiB
swap = 6000 MiB
In the screenshot, you will see the swap size is 5116. I did a mistake of not increasing it due to which I faced issues while installing Oracle Database so kindly change it here itself otherwise you have to do a lot of extra work to change it.
Next, click on the + button at the bottom to add a partition and fill the fields as shown in the screenshot below.
Mount Point = /u01 [You can give whatever name you want]
Desired Capacity = 25 GiB [Allot as per your requirement]
Once finished, click on Done.

Once finished, click on Done. A new dialogue box will emerge. Click on the Accept Changes button to finish it.

Next, we will set the Network and Host Name. Turn on the Ethernet button which is on the right. Change your hostname. Remember that the hostname should be a fully qualified domain name. In my case it is oracle.net, you can keep whatever you feel like.

Now comes the Software Selection part. I will suggest you choose Minimal Installation. If you really want to learn Linux then you should opt for this as it will give you the traditional black screen window. See the image below.

Once you are done with all the configuration process, your screen will somewhat look like the image shown below.

Click on Begin Installation. On the next screen, set the root user password, and if you want then create a user and let the installation complete.

Hope this was helpful. If you have any queries then write it in the comment section. I will help you and do follow me on Twitter, Instagram, and connect with me on LinkedIn.
For consulting, mail me at techanswersweb@gmail.com.