In this article, you'll learn how you can use virtual machines on Linux while having fun with vintage games.
If you have an Android phone, one of your guilty pleasures might be playing some very entertaining games. Or it could be that there is an application that only runs on your phone.
And then you think – what if you could run the same games on your desktop PC?
To simplify the scenario, let's assume the applications run on Android.
One approach to solve your problem is to run an Android emulator on your PC. But some of them, like Android-x86, require rebooting your machine so they can take control of the hardware.
If you don't mind a small performance hit you can run a virtual machine at the same time as your native operating system. Specifically on Linux, there are several choices, like QEMU and VirtualBox, to name a few.
By the end of this article you will be able to do the following:
- Install VirtualBox on Fedora Linux
- Run android-x86 and finish the basic setup
- Install an application from the Google Play Store, just like on your phone.
Before you start, I assume that you have the following:
- Ability to run commands as the superuser (like SUDO)
- An account on Google.com, so you can use the Play store from within the virtual machine.
How to Install VirtualBox
The first step is to install VirtualBox. For practical purposes, our installation will be basic, just enough to run our games:
sudo dnf install -y kernel-devel kernel-devel-5.14.18-100.fc33.x86_64
curl --remote-name --location https://www.virtualbox.org/download/oracle_vbox.asc
sudo rpm --import ./oracle_vbox.asc
sudo dnf install -y https://download.virtualbox.org/virtualbox/6.1.36/VirtualBox-6.1-6.1.36_152435_fedora33-1.x86_64.rpm
sudo dnf install -y virtualbox-guest-additions.x86_64
How to Install the Android-x86 ISO
The first step is to download the ISO image from Android-x86. This ISO contains the Android operating system that will be installed on our virtual hard drive.
After that we can set up our virtual machine like this:
A few things to note:
- After booting the first time, I found that 1GB for the Android image was not enough. Performance improved a lot after I bumped the ram to 3GB.
- Another change was the 'Graphics Controller'. Originally it was VMSVGA but then Android refused to start in graphic mode, so I switched to VboxVGA and it worked.
- 2 CPUS and 8GB of disk space were enough for my game.
- Finally, I specified that the IDE controller was the android-x86 ISO.
To start the virtual machine, you click the 'Start' button on the GUI, and then you will have to make a few decisions like bootable partition:
Once this is done you can choose your new partition to perform the installation:
Then the installation will proceed:
After the installation is complete, you can shut down the virtual machine.
Now you'll need to go to the advanced options and select the virtual disk (instead of the ISO image) to boot:
After that, Android will ask you some basic setup information, just like it does on your phone. The final result may look like this:
How to Install Games from the Google Play Store
And now, success! We got the game up and running.
What Did We Learn Here?
- We managed to install a virtual machine engine and successfully run the Android operating system along with our regular Fedora OS
- You saw how you can try and discard whole operating systems' setup, without going through the hassle of setting up a dual boot system with Grub on Linux
Another nice feature of running the game inside a virtual machine is that you can fully freeze the game, then come back and restore it at exactly the same point where you left it.
Finally, you can do many more things with a virtual machine than just running games, for example:
- You can analyze malware safely, run un-trusted applications, and contain any damage they can cause.
- Try a new operating system version before deciding to commit a proper installation (not a big issue these days as most of them provide a lice CD you can boot to try), but this is still very convenient.
- Be able to run multiple operating systems simultaneously, without rebooting your machine. You most likely will start trying more advanced options of your virtual machine of choice, like VirtualBox.
Playing games on your PC is a gateway for learning more complex stuff later. Also the fun factor is undeniable. Enjoy!