I only got two lessons of Linux in class and I got kind of hooked. I wanted to do more with Linux. And because I’m a gamer, I decided to try and install games on Linux. After some trying out and fiddling around I was finally successful in installing a few games on my Ubuntu 14.04 server. So, in this tutorial I’ll also teach you guys how to install the Guest Additions. I installed it to, but I don’t know 100% if it’s actually needed. Anyways, enough stalling, let’s start.
- A working VirtualBox installation. If you don’t have that yet, get it here.
- A working Ubuntu 14.04 or later server. If you don’t have that yet, get it here.
- The GuestAdditions ISO. If you don’t have it, you can download it for version 4.3.20 here.
- Your Ubuntu install should be able to connect with the internet. I use NAT in the settings and it works. Also your Ubuntu VM needs a cd-rom drive. If you don’t have it yet, the error that pops up then explains it quite clearly how to add one.
How to do this?
Part 1: Guest Additions
Step 1: Update apt-get
After you log in into your Ubuntu server, type in the command:
sudo apt-get update
Then give in your sudo password and wait a while until you can give in commands again. This updates the apt-get program in Linux. This program is used to install, update and get software from the internet. I might be wrong, but that’s what I used it for.
Step 2: Install 2 pieces of software to get Guest Additions running.
After you updated apt-get, let’s use it to now have install two pieces of software that you need in order to run guest additions.
sudo apt-get install dkms
sudo apt-get install build-essential
Together they take around 50-60 MB if I remember correctly. You will have to allow both installations by simply hitting the “y” key. This installation takes a minute or five.
A good suggestion is that after the two installs, you reboot your virtual machine. You can do this in two ways. You could either shutdown the VM and restart it by using:
sudo shutdown -h now
Or just let the VM do the job for you by:
I didn’t need to enter my password, most likely since it still remembers it from the install of the programs.
Step 3: The CD.
After you downloaded the Guest Additions ISO file (I linked it more above in this post), you go to your VM and under the “Devices” tab, you pick “CD/DVD” and click “Choose a virtual CD/DVD file”. (note: I don’t know if it’s going to say that. My installation is in Dutch, so if it’s not 100% that, but something similar, forgive me.)
Then locate where you downloaded the Guest Additions ISO and click it so you can insert it in your Ubuntu. If there is an error message that VM doesn’t have a CD-ROM drive, read it and fix it. Be careful, in order to change those things you will need to shutdown the VM, otherwise the changes won’t be saved.
If there is any other error, try to allow it. Since I inserted the CD before I installed the two programs in step 2, I was a bit too quick, I got an error. I don’t remember what it said but I accepted it and I got it still working.
I know that the bottom says: “Install Guest Additions”. But when I used that, my installation wouldn’t find the CD after I mounted it. (I’ll explain that in the next step.) So yeah, that’s why I do it this way.
Step 4: Mount the disc.
After you got the disc in, you should go to your root and then to the media folder. I don’t go it the quickest way, but it’s the way I know it works. To experienced users, feel free to leave me a comment how to do it more efficiently.
You can see how I got there in the screenshot here. Ignore the first command to change my directory, I typed it wrong.
Confirm that there is a directory named cdrom. When you don’t have that directory there, make it. With mkdir cdrom of course. If you are having trouble, this tutorial is a great way to help you out.
Then you mount the ISO file you added in the previous step. This you can do by entering this command:
sudo mount /dev/cdrom /media/cdrom
When it’s successful, you should get the message: “mount block device /dev/sr0 is write-protected, read only.”
Step 5: Install the Guest Additions.
Now, get yourself into the directory /media/cdrom. When you list (using the ls command) the file there, it will list various files that start with VB. A few other files too. Those are all in the ISO you just mounted.
Now in order to install the guest additions, you simply do this command:
And you hit enter. Then it installs. For me, it took 2 minutes. The final line will most likely say that it couldn’t find X.org and such. Just ignore that. Since it’s the part of the guest additions when you would have used a GUI interface. Since we are using a command line interface, it isn’t working of course.
Part 2: Installing games
When you are going to install games, you will need to search online for them. While I have no clue (yet) how to install games you downloaded from an external website, I found out that many websites gave a command how to install it.
When you installed a game, you can run it by simply entering the name. You can also see a list of your installed games when you enter the command:
The directories with a yellow color behind it, are executable games. Just enter the name in order to run. When you want to uninstall a game, you remove the directory as a superuser. If an experienced user facepalms, feel free to leave a comment how to do it better.
Update 29/01: I found out how to uninstall games. It’s with this command:
sudo apt-get remove <gamename>
Then your game will be removed.
I also found out that when you list, not every executable game is highlighted in yellow. So, that trick doesn’t work.
Anyways, that concludes my tutorial, thanks for reading and if you have issues, feel free to leave a comment. Even while I don’t know a lot about Linux server yet, I’ll do my best in order to help you out. It will be a nice learning experience for me. In any case, enjoy!