VirtualBox Server

Jarret B

Well-Known Member
Staff member
Joined
May 22, 2017
Messages
339
Reaction score
369
Credits
11,691
The article is not about a server running VirtualBox like a desktop system. It is different from a Linux Terminal Server.

A VirtualBox Server is a Server that is running a headless version of VirtualBox. It allows network systems to create and run machines remotely. These machines are not read-only like with Linux Terminal Server. With proper applications, any network system can run a machine from the Server.

Basically, consider this one machine containing all of you VBox machines in one place. Personally, I have multiple machines and nearly each one has VirtualBox on it. Each system then has its own machines. With the VirtualBox Server, all machines can be run from any system without needing VirtualBox locally.

Setting up the VirtualBox Server

For the system I used, I had a Dell Optiplex 7010 which has an Intel Core i5 with 8 GB of RAM. Granted, if I had a better system available, I would use it, but this seemed to work fine. I did not have multiple systems connecting to it, though. The network speed is 1 Gb and it helps. I installed Ubuntu 22.04 Server. The installation was a regular one. The only main change I made was to select the “Ubuntu Server (minimized)”. Since the Server will run headless, we do not need all the extra applications.

NOTE: A headless system is one that will not require a monitor since it will rarely be physically logged in to with a directly attached keyboard. Nearly all connections will be done remotely, including administrative tasks.

After the Server is installed, you then need to perform some updates and package installation. After rebooting, log into the server and run:

sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo apt autoremove -y


The extra packages we need to get installed for VirtualBox require this command:

sudo apt install dpkg make perl gcc -y

NOTE: If you want, you can install and configure a Samba share for placing files on the server as needed. I will cover the need for this later. It is not required, but it can help reduce time in moving needed files around.

Now, we are ready to get the headless VirtualBox services installed. To do this, we need the proper files.

From a second system, use a browser to go to the website ‘https://download.virtualbox.org/virtualbox/’. Here, you should see a list of versions. When I wrote this article, the newest version was ‘6.1.36’. Check and see if there is a newer version, and if so, make a note of it. Within the folder should be listed the installation files. You can download the file from the second system and copy it over, or just make a note of the filename. My filename was ‘virtualbox-6.1_6.1.36-152435~Ubuntu~jammy_amd64.deb’.

The file I made not of is for Ubuntu Jammy Jellyfish (22.04).

If you do not download the file from a second system, then you can get it from the server with the command:

wget https://download.virtualbox.org/vir...lbox-6.1_6.1.36-152435~Ubuntu~jammy_amd64.deb

Make sure you type the filename exactly as the filename is on the server.

Once the file is downloaded, you need to run:

sudo dpkg -i *.deb

The command will install the ‘.deb’ file that you just downloaded. There should be no other ‘.deb’ files if this is a new install. If you want, you could make a directory for the file, which would be empty, and use the ‘wget’ command inside the new folder.

The installation should not take too long and should produce dependency errors. We can easily fix these.

The next command, to fix the dependencies, is to run:

sudo apt install --fix-broken

All the needed dependency files will be downloaded and installed.

You need to be in the same folder as the ‘.deb’ file you downloaded and perform another install with the command:

sudo dpkg -i *.deb

Everything should have come out fine this time.

You will need to add a user to the ‘vboxusers’ group that was created during the installation of VirtualBox. If you want to use your current user account, then run:

sudo usermod -aG vboxusers $USER

If you want to add another account, or a different one, replace ‘$USER’ with a specific username.

Now, we need to add an extra to provide better system support for the users.

VirtualBox Extension Pack

To get the full capabilities of an Operating System in VirtualBox, you need to install the Extension Pack. First, you need to download it.

From the Server, run the command:

wget https://download.virtualbox.org/vir...VirtualBox_Extension_Pack-6.1.36.vbox-extpack

Remember, you may need to change the version number to match the healdess VirtualBox download you did previously.

Now that VirtualBox is installed, we can install the Extension Pack with:

