Getting started with Virtualization - Create a Ubuntu Virtual Machine

This will be brief but (excuse me for saying so myself) a cool little blog post about getting started with virtualization. We'll get into an example right away and some minutes from now you'll be testing your website in real IE6 on a virtual machine. Don't care about IE6? Fine, later in the article we'll quickly create our own little machine where you can install any software you might find useful.

We'll install Ubuntu. Why? Because it's free and cool.

Virtualization?

Simply put, virtualization software enables us to create virtual machines. This means we can use one real, physical computer to run several operating systems, isolated from others, every single one on it's own virtual machine, which means using Virtualization we are simulating real hardware. It may be somewhat difficult to explain, but let's get into an example and you'll get it immediately.

Let's get into it right away. How? Let's download some Virtualization software and run a Virtual PC with Windows XP to test our website in IE6.

VirtualBox

 

As the VirtualBox homepage says, VirtualBox is a X86/AMD64/Intel64 virtualization platform. Let's not get into much, theory. Instead, let's just download VirtualBox (about 100 MB Download). If you're using Linux make sure VirtualBox matches the kernel arhitecture.

When the download completes, install VirtualBox just as you would install any Windows or Linux program.

Oh, yeah, you'll be briefly disconnected from the Internet, but you can easily live with that. Right? Right?

All right then. Finish the installation and let's run VirtualBox.

Nothing there. As VirtualBox itself says, we haven't created any virtual machines yet. We'll do that later. Now, let's see what VirtualBox is all about. We'll do that very easily, and we'll have some fun in the process while we revisit our old friend, Internet Explorer 6.

How? Well, we'll just download a completed "Virtual Appliance" and run it using VirtualBox.

* Well, you don't have to do it if you really don't feel like doing it. I did it, and the pics are below. :)

Getting IE6 VM

It seems Microsoft is getting cooler. They prepared a nice collection of Virtual Applicances ready for use on their modern.ie site. When you get over there, click on the "Get Free Tools" button and there you'll have an option Get Free VMs. here's a direct link to the "Download a Virtual Machine" part. Click on that and choose your desired platform.

So, after the download completes, extract the archive to a folder of your choice, open VirtualBox again and from the File menu choose "Import appliance...". When the dialog box opens choose the ovb file you downloaded and click "Open".

When you do, you'll presented with the "Import" dialog that enables you to adjust properties of a virtual machine, but we don't need to do that right now, so just click "Import".

Running IE6 VM

When the import is finished, just click on the "Start" button to start the virtual machine.

When you, do, you'll see Windows XP booting. On a virtual machine. Running on your host machine. Now, isn't that awesome?

Anyway, since this is a IE 6 Virtual machine, first thing you want to do is to run IE 6. Right?

Well, when you do, you'll get hopefully not so familliar screen:

So, how to fix this? Well, on the VirtualBox window that contains the UI from your virtual machine should be "Devices" menu. From the VirtualBox Devices menu choose "Network Adapters...". A dialog box should open.

From the drop-down menu simply select "NAT" and click "OK". After a brief delay, you should be able to access the Internet from the virtual machine.

Now, let's see how is this site displayed in IE6:

Please don't judge. It is a twelve year-old browser. :)

Trivia: Internet Explorer 6 was released on August 27, 2001. (via Wikipedia)

Moving on. We have seen what VirtualBox can do, what's a Virtual Machine and what does it do. Now, let's create one of our own and install Ubuntu on it.

Simply go to Start -> Shut Down to turn off the Virtual Machine, same as you would with the real one.

Getting Ubuntu

Getting Ubuntu is really easy. You need to download Ubuntu desktop from Ubuntu home page. Why desktop and not server? Well, it is simpler to install and I did cover the Ubuntu server in one of my recent blog posts: Setup your own small dedicated server. So if you're interested in a Server version, be sure to check out that blog post.

NOTE: In order to run a 64-Bit OS on VirtualBox, you need a cpu which supports virtualization. For more info see Wikipedia.

When you download the ISO file open VirtualBox again, and click on the "New" button to create a Virtual Machine. It asks you for Name and Operating system. Enter any name you wish and select Linux -> Ubuntu.

As a matter of fact, when you start typing "Ubuntu", the dropdown box will change automatically.

Next, VirtualBox will ask you for the amount of memory and recommend 512 MB. The Ubuntu System Requirements tell us that's fine. On the next screen, just select "Create a virtual hard drive now".

After this, simply leave the first option checked, as you don't need to use the new drive with other virtualization software.

On the next screen you can go either way, the options are presented clearly. If you don't have much free space, choose dynamic, as fixed will immediately create a file large as the disk size. So, if you for example select fixed and choose the recommended 8 GB size, you'll be left without 8 GB immediately. However, with dynamic the operating system installation will take more time than normal. But the disk will be immediately created.

With dynamic, operations will be slower, but as we're doing this just for illustration purposes, if you have a SATA hard drive I recommend you choose dynamic. Also, by googling, you'll likely find out that for most cases dynamic works just fine.

On the next screen, as VirtualBox suggests, 8 GB should be enough.

After you click "Create" the virtual disk will be created. If you select "Start" on your virtual machine now, VirtualBox will prompt you for a startup disk.

Using this dialog, you can simply point to the location of the Ubuntu ISO file you downloaded, using the choose a virtual optical disk file button. HINT: it's the small one, with green arrow. :)

When you select the appropriate ISO file, simply click "Start".

You'll be prompted to install Ubuntu. I'm guessing you know how to do that. :)

Ubuntu installation program will detect your virtual hard drive and prompt you to install there. It will also tell you you don't have an OS already installed and ask you to erase the disk. As this is the virtual disk we created earlier, feel free to do just that.

After this, rest of the installation goes smoothly. Just like installing it on a physical computer. You answer a few questions, set up your keyboards and timezones and basically just wait for it to be installed.

It should be pretty fast as both the ISO file and a virtual hard drive are basically on the same physical drive.

What if VirtualBox window stops respoding after Ubuntu is installed and asks to restart the computer?

If VirtualBox window with Ubuntu (VM) stops responding when Ubuntu asks you to restart the machine, simply EJECT the ISO image. How to do that?

Well, in the "Devices" menu on VirtualBox window, there's a submenu named select "CD/DVD devices...". From that menu choose "Remove disk from virtual device". Then FORCE EJECT. After this operation shut down the virtual machine (you can click on the close button and select "Shut down") and start it again and Ubuntu should load.

Read the VirtualBox forums for more info, for example: VirtualBox 4.2 crashes on Restart after Ubuntu install.

When you shut down and start again, Ubuntu should load normally.

Conclusion

As you can see, Virtualization is a great thing and enables us many great stuff, from simply trying out new operating systems we might like, to for example, having an entire environment for testing on a virtual machine.

This was an introduction and in some other article I hope to dig somewhat deeper to the more advanced topics and help you to explore more of this great potential. Until then, be sure to head over to the VirtualBox FAQ for any questions you might have.

Thanks for visiting and don't forget to leave a comment as this helps me write better articles for you and others.

Comments are closed