Installing VirtualBox and CentOS 7 on Ubuntu

VirtualBox is a fantastic (and free) open source project from Oracle which allows a user to run other boxes virtually on their current machine without having to create a dual-boot machine. There are other software that compete with VirtualBox, such as Parallels and VMWare. I won't compare and contrast the major three virtualization distributions as there are several sites that do that, written by people who have the comparative experience.

In Ubuntu:

1. Using the terminal, installing VirtualBox in Ubuntu is as simple as pressing 32 keys. (26 keys is you are root.) Those keys are:

# sudo apt-get install virtualbox

    For this example, I am running 4.3.10.

2. Get a copy of whichever distribution you want to run on VirtualBox. [Note: you CAN have more than one virtualbox, though depending on your base system's RAM, if you run several virtual boxes at once, everything becomes VERRRRY slow.]

VirtualBox start page

 

3. In the 'Name' field, enter a name you want the virtual box to be called.

4. In the 'Type' field, there are several options to choose from however in this article, I will only cover installing CentOS 7.

  • For Linux systems

(a) In the 'Version' field, there are 29 flavors to choose from. In order to spare the general reader from the list, suffice to say Debian, Red Hat, Oracle, SUSE are included. Centos 7, which is popular but not explicitly listed, is my flavor of choice for this article (to be specific: the file is CentOS-7-x86_64-Everything-1503-01.iso). Make sure that you have downloaded the proper distribution for your architecture otherwise you can run into issues.

(b)

VirtualBox Name and Operating System

 

(c) The next screen asks you to set the RAM to be allocated. I chose 2560MB as a baseline though you can select as little as the minimum amount (512MB) or more than what I've chosen for my virtual box.

VirtualBox Memory Size

 

(d) The next screen gives you three options. The default choice is 'Create a virtual drive now'. The recommended size of the hard drive can be set to a different size on a third following screen (subsection g in this article)

VirtualBox install hard drive

 

(e) The next screen gives you the choice of hard drive types. Unless you have a reason otherwise, stay with the default option, VDI (Virtualbox Disk Image). Virtualbox will ask you what type of disk you want to create: VDI, VDMK, or VHD. VDI is the original format for Virtualbox, while VDMK is the format used by VMWare.

VirtualBox install hard drive type

 

(f) When choosing the storage on physical hard drive, that is up to you. I opted for the 'Dynamically Allocated' because the 'Fixed Size' option just eats up disk space.

 

(g) Here is where you get to choose where to locate your new virtual hard drive file AND the size of the virtual hard drive. I chose 'Centos_7'. For determining the size of the virtual hard drive, it is dependent on what the size of your current base hard drive is and how much you want to allocate to this particular virtual hard drive.

 

(h) You should be at the following screen. Press 'Start'.

VirtualBox installation home

 

(i) The following screen is where you get to locate the Linux file you downloaded.

CentOS 7 start up disk selection

 

(j) Welcome to the beginning of the CentOS 7 installation :)

Install CentOS 7

 

(k) You will then get a black screen with an increasing colored bar across the bottom. The next screen is for the installation language. Which one will you choose?

CentOS installation language selection

 

(l) And now....the Installation Summary....

CentOS installation summary

 

(m) Click 'Installation Directory' to get to this next screen ('Device Selection') and select the VB box harddisk and the click 'Done' on the top left corner of the screen.

CentOS hard disk install

 

(n) After this, you should be back at the Installation Summary and not have any orange exclamation points on the summary. Then click 'Begin Installation' at the bottom of the screen.

 

(o) This next screen is where you set root password is set and the user is created while you wait for the installation to complete. Click on each one and create memorable but hard to crack password using a combination of upper and lowercase letters, numbers and special characters.

VirtualBox install root user set

 

(p) Once the installation is successfully completed, reboot and have fun!

 

5. When you log in for the first time, you may get just a terminal window (see below). This is not an issue. Just follow the steps below and you will have a fully working GUI.

CentOS login

 

(a) After you have logged in to the shell, you have to get access to the Internet to get the packages needed for the GUI (the major ones are "X Window System", "GNOME Window System" or "KDE Window System"). In the terminal window, type the following:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

    [NOTE: generally the eth0 ending is correct. Mine was slightly different but I was able to determine the name by typing in the terminal window and using your favorite text editor,  ls /etc/sysconfig/network-scripts/.]

 

(b) Update the line 'ONBOOT' to 'yes', save the file and then for good measure type:

         # yum update

     Then, after the update has completed, reboot the machine.

    [NOTE: You can restart the network interface from the command line without rebooting the entire system and I don't have any problem with that.]

 

(c) Once you are logged back in, type: (replace X Window System with which ever flavor you'd like)

# yum groupinstall "GNOME Desktop"

 

(d) If you want to only run the desktop GUI on occasion, you may type at the command prompt:

     If you always want the desktop GUI, the /etc/inittab file needs to be updated. Assuming you are root (replacing vi with your favorite text editor), type at the command prompt:

# ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target

 

(e) After rebooting the system, the GUI loads (with your user name...of course) !

CentOS 7 front page

 

(f) The first time you run CentOS 7, you will go through an initial setup including default language, input language and connecting your computer to the cloud. Once you have passed through these last steps, ENJOY!