Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / operating-systems / Linux

Run Linux in Microsoft Windows in a VirtualBox

4.67/5 (13 votes)
11 Feb 2012CPOL9 min read 71.9K  
This article is a study note on installing Linux in Microsoft Windows in a VirtualBox. I hope that it may be of some help to those who are interested in this topic.

Introduction

This article is a study note on installing Linux in Microsoft Windows in a VirtualBox. I hope that it may be of some help to people who are interested in this topic.

Background

Back in school, I worked on UNIX quite extensively in my course projects. But I have never had my own UNIX system. In terms of Linux, I am a beginner. But I have always been thinking of having a Linux computer. Recently I revisited this subject and went to a couple of forums and web sites to learn Linux. I did not want to invest a dedicated computer on Linux, and I did not want to get into the complexity related to the dual boot system. After some research I noticed the VirtualBox. I found it an ideal tool for beginners to get started. The Linux installation on a VirtualBox is simply a file in the host computer. If you mess up anything, you can simply remove it and give the whole process a complete, fresh re-start without any side effect on your host computer. Running Linux on a VirtualBox is quite easy and my experience is very pleasant, so I decided to keep a note, in case I forget about it. Hopefully this note can be of some help to the interested readers too.

What you need

In order to install and run Linux in a VirtualBox, I had the following two things in my hands:

  • A computer running Microsoft Windows. The computer that I used was a low-end computer. It was a three year old 32 bit Pentium(R) Dual-Core T4200 @ 2.00GHz laptop running Windows Vista Home Premium. It had 3GB memory and a 300GB hard drive. Considering the time and the price when I purchased it, most of the computers being used today are much more powerful than this one. I also had a reasonably fast internet access to download the required software.
  • A writable CD. I created a Linux installation CD using it. If you have a USB drive, you do not need a CD. You can simply use your USB drive.
The VirtualBox runs on multiple operating systems. Since I only have a Windows laptop, all my learning is on Windows. Now let us start to set up the system step by step.

Create a Linux CD

Before creating a Linux CD, you will need to decide which "Linux distro" you want to use. This link discusses some differences among the most popular Linux distributions. I personally have tried both Ubuntu and Mint. I feel that they are both good and pleasant to use. The choice is just a personal preference. In this study note, I will use Ubuntu as the example.

Download the Ubuntu Installation ISO

The first step to create a Linux CD is to download the ISO file. You can go to this link to download your desired ISO. The current Ubuntu distribution version is "11.10". The download page provides both the 32 bit version the 64 bit version. Since my computer is a 32 bit computer, I downloaded the 32 bit version. The ISO file for the 32 bit version is 695MB. Depending on the speed of your internet access, it may take you longer to download this file. Since Ubuntu maintains their web site nicely, you should not have much trouble to have the file fully downloaded with a moderately fast internet access. In my case, it took me about three minutes to download the ISO file.

Download and Install the ISO Recorder

This step is not absolutely necessary. The whole purpose of installing the ISO Recorder is to burn the downloaded ISO to a CD. According to Ubuntu, if you are using a Windows 7 computer, you should be able to use the Windows Disc Image Burner to create the installation CD. Since I used a Vista computer, I installed the ISO Recorder. The ISO Recorder supports both Vista and Windows 7, so even if you have Windows 7, you can still use it. It is your choice. The ISO Recorder has both 32 bit and 64 bit versions. You will need to choose the correct version that fits your computer. The downloaded file is an MSI file smaller than 1 MB. You can simply double click the file and follow the instructions on the installer to install it.

Burn the Linux CD

After the ISO Recorder is installed, you can right click on the Ubuntu ISO file and you will see the "Copy image to CD" option.

324077/ISOREcBurnCD.jpg

If you click on the "Copy image to CD" option, the ISO Recorder UI will show up to let you configure a few CD burning options.

324077/BurnCD.jpg

In my case, I simply used the default option and clicked the "Next" button. Within half a minute, the Ubuntu CD was ready for me to use. What I need to point out is that the whole purpose of installing the ISO Recorder is to create a Linux installation CD. If you have other options, you do not have to use the ISO Recorder.

Now let us get started to set up the VirtualBox.

Download and Install VirtualBox

Download the VirtualBox

You can download the VirtualBox from this link. There are a couple of versions of VirtualBox for different platforms. You will need to choose the one that fits your computer. For a Windows computer, the current VritualBox version is "4.18" and the downloaded file is named as "VirtualBox-4.1.8-75467-Win.exe". Of course, by the time you read this article, you may see newer versions of VirtualBox and I will recommend you to use the newer versions.

Install the VirtualBox

