Running Linux Mint - Or Any Operating System! - As A Virtual Machine With VirtualBox

in #linux8 years ago

Screenshot 2017-09-23 12.48.40.png

In my previous Linux tutorials I've shown how you can load an installation of Linux Mint onto a thumb drive and use that to try it out without making any permanent changes to your PC.

This is a great way to try out Linux and see if it's "for you." (Spoiler alert - it is!) You can use the pre-loaded software to do work, configure it the way you like, and even install new programs to try. If you wind up breaking anything, no worries. The system just goes back to its original configuration the next time you start it up.

But say you want a more permanent installation, so that those programs you installed and those changes you made to your desktop will be there next time you boot up. What if you're not yet willing to give up on Windows just yet?

Well, there are several options:

  • Install Linux on a computer you aren't using any more. It runs great on older hardware, breathing new life into systems that would otherwise be abandoned.
  • Dual-boot. This partitions your hard drive and installes a "boot manager," so when you start your computer it asks whether you want to load Windows or Linux. I've done this in the past, but I have to say that using that boot manager can be finiky sometimes. Plus a lot of computer manufacturers use complicated partition schemes on Windows sytems already, hiding sections of your drive to handle backup and recovery. This complicates the task of adding a new partition. If you've got a smaller drive to start with, space can be a real issue.
  • You can install Linux inside a Virtual Machine within Windows.

I used to think this was kind of silly. Why go to the trouble of running an operating system within another operating system? It means you've got to boot your computer up twice, right?

Well... kind of. It also gives you a tremendous amount of power over your system. It didn't take me long to become a convert.

Here's why I love trying out Linux distributions inside a virtual machine:

  • The VirtualBox software is completely free and open source. You can use it to host virtual machines on a Windows or a Linux computer.
  • It allows you to run Linux (or any other operating system) within a window or full-screen, and seamlessly control the guest with the same mouse and keyboard you're using for the host.
  • You can experience Linux and Windows at the same time - without waiting for a re-boot when you want to switch from one to the other.
  • You can control what system resources you delegate to these "virtual machines."
  • You can start and stop the virtual machine whenever you like. Other than the hard drive space it takes up, it only uses system resources when you run it.
  • You can install several virtual machines and call on any of them when you need them. Got an old piece of hardware that only runs on Windows XP? Put XP inside a virtual machine and start it when you need it!
  • You can shut down, hibernate, or freeze the virtual machines in any state, setting aside your work for later. You can even take system snapshots before trying out something you're nervous about, and easily restore a previous state with a click.
  • Booting a virtual machine is amazingly fast. I'm not sure why it starts so much quicker than the regular PC, but it does.
  • Even installing the guest operating system only takes a few minutes. You can install directly from the .ISO file (the disk image file) for your distribution, without having to burn it to a disk or use Pen Drive Linux to install it to a thumb drive.
  • You've got an added level of security. Linux is already extremely resistant to viruses, but anything that goes wrong within the virtual machine is essentially quarantined from the main one.
  • You can, of course, encrypt the home folder and files of your virtual Linux computer just as you could with a "regular" install, for yet another level of security.
  • Un-installing and removing the guest operating system when you're done is trivially easy - much, much easier than removing an unwanted partition and then trying to clear up that space on your system.
  • If you become a Linux junkie like me, you can try out new distributions in minutes.

That's the end of my pitch. If you're still reading, you want to try it out.

This may look like a long tutorial, but that's only because I shared so many screenshots. Essentially we just need to do two things: install VirtualBox, and then install Linux inside a virtual machine. Both of these things are free and fun, and really don't take a lot of time.

Install VirtualBox

Go to https://www.virtualbox.org/wiki/Downloads and click "Windows hosts." The download of the VirtualBox installer should start automagically.

Screenshot 2017-09-23 10.20.29.png

Now go into your downloads folder and double-click the Virtual Box program you downloaded. Mine was called VirtualBox-5.1.28-117968-Win.exe.

The setup wizard is pretty self-explanatory. I had to click to authorize the installation within Windows, and again to get past a warning for a component that lets VirtualBox work with USB, and another that wanted to temporarily disconnect my network connection. All of that seemed fine to me.

Here's a few quick screen-shots for completeness:

Screenshot 2017-09-23 10.33.50.png

