How to Create a Linux Virtual Machine with VirtualBox

centos-vm-225x225Recently I created a training course on Hadoop programming and debugging for my colleagues at work. During the course development I decided to set up the environment I discussed in my blog Debugging Hadoop Applications with IntelliJ on a CentOS virtual machine so the students would have some Hadoop code to play with right off the bat. Since most of them didn’t have VMware, I created a VM with Oracle’s VirtualBox – a free alternative to VMware desktop solutions. This tutorial covers how to create virtual machines using VirtualBox.


Install VirtualBox

  1. Download the latest VirtualBox for your host operating system.
  2. For Mac OS follow these steps:
    • Double click on the DMG package
    • Double click on the VirtualBox drive
    • Double click on the VirtualBox.pkg file
  3. Otherwise double click on the Windows installation package.
  4. In either case follow the installation instructions.

Get the CentOS 6.3 DVD ISO

Download either the LiveDVD ISO image for 32 bit CentOS or 64 bit CentOS. In my case I used the 64 bit ISO and it is the one I recommend. Most systems these days are 64 bit. However if you have a 32 bit host system, then you’ll have to use the 32 bit ISO since the 64 bit version can only run on a 64 bit host.

Create a Blank Virtual Machine

First we need to create a blank virtual machine onto which CentOS 6.3 will be installed.

  1. Open VirtualBox.
  2. Select Machine > New… in the top menu bar.
  3. Set the name of the virtual machine to CentOS 6.3 64 bit.
  4. Set the operating system type to Linux.
  5. Set the operating system version for Fedora (64 bit). Since there is not version for CentOS, this is close enough.
  6. Click Continue.

Name and operating system

  1. Set the VM memory size in the Memory size screen. I suggest 1 – 2 GB. In the example below I use 2048 MB (2 GB).
  2. Click Continue.

Memory size

  1. Click on Create a virtual drive now radio button in the Hard Drive screen.
  2. Click on Create.

Hard drive

  1. Select the VDI (VirtualBox Disk Image) radio button in the Hard drive file type screen.
  2. Click Continue.

Hard drive file type

  1. The Storage on physical hard drive screen allows you to decide whether the hard disk you create for your virtual machine is Dynamically allocated, set to a minimum size and allocated as more hard disk space is needed, or set to a Fixed size meaning the all hard disk space is created up front. The fixed size option will allow your VM to run faster so I suggest selecting this option.
  2. Click Continue.

Storage on physical hard drive

  1. Set the file size. I suggest 20 GB or greater.
  2. Click Create.

File size

Install the CentOS 6.3 ISO

Next let’s install CentOS 6.3 from the ISO image downloaded previously. The basic process is to specify the ISO as one a CD/DVD drive for the virtual machine. Since the ISO we are using is  Live DVD, CentOS will boot when the virtual machine is started. From there we can install the CentOS system onto the virtual machine hard drive.

  1. Click on the CentOS 6.3 64 bit  virtual machine in the Oracle VM VirtualBox Manager screen.
  2. Click on Storage.

VM Manager

  1. Click on the CD icon to the right of the CD/DVD Drive: IDE Secondary field.

IDE Secondary

  1. In the file open dialog box that is produced, go to the location on your system where the ISO is located.
  2. Double click on the ISO image file. The IDE Secondary should now point to the ISO as shown below. On my system the name of the ISO is CentOS-6.3-x86_64-LiveDVD.iso.


  1. Click on the large green Start arrow in the  Oracle VM VirtualBox Manager screen to start the virtual machine.
  2. When the CentOS LiveCD desktop shows up, double click on the Install to Hard Drive icon to install CentOS 6.3 on your virtual machine image.

LiveCD Running

  1. At the CentOS screen click Next to continue.
  2. Select the language you will use for CentOS.
  3. Click Next.


  1. Accept the default Basic Storage Devices then click Next.

Storage devices

  1. The storage device warning below will be displayed.  Since you are creating the virtual har drive for the first time just click on Yes discard any data.
  2. Click Next.

Storage device warning

  1. Enter a host name for the virtual machine, like CentOS-6.3.
  2. Click Next.


  1. Enter your time zone in the next screen. In my case it is Pacific Coast (Los Angeles) time.
  2. Click Next.

Time zone

  1. Set the root password.

Set root password

  1. Accept the default installation option – Replace Existing Linux System(s) – in the next  screen, then click Next.

Replace existing Linux system

  1. To write the changes so far to your virtual hard disk, click on Write changes to disk.
  2. Click Next.

Writing storage config to disc

  1. Then you’ll get a screen that indicates the live image is being written to the virtual hard disk. When this is done you’ll get the screen shown below.  Don’t click on Close.


  1. Instead shutdown the virtual machine by selecting Machine > ACPI Shutdown from the top menu bar.
  2. Click on the Storage item in the Oracle VM Virtual Manager – see the illustration in step  2.
  3. Click on the CD icon to the right of the CD/DVD Drive: IDE Secondary field – see the illustration in step 3 – then select Remove disk from virtual drive.
  4. Click OK.

Configure CentOS 6.3

When you reboot the system you’ll then configure your CentOS virtual machine.

  1. Click on Forward in the screen shown below.


  1. Accept the license and click on Forward.

License information

  1. Create a standard user by entering a user name, full name for the user and password.
  2. Click on Forward.

Create user

  1. Set the date and time. You can either set it manually or synchronize with a time server.  I prefer synchronizing with a time server so click on Synchronize date and time over network.
  2. Click Forward.

Date and time

  1. Click on Finish in the Kdump screen.
  2. Click on the Yes to enable the Kdump facility.
  3. Click on OK in the prompt to reboot the system.
  4. After the CentOS virtual machine reboots you can login with the user credentials entered in step 3.

CentOS login


Article by Vic Hargrave

Software developer, blogger and family man enjoying life one cup of coffee at a time. I like programming and writing articles on tech topics. And yeah, I like coffee.


  1. Pingback: chanel pas cher
  2. It appears that you have not enabled CentOS access to any I/O devices such as
    the Ethernet port or USB. Can this be done as it is when running an OS such as
    RHEL Server in a virtual machine within RHEL Workstation? Is there a reason that
    you chose the Live version instead of the standard CentOS 6.3? Thanks.

    1. Yes to enable networking you just open up the settings for the VM then select the bridged network mode. Then the VM will get an IP address and act like another computer on the network. I you select NAT node then the VM will use the IP address of your host. To add a USB device, just add one in the storage settings for the VM.

      The live CD is lets you run CentOS of the CD without having to install so you can see if you like it first. It is also very easy to install.

  3. Great post and very helpful. I have attempted to build a Linux VM with Virtual box several times and have never gotten it to work. This article let me see why. Off to build another! Thanks a lot.

  4. thanks Vic. This VM installation ( 2nd attempt) was the best experience far thanks to your step by step.
    Now I will try Hadoop installation.

Leave a Reply

Your email address will not be published. Required fields are marked *