How to Perfectly Install CentOS on VirtualBox

Install CentOS on VirtualBox

Want to install CentOS on VirtualBox? Of course you do! It’s one of the most popular Linux distros out there and VirtualBox is the most popular virtualization software available for running virtual machines. But using a virtual machine can be intimidating – they’re unlike any other app. In practice, however, they’re simple to use and extremely handy. Not gonna lie though: when we were working this, there were many steps involved to get things just right. In what follows, we’ll show you what we learned. What makes VirtualBox the best virtual machine for the job. How to setup VB. And how to download and install CentOS 7 in just a few easy steps.

What’s CentOS?

Community Enterprise Operating System (CentOS) is a Linux distribution based on Unix that provides a 100% free, open-source, enterprise-class operating system OS. An overwhelming number of community members have adopted and supported the platform since March 2004.

It’s a free clone of the Red Hat Enterprise Linux. And although it’s a distribution aimed at business and enterprise users for their servers, unlike Red Hat Linux, it’s free! Which means you can use it too, though without the active and direct support of the CentOS team.

What’s VirtualBox?

Developed by Oracle, VirtualBox (VB) is a free open source, cross-platform virtualization software.  

  1. It allows you to run more than one operating system (read: virtual machine VM) on your laptop.
  2. And lets it run in a virtual environment as a Guest Operating System.

That’s right, so long as the primary OS in your laptop can handle it, you can wind up as many virtual machines of any desired OS you want. Supported operating systems include:  Windows XP, Windows Vista, Windows 7, macOS X, Linux, Solaris and OpenSolaris.

Why You Want to Use VirtualBox as Your VM

There are tons of uses for a virtual machine (VM). Fundamentally, we like that it eliminates the need to buy new hardware if you want to try an operating system like CentOS.

A VM like VirtualBox lets you do so without the risk of screwing up an install or dual-boot. You can even use a VM to mess with risky software or hacks without the threat of jeopardizing your laptop.

VirtualBox is the best VM because:

  1. It’s free
  2. Easy to use
  3. Reliable
  4. Has active community support
  5. Runs a variety of guest operating systems
  6. And it’s compatible with good access to hardware including sound, USB, and serial ports

How to Install VirtualBox

Before you can install CentOS on VirtualBox, you’ll need to download VirtualBox onto your laptop if you don’t already have it. Don’t worry, there are only 3 steps in this section, which have been detailed for you below.

1: Head over to the VirtualBox download page.

VirtualBox Download Page

2: Download the right version for your primary Operating System.

3: Then, download the installer as normal (if you see a window dialogue asking to install a driver, go ahead and allow it).

And that’s it! 

The VirtualBox main screen will look like this…

VirtualBox Main Screen

Now, the virtual hard disk you’re about to create will be 20GB or bigger. 

By default, VirtualBox saves virtual machine information in your user folder. 

But if you have two drives – like a solid-state drive (SSD) and a mechanical hard drive (MHD) – you’ll likely want to save it in the drive that offers more space.

Just go to:  File > Settings in VirtualBox where you’ll see a Default Machine Folder field on the General tab. If you don’t like where the virtual machine information is, click Other in the drop-down menu to change it.

Default Machine Folder

How to Download and Install CentOS 7 on VirtualBox in Windows 10

Finally, the long-awaited CentOS 7 is released!

And now comes the fun part: installing CentOS onto VirtualBox. This section has a total of 9 steps and we’re right here to carefully walk you through each of them.

Step 1: How to Install CentOS ISO on VirtualBox

You’ll need to download the CentOS 7 ISO for VirtualBox.

There’s a DVD ISO and a Minimal ISO.

The minimal install is only 636MB versus the 4GB of the DVD ISO. It’s a bare-bones install that will allow you to customize the environment exactly the way you want. But it doesn’t come with the windows manager or development tools. So, in this example, we’re going with the DVD ISO.

Step 2: It’s Time to Create a New Virtual Machine

Click New on the VirtualBox image page. 

VirtualBox Image Page

Step 3: Fill Out the Name and Operating System for the new VM

Enter the following details:

Name: Something unique that you can easily identify.

Type: Linux

Version: Depending on the VB image file version you downloaded, select Red Hat (64bit) or Red Hat (32bit).

Example:

Select Red Hat Bit Version

Step 4: Allocate the Desired Memory Size

Click Next and on the next screen is where you get to decide how much RAM you want to set aside for CentOS – kind of like how your primary OS requires a certain amount of memory to operate.

The exact amount to allocate depends on how much RAM your laptop has – a general rule of thumb is half your laptop’s RAM. This number is represented in megabytes MB. 

For example: If your laptop has 8GB and you want to give 4GB to the VM, multiplying 4GB by 1024, which gives you 4,096MB.

You can use the slider or simply type in the value you want to assign to the VM like so…

Allocate Desired Memory Size

Step 5: Now It’s Time to Create a Virtual Hard Disk 

The VM needs a place to store data.

Click Next again and select Create a virtual hard disk now.

Create a Virtual Hard Disk

Step 6: Choose a Hard Disk File

Select VDI (Virtual Disk Image) and click Next.

Select Virtual Disk Image

Step 7: Then Select a Virtual Hard Drive

Dynamically allocated only takes up the amount of space you create for the VM and won’t shrink it even if the VM winds up not using up that much room. Fixed size has the advantage of some slight speed increases because of its larger initial size.

We chose Dynamically allocated so that the virtual hard disk will grow accordingly with how much we fill the virtual machine instead of grabbing all the space we’re about to assign.

Create Virtual Hard Disk

Step 8: Specify a Disk Location and Size

You can leave the default name as is or change it to anything you choose. For the virtual hard drive size we entered 40GB, then click Create.

Specify a Disk Location and Size

Step 9: You’ve Successfully Created a Virtual Machine!

Now, just select CentOS 7 and click Start to power on your virtual machine.

You've Created a Virtual Machine

How to Install CentOS on VirtualBox and Start the Virtual Machine

Can you feel it. In a few moments you’ll be able to use CentOS 7 on your laptop. There’s only 5 steps in this section – then you’ll be good to go.

Step 1: From the Boot Menu…

 Select Install CentOS Linux 7 and press Enter.

Install CentOS Linux 7

Step 2: Select Your Desired Language

Below is the first page of the CentOS 7 installation. Choose your preferred language.

Select Your Desired Language

Step 3: Set All the Installation Options

These will be things like your time settings, location, and network. After you’re done, click Begin Installation.

Set All Installation Options

Step 4: While the Installation is Going On…

Set the Root and User Account. Once the installation is complete, click Reboot.

Set Root and User Account

Step 5: After the Reboot…

Accept the license and connect to a network.

Accept License and Connect Network

And that’s it, you’re done!

CentOS Installed

Closing Thoughts

There are many Unix-based operating systems out there. According to SolveDNS: Redhat, Ubuntu, Debian and Fedora are the ones you want. But CentOS stands heads and shoulders above the pack for being an enterprise quality operating system that’s totally free! In the same way, VirtualBox is a free and open-source virtualization solution that works with all x86 platforms including: Windows, Mac, Linux and Solaris. And now that you know how to install CentOS on VirtualBox you can setup VirtualBox. If you want to try out any new platform, there’s nothing holding you back. So, go and give it a try!