Screenshot 2017-09-23 10.37.35.png

Screenshot 2017-09-23 10.38.07.png

When it's done, the installer will run VirtualBox automatically. Here's what the main interface looks like.

Screenshot 2017-09-23 10.43.11.png

This is where we can install virtual machines with different operating systems to our heart's content (so long as we have the hard drive space for them.) But as you can see, we haven't installed any yet.

Installing Linux within the Virtual Machine

If you don't already have one, fire up your browser and grab an ISO of the Linux distribution you want to run. As usual, I recommend starting with Linux Mint. You can find links for the download at https://linuxmint.com/download.php. Here's a screenshot of the download page. I'm going to try the 64-bit version with the Cinnamon desktop this time. If you've got a slower computer or less than 4 GB of RAM, I'd recommend the MATE or Xfce desktop. And if you aren't sure whether you've got a 32 or 64 bit computer, go with the 32-bit version.

(I went into more detail about obtaining a Linux Mint ISO in this tutorial.)

Screenshot 2017-09-23 11.48.25.png

Now go back to the Oracle VM VirtualBox Manager. Click "New," and it opens a wizard for configuring your virtual machine. I thought I'd name mine "Minty Machine," but then I changed that to "George" after I took the screen shot. Call yours whatever you like.

For Type I selected "Linux." There was no selection for "Mint" under Version, but I know that Mint is based off the Ubuntu distribution, so I selected "Ubuntu (64-bit)" Remember to choose "Ubuntu (32-bit)" if you downloaded a 32-bit ISO.

Screenshot 2017-09-23 10.44.26.png

It suggested I allocate 1024 MB of my RAM to the virtual machine, but since my laptop has 8 GB available overall I decided to double that to 2.

Screenshot 2017-09-23 10.48.21.png

For my "Virtual Hard Disk" I went with a fixed size disk because I have plenty of space on a secondary drive, and I liked the sound of the fixed drive being "often faster to use." I used the little folder button to select the drive I wanted, and created a folder called "VirtualMachines" to keep my installations in. For Hard Disk "type," I went with their suggestion. For the size, I increased to 15 GB from their suggested 10. 10 probably would have been plenty, but since I have the space available I figured I'd leave it some breathing room.

Screenshot 2017-09-23 10.50.38.png

Screenshot 2017-09-23 10.50.53.png

Screenshot 2017-09-23 10.51.47.png

Screenshot 2017-09-23 10.54.38.png

(Here's an idea: if you're someone who's really concerned about privacy and security, you could install your virtual machine to a thumb drive, and pull it completely out of the computer when you weren't using it. You could encrypt the installation, and then encrypt the files within that installation! But I digress...)

It took a couple of minutes to create the virtual drive. If I'd been putting this on a solid state drive instead of a mechanical, spinning one, it probably would have gone much faster.

Now that's done, you can see in the VirtualBox manager that my George machine is present and powered off.

Screenshot 2017-09-23 11.03.18.png

I haven't actually installed Linux Mint to it yet, though. So when I click Start, I get this message.

Screenshot 2017-09-23 11.05.25.png

Now I'm going to click on the little folder and navigate to the Linux Mint ISO I downloaded. I selected it and it started loading immediately! Because an ISO file is already a virtual disk, the machine boots from this file just as if you'd put it on a CD and stuck it into a new computer!

Screenshot 2017-09-23 11.10.47.png

Now, if you've read my tutorial about booting Linux from a thumb drive, you'll recognize what's going on here. Right now we have a virtual computer within this window, running a live installation of Linux Mint just the same as if you'd booted a regular computer from a Linux Mint CD or thumb drive!

But since the whole point of this exercise is to get a full, permanent installation running within this "Virtual Machine," we're going to go ahead and click the desktop icon that says "Install Linux Mint."

This is a pretty straightforward process. Start by selecting your language.

Screenshot 2017-09-23 11.18.34.png

On the screen that asks if you want to "Install third-party software for graphics..." and so on, I clicked the check box. If you have philosophical objections to running any proprietary software on an open source virtual machine, you can leave this blank. If you don't know what I'm talking about, just check it and move on.

Screenshot 2017-09-23 11.19.04.png

