
Photo: libre-software.net. License: CC BY-SA 4.0
Install VirtualBox on RHEL, CentOS, AlmaLinux, Rocky Linux or Oracle Linux
Last updated on October 10, 2022
This how-to is about installing VirtualBox on Red Hat Enterprise Linux (RHEL). Provided instructions should also work on CentOS, AlmaLinux, Rocky Linux or Oracle Linux.
It is possible to install VirtualBox from rpm packages, which can be downloaded on the VirtualBox Linux downloads page. However, a yum-style repository is also provided – we’ll use the latter.
Install DKMS, use sudo
Before installing VirtualBox, one should install DKMS, as VirtualBox will build its own kernel module. This howto also supposes that you have added yourself to the sudoers list (of course, you may as well use su or log in as root).
DKMS has some important dependencies like gcc and kernel-devel. Use the following command line to install DKMS and its dependancies:sudo yum install dkms
Install Virtualbox
Once DKMS an its dependencies are installed, we can download and add the repo file to /etc/yum.repos.d/:sudo wget -P /etc/yum.repos.d http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
Finally, VirtualBox is ready to install:sudo yum install VirtualBox-6.1
Add yourself to the vboxusers group using the “Users and Groups” application or the command line:sudo usermod -a -G vboxusers your_user_name
It is possible to use VirtualBox without adding yourself (as a user) to the vboxusers group. If you don’t, some functions may be unavailable, as using USB devices on the guest system.
Run Virtualbox
VirtualBox should now be available in the menu or running VirtualBox. Don’t forget to install the non-free Extension Pack via the “File → Preferences → Extensions” menu.

Miscellaneous: USB, Network drives
If you get problems using USB, take a look at the CentOS Wiki. Make sure your user belongs to the usergroup vboxusers.
To share any folder as a network drive, just enter the following command at the MSDOS prompt:net use x: \\vboxsvr\your_shared_folder
By Johannes Eva, April 2012 – October 2022
This article has been linked on LXer.com and some more…
Picture copyright: chameleon with a red hat, detail from this VirtualBox original artwork, unknown license.
4 thoughts on “How to install a LEMP stack on Ubuntu Server 20.04, 22.04 or 24.04”
Hi Eva…
Thanks for this complete tutorial, it is really very helpful for the community. But, for those who don’t want to bother installing the LEMP stack one by one, you can use the auto installer tools.
For this, I usually use the LEMPer Stack, it might be useful for auto-installing the LEMP stack and at the same time managing a vps/cloud server for hosting PHP websites without the need for cpanel 🙂
LEMPer Stack
This tool is free and open source, you can contribute to its development via the Github repo => https://github.com/joglomedia/LEMPer
Looking forward to your feedback/review..
🙏🏻🤗
MySQL might takeover MariaDB in the near future for at least like WordPress servers, unless Maria gets a lot more money/team size.
See the SlickStack readme https://github.com/littlebizzy/slickstack
However interesting seems Ubuntu 20.04 is now supporting both of them.
On some blogs, I see
sudo service mysql startfor starting mariadb server whereas on other sites I see the command assudo systemctl start mariadb.service.I want to know what’s the difference and which works correctly on Ubuntu 18.04?
Hi, this question is answered in this article, have a look here:
2.4 Test Nginx
Short answer: for basic tasks, use
service.