If you double click on the "VirtualBox-4.1.8-75467-Win.exe" file, the VirtualBox installation wizard will be launched.

324077/InstallVirtualBox.jpg

Click on the "Next" button, and we can change some of the installation options.

324077/InstallVirtualBoxNext.jpg

For simplicity, I chose to install everything coming with the downloaded package and started the installation. During the installation process, the installer will ask you if you want install a couple of software devices. Since the VirtualBox is from Oracle, I feel that it is a trusted company, so I chose to install all the software devices. These software devices may not be critical for this article. But they may be critical if you want to use certain advanced features once you become an expert on VirtualBox.

Install Linux on the VirtualBox

After the VirtualBox is installed, we can start to create a virtual machine and install Linux on it.

Create a Virtual Machine

To create a virtual machine, let us start the VirtualBox and click the "New" virtual machine button in the tool bar.

324077/VirtualBoxStart.jpg

The new virtual machine template will show up to let us choose the configuration options of the virtual machine.

324077/VirtualBoxSetup1.jpg

We will need to give the virtual machine a name and tell the VirtualBox what operating system will be running on the virtual machine. Click on the "Next" button, the template will ask you how much memory you want your host computer to allocate to the virtual machine.

324077/VirtualBoxSetup2.jpg

Since my computer has only 3GB of memory, I only gave 1GB to the virtual machine. This memory allocation is not a permanent allocation. Once you shutdown the VirtualBox, your host computer will take the allocated memory back. The template will further guide you to create a virtual hard drive for the virtual machine. The virtual hard drive is simply a file on your host computer.

324077/VirtualBoxSetup5.jpg

In the above screenshot, I chose to create the virtual hard drive on my desktop, and I specified its size to be 8GB. Click on the "Next" button and follow the rest of the instructions by the template to finish the creation of the virtual machine.

Install Linux on the Virtual Machine

To install the Linux operating system, we need to highlight our virtual machine and click the "Start" button on the tool bar to start it.

324077/VirtualBoxSetup6.jpg

During the start up, we will be asked where to find the operating system for the virtual machine. We can then insert the Ubuntu CD created earlier in the CD drive and let the VirtualBox find the operating system in this CD.

324077/VirtualBoxSetup7.jpg

After the Linux operating system is loaded, we will have two options. We can try the operating system from the CD without an installation. We can also install the operating system on the virtual hard drive.

324077/VirtualBoxSetup8.jpg

Since we want better performance and functionality, we can click the "Install Ubuntu" button to start the installation process. Depending on the performance of the host computer, this installation can take a long time. On my computer, it took about 1/2 hour.

324077/VirtualBoxSetup9.jpg

When the installation is about to finish, you will be prompted to enter some basic user information as shown in the picture. When you finish entering this information, you can click the "Continue" button and follow the rest of the installation instructions to finish the installation. When the installation completes, you will be instructed to remove the Linux CD and restart the virtual machine.

Run the First Application in Linux

324077/RunFirefox.jpg

After the virtual machine is restarted, we can test run some applications on Linux. The Ubuntu distribution has Firefox as the default installation. The above picture shows the VirtualBox home page in Firefox running in the Linux operating system in a VirtualBox hosted in Microsoft Windows. You can also try to run the VirtualBox in full screen mode, which will give you a much better user experience.

How about if I make any mistake?

324077/Remove.jpg

If you make any mistakes when you install Linux, you can always come to a complete fresh restart. You can right click the virtual machine in the VirtualBox to remove your virtual machine and the virtual hard drive file completely.

Conclusion

This is my first time using Linux. My general impression with it is quite pleasant. It has a very easy to use graphical interface. After installing the operating system, it took me just a couple of minutes to download Google Chrome and run it in Linux. Although my dominant experience is on the Microsoft side, it took me just 1-2 hours of effort to install Java and Eclipse and write some simple Java programs. In terms of the VirtualBox, my experience with it is also very good. It is very simple to use and has all the functions that I need to host a virtual machine. If you have some time and if you are interested, I will recommend you to try both Linux and VirtualBox.

Points of Interest

  • This article is a study note on installing Linux in Microsoft Windows in a VirtualBox. I hope that it may be of some help to the people who are also interested in this topic.
  • The biggest advantage of running Linux in a VirtualBox is that you can always come to a complete restart without any side effect on your host computer. As a beginner, this can release a lot of your pressure.
  • All the software used here can be downloaded for free. If you like the products, you can make a donation through their web site to show your appreciation and to encourage them to make their products better.
  • I hope you like my postings and I hope this article can help you one way or the other.

History

  • First revision - 2/11/2012.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)