Saturday, March 2, 2013

Installing a Linux Virtual Machine

Need to run Linux, but all you have is a Windows or Mac desktop/laptop? You could go through the hassle of setting up your system to dual boot by setting up separate drives or drive partitions. That is one solution, but there is another way that allows you to keep your original system unmolested while allowing you the flexibility to add and remove operating systems with relative ease. A virtual machine is like a simulated system that runs like a normal computer, except that is exists completely in software. Virtual machines are very useful when you want to run multiple operating systems (or different operating systems) on the same hardware at the same time. Each OS 'thinks' its running on its own computer so nothing special needs to be done with the OS for it to operate. The only thing you may need to do is set up the VM software to give the OS access the network, CD drives, etc.

Note on terminology:
Host OS - This is the operating system that the virtual machine software is installed on. For example, I have a Windows laptop, so my host OS is Windows 7.
Guest OS - This is the operating system that is installed on a virtual machine. For example, I want to have a virtual machine that runs a Linux OS, so my guest OS is Linux.

Steps for installing and setting up a Virtual Machine:
  1. Install VM software
  2. Configure a VM
  3. Install OS
  4. Apply updates and configurations

1. Install VM software
There are many kinds of VM software available. Some are free and provide a lot of the basic functions you need to get started. Others cost money and offer a lot of features that are geared towards business. In this case, I chose VirtualBox as my VM. It's free, offers the features I need and can be installed on Windows, Mac, Linux and Solaris host operating systems.
I want to use a virtual machine that runs a Linux OS. I have a Windows laptop, so I installed VirtualBox for Windows hosts. Make sure you install the right version that matches your host OS and CPU architecture (32-bit or 64-bit).

2. Configure a VM
Once the VM software has been installed, you should be able to configure a virtual machine for your guest OS. I want to install CentOS 6.3, which is a Linux flavor based upon the popular RedHat Linux OS. Make sure to look up the minimum hardware requirements for your guest OS. Your virtual machine should be configured to 'give' enough RAM and hard drive space for your guest OS to function. In this case, VirtualBox allows you to tell it what type of guest OS you are using so it suggests that I allow CentOS to have 512 MB of RAM and give it up to 8GB of hard drive space.
VirtualBox overview window
Virtual Machine Overview in VirtualBox

3. Install OS
There are a few ways you can install your guest OS. You can use an actual disk that is inserted into your CD/DVD drive, or you can use a disk image that was downloaded from the Internet. In both cases, you probably have to tell your VM software to allow your Linux virtual machine to access the disk or disk image. In this case, I used an ISO disk image to act as if a real CD was inserted into the virtual machines disk drive.
VirtualBox - Setting up thr CD drive
Setting up the CD drive for the Virtual Machine in VirtualBox

Start up the virtual machine and install the guest OS according to relevant documentation.

4. Apply updates and configurations
Once your guest OS is installed, you may need to configure the OS for networking or to handle that abstracted hardware components you gave it. Most of the work is probably done with the VM software. For example, your VM software may have some sort of networking component that allows the guest OS share your host OS's Internet connection. To your guest OS, all it sees is a typical Internet connection, and it knows nothing about your host OS setup.

If you have any questions on setting up your virtual machine, put a note in the comments and I, or someone else, may be able to help you.

No comments:

Post a Comment