This post is part of a series on setting up GNU/Linux distros on your own computer, without reinstalling your computer’s operating system. It is intended for persons completely new to computing who want to discover VMs and GNU/Linux. I list some technical how-tos for Windows and Mac users; I’ll assume native GNU/Linux users won’t have need for such details… If you’re not familiar with GNU/Linux, I’ve written an introduction to help clear up some confusions about it.
This specific tutorial will simply cover recommended system requirements, a brief overview of VMs, and how to setup VirtualBox for the first time. Installing specific distros will be covered in subsequent tutorials.
1) What are virtual machines? What is VirtualBox?
A virtual machine, as its name implies, is not a real machine, but a machine that is simulated by a real machine.
a) The basics of a computer
To put it very simply, your computer is made of a central processing unit (CPU) and runtime memory (random access memory, or RAM), as well as a hard drive and some other odds and ends. Your computer then runs programs – word processors, photo editors, web browsers and the likes. It also runs the operating system, which is a special program to load and manage all others.
All these programs are stored on the hard drive as files. When they need to run, they are copied to the RAM, which is a special place where data can be very quickly processed by the CPU. Files that you work with also need to be copied into RAM whilst they’re being worked with, and when you save, they are written back to the hard drive. When the computer starts up, it loads the operating system from the hard drive into RAM, and after that, the operating system takes care of loading the rest of the programs.
b) A virtual computer
A virtual machine is a special program that your computer can run. We call your own computer the “host computer,” whereas the virtual machine is the “guest.” The virtual machine creates a special space in the host’s RAM area and declares it as its own, and manages a special file on the hard drive to claim as as disk space for the guest – these are the guest RAM and the guest hard drive. It then loads a copy of an operating system into the special RAM space. The guest operating system can only see the guest RAM – it has no way of knowing that it is inside a virtual computer (well, that’s an oversimplified statement, but it will do for our purposes). Similarly, it is aware of a hard drive that it has access to, not knowing that this is actually only a file on a real hard drive in the host.
It is, in other terms, a reality inside another reality. Think of it as in the Matrix movie – consciences inside the virtual reality are fed information that it is the “real reality.” Our purposes are obviously less metaphysical and nefarious, but that is a decent enough parallel.
VirtualBox then is the special program that creates the virtual machine. VirtualBox is an open source virtual machine manager which although backed by Oracle Inc is Free Software (as well as being free of charge – a distinction I will cover later), but there are others such as VMWare’s VMWare Player, which is proprietary but freely available, and QEMU, which is Free Software, but is best used with a GNU/Linux already as host. For the technically inclined, all these are known as Type 2 Hypervisors. I am choosing VirtualBox here because that is what I’ve been using of late, but most concepts translate to the others.
And now, without further ado, let’s get virtualizing!
2) Downloading and preparing VirtualBox
a) Machine specs
Before undertaking this activity, please ensure your computer is powerful enough (“meets the minimum specifications” or “specs”) – it will, after all, be running two operating systems at the same time, and creating a computer-inside-your-computer, the goal of which will be to use it alongside your other applications simultaneously!
- At minimum, you’ll want a machine with at least two CPU cores at 1.6 GHz (gigahertz) and 4 GB (gigabytes) of RAM.
- Ideally you’ll want a 64-bit machine, a CPU with 4 cores at 2 GHz or higher, and 4 GB of RAM or more.
I mention further down “logical processors” – these are analogous to CPU cores, you can read more about them under Hyperthreading. To avoid later confusion, I am not calling them CPUs or cores but processors.
Windows users: you can check these specs by right-clicking an empty space in the Task Bar and bring up the Task Manager. Under the Performance tab, you’ll see graphs for CPU history. The number of graphs (2, 4, 8…) indicate how many logical processors you have.
Underneath the graphs, you’ll see some stats boxes listing, amongst others, Physical memory (MB). This should be over the 4000 mark for 4 GB, over the 6000 mark for 6 GB.
To find out whether your machine is running 64-bit Windows, right-click the “My Computer” icon on the desktop or in the Start Menu (Win XP to Win 7) and check the Properties section. If the operating system is listed as 64-bit, then it is; if nothing is specified, it’s 32-bit.
For Windows 8 users, and if you want to know what the machine itself is capable of, check Microsoft’s help page. (Apologies, I still have not taken the time to learn Win8)
Mac users: go to the Spotlight menu (magnifying glass) in the top right of your menu bar, and search for “Activity Monitor,” and run the Activity Monitor program. In the Window menu, open CPU Usage, and count the number of graphs or gauges that appear (2, 4, 8…) That’s the number of logical processors your Mac has.
At the bottom of the window under the System memory tab, you should see a pie chart, under which is detailed the amount of installed memory.
To find out whether your PC is 32-bit or 64-bit, you’ll need to check the advanced section of the About this Mac window.
Any computer: Any full-size machine (not netbooks or Chromebooks, or any other bottom-of-range laptops) bought new form a shop in the last 2 years should typically have a 64-bit multi-core CPU and 4GB of RAM. You can search the web for options of replacing/upgrading your RAM, or ask an IT shop to advise you. Before proceeding, be sure that at least 2GB of your memory is currently “free” or “available” in your charts as detailed above.
b) Download and install VirtualBox
Go to the Oracle website to download VirtualBox for your operating system. It must match your host operating system. For example, if your computer is running Windows, download the Windows one. You’ll still be able to install guest GNU/Linuxes, guest BSD’s and other guest Windows VMs.
You install VirtualBox like any other program via its installer – accept terms and conditions, opt for normal installation, etc. And hey presto, you’re setup!
3) Downloading a GNU/Linux ISO
GNU/Linux distributions are generally made available via the use of ISO files – these are virtual CDs (more virtuality!) which have the same data patterns as a real CD. Simple ZIP files do not cut it, as they do not simulate such features as found on hardware, such as boot sectors and disk partitions. They can then be used to burn directly to a CD using a special ISO-writing mode, or loaded into a virtual machine as if it were a burned CD.
For now, we’re going to go for a basic and light-weight GNU/Linux distribution: Lubuntu. [Download it at lubuntu.net] It’s optimized so that the operating system uses the least of memory, leaving the rest for use by applications. For the purposes of this excercise, download the 32-bit version, whatever your computer’s architecture. Note that if you are on a Mac, you should still download the “PC” version, since you will be installing it in a VirtualBox virtual machine – which emulates a PC.
You can investigate other distros as well, and I intend to cover some others in this series, but Lubuntu will be sufficient for a first foray if you’re completely new to GNU/Linux.
4) Prepare a virtual machine
Run VirtualBox and you will be presented with the VirtualBox main screen – very simple. You can create and run machines from here, and see an overview of the machines you have. Click the “New” icon to get started.
First you’ll be asked for the name, type and version of the operating system you will be installing in your virtual machine. Type “My First Lubuntu” in the name (or whatever you fancy) and select the type “Linux” and version “Ubuntu” (not 64-bit) if it hasn’t already been detected for you, then click Continue.
Next you’ll be asked to select the amount of memory the machine will be allowed to use. Typical real computers (I write this at the end of 2013) ship with about 4 GB of memory, but this is Lubuntu, a lightweight distro, and it’s just an experiment for now. We’re going to give it 512 MB – we won’t be putting it under stress, so it still runs fine with such low spec. If later on you want to give the virtual machine more memory so that it can run more programs inside it, that will be entirely possible. Set the value to 512 and click Continue.
Now we configure the virtual hard drive of the machine. Firstly, you need to choose a file to serve as a hard drive for the virtual machine. Leave the default (create a new one) and click Continue. Next you will be asked the format – leave the default, click Continue.
Thirdly, you need to specify whether the file representing the virtual hard drive should be created full size from the get-go, or if it should grow gradually. If you choose to let it grow dynamically, it will only take up as much room as it needs to hold virtual hard disk data, and will stop growing as soon as it hits the maximum. If you set its full size immediately, it will take up all that space now, to ensure it ultimately has enough space. In our case, dynamic allocation will do – click Continue.
Now you get to specify the size of the virtual hard drive you will give the machine. This is pretty much set at this moment, so you’ll need to make a guess. For a test machine, 8 GB should be more than enough, but if you expect to use it for a bit more than a toy, go for 40 GB. Up to you really. For this tutorial, I will advise 8 GB. Click Create.
You now have a virtual machine nearly ready to use. Click on the machine name in the left-hand list, and click the Settings icon, then on the Storage tab. You will see the storage devices available to your virtual machine, specifically, the virtual hard drive you just created, and access to a virtual CD drive. Click the “Empty” item in the list, then at the far right click the mini CD icon, and opt to choose a disk file. Choose the Lubuntu ISO that you downloaded earlier. You will see that the “Empty” entry is now the name of the ISO file.
Lastly, click on the Network tab. Ensure “Enable Network Adapter” is checked and “Attached to” is listed as NAT. Click OK to save the changes.
5) Install Lubunutu!
You are now ready to install Lubuntu on your very own virtual machine. Take a deep breath, go make some coffee – or tea – and get ready… for the next tutorial!
Once you hit the start button in VirtualBox, a new window will open symbolizing your virtual computer’s screen. It should hopefully then show you the installer prompt for your distro, and that’s where I’ll be joining you next!