Speed up a Fedora Linux VM on VirtualBox
| Lastmod: 2019-09-12
Does your freshly created VirtualBox Fedora Linux VM feel slow? Mine sure did. After much trial and error over many days, the following steps worked for me to speed things up.
At the time of this writing, I was using Fedora Workstation 28. If you've never installed Linux on a VirtualBox VM before, see the Fedora Magazine article on how to install Fedora as a VirtualBox guest.
Storage Space #
When first creating the VM, make sure the hard drive is at least 20GB. This leaves enough room for OS-specific files, and files added by you, assuming you're not doing anything crazy where you need loads of storage space.
Give the VM at least 2GB of RAM. While the VM is powered off:
Settings > System > change the value of Base Memory.
CPU Execution Cap #
Set the VM's CPU Execution Cap to 100%. While the VM is powered off:
Settings > System > Processor tab > change the value of Execution Cap.
Video RAM #
Max out the VM's Video RAM to 256MB. VirtualBox limits you to 128MB in the GUI, so you have to do it through command line. While the VM is powered off:
/Applications/VirtualBox.app/Contents/MacOS/VBoxManage modifyvm "<VM_NAME>" --vram 256
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "<VM_NAME>" --vram 256
Then confirm the Video RAM settings:
Settings > Display > confirm the value of Video Memory.
3D Acceleration #
Disable 3D Acceleration on the VM. In a nutshell, VirtualBox has issues with 3D support for X11 guests. For details, see this ask ubuntu discussion and this VirtualBox wiki post. While the VM is powered off:
Settings > Display > uncheck the Enable 3D Acceleration checkbox.
Guest Additions #
Install Guest Additions on the VM. While the VM is running:
Devices > Insert Guest Additions CD image… > then follow the prompts.
If this doesn't work for some reason, you can download the Guest Additions directly to the VM from VirtualBox.
Xfce Desktop Environment #
By default, Fedora uses the GNOME Desktop Environment. While GNOME is pretty to look at, unfortunately it isn't handled well by VirtualBox (see the 3D Acceleration section above). So, while all the previous items helped, what really got my VM blazing fast was installing the Xfce Desktop Environment. Quoted from their site:
Xfce is a lightweight desktop environment for UNIX-like operating systems. It aims to be fast and low on system resources, while still being visually appealing and user friendly.
While the VM is running, to install Xfce:
sudo dnf install @xfce-desktop-environment
- Reboot the VM
- At the login screen > click your username > click the Session menu (the gear icon) > Xfce Session
Once your Xfce Session is started, to add applications to your dock: click Applications in top left, then drag-n-drop the applications you want into the dock.
I'm happy to say that my VM actually feels snappy now.
Next: Use Visual Studio Code as your default text editor for Git
Previous: Script to install latest hugo release on Linux and Mac