Join 92,250 users already on read.cash

The Linux operating system - virtualisation, a step-by-step guide for VirtualBox

0 13
Avatar for valo
Written by   30
6 months ago

Virtual reality is an interesting experience where one gets the feeling of being in another world... Wait! Not that kind of virtualisation! I mean the emulation of a Linux installation on top of another operating system. In a sense, it is a virtual reality, as one can perform nearly all actions one would do in a native installation of the operating system.

A user of 3D glasses experiencing a virtual reality. (Picture: Unsplash)

In my previous article about Linux, I described some of the benefits of having a virtual machine (VM), including the ability to run two operating systems in parallel, and portability, in the sense that a VM can be exported and used on another host, while ensuring that everything works exactly as it did on another host computer.

In this example, I will present what it looks like to have a native Windows installation, i.e., the host machine, running a virtual Linux (a guest). This can be done easily by installing VirtualBox. It is a free program which creates and runs a virtual installation of an operating system. It is available for Windows, Linux and Mac hosts and can be used to run a range of operating systems.

https://www.virtualbox.org/wiki/Downloads

The home screen of VirtualBox. The File menu has been clicked.

Installing a virtual machine

So, assuming that you have installed VirtualBox, you also need to download an ISO for the Linux installation. For example, a minimal Debian installation can be obtained from the page

Debian -- Network install from a minimal CD,

however, I am using this just for illustration purposes for this article. I'd normally download the full version,

Downloading Debian CD/DVD images via HTTP/FTP.

In case you're wondering, an ISO is like an archive containing a whole CD or DVD. When they were commonly in use, one could just burn an ISO to a CD or mount it as an emulated CD drive, appearing under My Computer with its own driver letter.

Creating a new virtual machine

You can probably see the big green plus icon in the screenshot of the home screen of VirtualBox that I attached above. If you want to import an existing VM, you should click there, or click on the Import Appliance from the File menu. However, if you want to install from an ISO, you need to click on the blue icon to the left side of the plus. It reads New. A window opens, asking for the name, path and the version of the new VM.

The window that appears when creating a new virtual machine.

Here you need to enter a name for the new VM, it can be anything really. Then you need to specify the directory where the VM will reside. This is disk space dedicated to it. Make sure that you don't end up filling your boot drive (C: on Windows). Then under Type there is a drop-down menu where you need to choose Linux from the available options. In the next drop-down menu, Version, I choose Debian. Having done that, the Next button becomes available.

RAM memory

In the next step, you need to select the amount of memory allocated to VM. In my case I can give it the recommended 1024 MB. Giving more memory is, of course, good, however, you need to leave enough for your main system, too, otherwise everything will be running really slowly as the computer starts using space on the SSD/HDD (called swapping), which are significantly slower than the native RAM.

The second step is to select the amount of RAM memory to allocate to the VM.

Hard drive

I don't have any existing virtual hard drives, so I will create a new one. It recommends that I use 8 GB. Even though that's quite little, it will do for my minimal installation but I definitely would take much more for a production system.

The first step in creating a virtual hard disk

Then it asks about the type of a virtual hard disk. I again will stick with the default because I'm not planning to use it with a different virtualisation program. VHD can be opened with other programs, too, such as VMWare, so it increases the portability. Afterwards, you need to select whether the disk space should be allocated dynamically or as a fixed size. Dynamical allocation in this context implies that if in the previous step I asked for 50 GB of disk space for my VM, the virtual disk will only grow to its size as needed. If I don't install any huge programs and keep thousands of big files, then it will remain smaller. I'd definitely take this option. I haven't personally compared how slower it would be as they say but they're the developers, so certainly they are right.

Choosing between a dynamically allocated or a fixed-size virtual disk.

The thing with disk space is that actually, later on you can mount the disk of your host system and access all files there. This is how I was using my VM before I switched to the Linux subsystem for Windows.

In the next step, you need to enter the actual size of the disk. As I said, I will go for the recommended 8 GB for my example but you should add more. And that's it, the VM is created!

Choosing the size is the last thing to do.

Starting the newly created virtual machine

After clicking Create, the window vanishes and we are back to the home screen. Now on the left I see my newly created VM which I called Debian mini. On the right-hand side, I see all the parameters that I selected. Modifications can be done by clicking the orange cog icon for Settings. The amount of RAM memory, the number of allocated CPU cores, and many other hardware parameters can be changed.

The home screen of VirtualBox after a new virtual machine was created.

Let's start our system

The Start button should do right? Well, no. We have to install the operating system. At the moment there is nothing to boot. Remember how in the not-so-recent days, the OS came on a CD. I hinted earlier that an ISO file is like an archived CD that can be mounted. This is exactly what we're going to do.

Clicking on the Setting button opens the window below. On the left-hand side there is Storage, highlighted in gray after I clicked on it. There I have clicked on Empty under the Controller: IDE. This makes it possible to select the ISO file on the right-hand side of the window. I have clicked on the blue magnifying glass icon and from the drop-down menu I select Choose a disk file. Then I need to locate the ISO file I downloaded earlier. With that done, I press OK and I'm ready to start the VM and the installation.

Mounting the ISO file with the Debian installation.

This became a really long article but I hope that the screenshots help newbies install their first VM. Have fun with Linux and if you run into issues, you can ask in the comments below. Is there something that I should explain more clearly?

4
$ 7.81
$ 7.80 from @TheRandomRewarder
$ 0.01 from @Mictorrani
Sponsors of valo
empty
empty
Avatar for valo
Written by   30
6 months ago
Enjoyed this article?  Earn Bitcoin Cash by sharing it! Explain
...and you will also help the author collect more tips.

Comments