When it asks about installation type, you DO want to erase the disk and install Linux Mint. Remember - this only refers to the virtual disk you created when you set up VirtualBox. I'm going to go ahead and encrypt the installation. This secures it at the disk level, making the whole damn thing secure. I'll do the LVM thing as well, since encrypting forces me to select that check-box too. Then I'll click "Install Now." If you decide to encrypt as I did, you'll have to come up with a password. Remember it or write it down! (But you're reading this on Steemit, so you already know the importance of keeping track of your passwords - right?)

Screenshot 2017-09-23 11.24.58.png

After a screen to select your time-zone and keyboard type, you'll get to name your installation and pick your regular log-in password too. And, yes, it looks like you can encrypt your home folder within the encrypted installation. This is probably overkill, but I'm going to try it just for shits-and-giggles. I kind of want to see if I even notice how much it slows down the virtual machine.

Screenshot 2017-09-23 11.28.42.png

After that, sit back and wait while it installs the system. It was done in four minutes! (This is mind-boggling to me. I spent two whole days just updating Windows 7 on my wife's new computer.)

Screenshot 2017-09-23 11.52.26.png

When you click Restart, it will prompt you to remove the installation medium and press enter. You don't actually have to remove anything. Just press Enter and VirtualBox will reboot the virtual machine.

Because of my double-encryption shenanigans, I had to go through the following two screens to log in. Depending on your choices, you might not have to do this.

Screenshot 2017-09-23 12.09.04.png

Screenshot 2017-09-23 12.11.37.png

Less than a minute later and we're up - running a fully encrypted computer within a computer!

Screenshot 2017-09-23 12.14.56.png

I'm going to un-select the box for "Show this dialog at startup," but feel free to explore some of those links if you like. Otherwise, you can close that welcome screen and get to using this Linux Mint computer just like any other computer!

When you're finished and you want to shut down your virtual machine, you can do this with the Linux Mint menu, just as you would normally. This will kick you back to the Oracle VM VirtualBox Manager, where you can see that your new installation has powered off. It's ready to be started again whenever you like.

But before you do this, have a look at some of the menus in the interface - in particular the Machine menu. It's got some neat options for taking system snapshots, as well as pausing the system, doing a re-set, or a full shutdown - analogous to hitting the power button on your physical computer. Another neat function: if you close a running VirtualBox window with the "x" in the upper right corner, it offers to "save the machine state." If you do this, you'll be able to restore the system from where you left it with the VirtualBox manager next time you need it. Everything you left open will be preserved. (But keep in mind that this also leaves it unlocked, bypassing the login for encryption, so if security is a concern you should still do a full shutdown.)

One final tip. VirtualBox makes use of a "host key." By default, this is the "Right Ctrl" button. This key can be critical for passing control between the host operating system and the guest. If you're trying to type something in Windows and your text keeps going into the Linux guest, or if your mouse cursor gets locked inside the virtual machine's window, try pressing the right control key to pass the input back to windows.

You'll also notice that a lot of the keyboard shortcuts in the menu use a key-combination with the host key - like "host-F" for full-screen mode! This is a pretty sweet feature. I've been known to run a virtual Linux installation full-screen on a second monitor while plugging away with Windows on the first. It's truly the best of both worlds.

Thanks for following along with the tutorial - or just reading it to share in the experience! Please let me know if you decide to try it. And if you run into any hiccoughs along the way, tell me that, too.

Don't be afraid to experiment. Remember, you can delete these virtual machines in a second and try again, so there's really nothing to break.

Have you used virtual machines before? If they're already a part of your work, how do you incorporate them into your work-flow?


Previous Linux-Related Posts and Tutorials


Why I Use Linux Despite The Occasional Frustration And Inconvenience
Try Linux For Free By Creating A Bootable Thumb Drive - For Absolute Beginners
Running A Linux Live Session From A Thumb Drive - A No-Fear Tutorial For Absolute Beginners
I Made Crappy Paintings with Krita To Show You Can Make Art And Have Fun With Linux
Installing Software on Linux is Magically Easy and Free - The Bounty of Open Source (Part 1)
The Bounty of Open Source (Part 2) - The Magic Of Installing Software from the Command Line


CLICK HERE FOR ALL OF MY POSTS ON STEEMIT, SORTED BY CATEGORY.

Coin Marketplace

STEEM 0.13
TRX 0.35
JST 0.034
BTC 115494.13
ETH 4597.67
SBD 0.85