sudo vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.36.vbox-extpack

Configuring and Starting the VirtualBox Service

On the server, we need to set up the ability for VirtualBox to make a log file. The folder will need to have the proper permissions or else the service cannot access the directory. Perform the following:

mkdir -p /var/log/virtualbox
chown $USER:vboxusers /var/log/virtualbox


The second command will use the current user as the user account to grant permission. You can change the variable to an account name that you need.

Edit the file ‘/etc/default/virtualbox’. The file may exist and if it does, add the following (if the file is empty, just place in these lines):

VBOXWEB_USER=“username you prefer”
VBOXWEB_TIMEOUT=0
VBOXWEB_LOGFILE=“/var/log/virtualbox/vboxweb.log”
VBOXWEB_HOST=“IP Address of server”


Make sure you use the same username that you used previously for the USER. Use the command ‘ip a’ to find the address of the server.

Next, you will need to start the service and enable it to auto-start when the system restarts:

sudo systemctl start vboxweb-service
sudo systemctl enable vboxweb-service


You can check the status of the service with the command ‘sudo systemctl status vboxweb-service’. If the service shows ‘exited’, then make sure you typed all the lines correctly in the file ‘/etc/default/virtualbox’. If any of the lines are typed incorrectly, the service will cannot run.

The service should now run and we are done with the server, unless you need to copy over ISO files used to install a VirtualBox Machine. The files need to be placed in the Home folder of the USER that you gave permissions to in the above steps.

Setting Up a Client System

On the client systems, you need to install some dependencies first:

sudo apt install libgtk3-perl libsoap-lite-perl freerdp2-x11 tigervnc-viewer -y

Once you have these installed, you can easily go to ‘http://remotebox.knobgoblin.org.uk/downloads’ and get the latest version of RemoteBox. The current version when I wrote the article was 3.1.

Once you have the file, you can uncompress it through your Graphical User Interface (GUI) or from a command-line:

bunzip2 RemoteBox-3.1.tar.bz2
tar xvf RemoteBox-3.1.tar


Now that the files are uncompressed, you can change to the folder ‘RemoteBox3.1’ and run the executable ‘./remotebox’.

Once the GUI starts, you will need to enter the following:

URL: <IP Address of Server>
Username: <user name you set up on the server>
Password: <password for the user you set up on the server>


You should have a window similar to that in Figure 1.

Figure 1.jpg

FIGURE 1

The first thing you need to do is set up the required installation (ISO) files for the machines you will create. Make sure you have placed at least one ISO file on the server.

Go to File and select Virtual Media Manager and click on the ‘Optical’ tab, pictured in Figure 2. Add the ISO files as I have done on my system in Figure 3.

Figure 2.jpg

FIGURE 2

Figure 3.jpg

FIGURE 3

If you installed the Extension Pack, then it should appear with the other ISO files you added. If you do not add an ISO file in the Virtual Media Manager, then your new machines cannot access to install the OS. The ISO files must be local to the server and not to the client. Virtual Machines are created and stored on the Server. Click on ‘OK’ and you will go back to the main screen.

The main screen will appear similar to the standard VirtualBox screen, with a few slight exceptions, but everything should be easy from here.

Let’s go through setting up a machine. I download the Kali 2022.3 ISO, among others, but we’ll try Kali.

After selecting ‘New’, you can fill out the new window similar to Figure 4. Make any changes you need before clicking ‘Create’. Once the window disappears, you should then see a new entry for your Kali machine.

Figure 4.jpg

FIGURE 4



Select the Kali machine and then click on ‘Settings’. Make the rest of your changes as you normally would on VirtualBox. After you make all the changes you prefer, click on ‘Save’.

NOTE: Do not make any changes on the ‘Display’ tab for ‘Remote Display’. These settings are automatically set for each machine you create.

Conclusion

RemoteBox is a very neat concept that allows you to keep your machines centralized.

VirtualBox has a built-in function to control a machine remotely, but you must create the machines locally to the server.
 

Members online


Top