Before you can set up an OpenVPN server, you need a Linux system for it to run on. The virtual machine in VirtualBox is ideal for this: you test everything risk-free on your own computer, and mistakes only cost you a few minutes. In this guide, you set up an Ubuntu Server 16.04 LTS step by step, adjust the hardware and network, and keep the system up to date.
A note in advance: The course dates from a time when Ubuntu 16.04 was still officially supported. The procedure works largely the same way with current Ubuntu LTS versions (for example 22.04 or 24.04). If you are starting fresh, feel free to use the current LTS version.
Key Takeaways
You need VirtualBox and an Ubuntu Server ISO as a foundation. For a server, an LTS (Long Term Support) version is the right choice because it receives security updates over the long term. The virtual machine should run in the "Bridged Adapter" network mode so that it can communicate directly with your host system. After the installation, you need to fully update the system and install the VirtualBox Guest Additions.
Step 1: Download and install VirtualBox
The first step is the virtualization software itself. Go to the official website www.virtualbox.org and download the appropriate version for your operating system. Windows, macOS, and Linux users each find their own package. If you already use Linux, you can alternatively install VirtualBox directly via your distribution's package manager. The installation itself is straightforward and follows the usual pattern of "Next", "Install", "Finish".

Step 2: Obtain the Ubuntu Server ISO
To install Linux, you need an ISO image. On the download page of ubuntu.com you will find the section for server systems. When selecting, be sure to pay attention to the LTS version. The difference is important: LTS versions receive security updates for several years. Non-LTS versions, on the other hand, expire after a few months. If your server is meant to stay in operation for a longer time, an LTS version is therefore the only sensible choice. After clicking "Download", the transfer starts, and shortly afterwards the image is on your hard drive.


Step 3: Create a new virtual machine
Start VirtualBox and click "New". Depending on your system's language setting, the interface may appear in German or English; the steps stay the same. Choose any name for the machine, for example "OpenVPN-Server". The name has no influence on the function. Select "Linux" as the type and "Ubuntu (64-bit)" as the version. The 64-bit variant is recommended because it supports more than 4 GB of RAM.



Step 4: Set the RAM and hard drive
Regarding RAM: for a pure OpenVPN server, 512 MB to 1 GB is sufficient. Use the value that VirtualBox displays as a recommendation as a guide, and take into account how much RAM your computer has in total. A smaller value is also enough for this guide, but more memory noticeably speeds up the installation.
For the hard drive, you create a new virtual hard drive. Choose the VDI format and the "Dynamically allocated" option. This way the file only grows as much as data is actually added, and does not immediately occupy the entire storage space. For an OpenVPN server, 10 GB is sufficient. If you want to run additional services on the same machine later, plan for correspondingly more space.


Step 5: Switch the network to "Bridged Adapter"
This step is crucial for later VPN use. Select the new machine, open the settings, and in the "Network" section switch from "NAT" to "Bridged Adapter". Then select the network card of your host system. This way the virtual machine shares the same network connection as your computer and can communicate directly with it. When you later set up a VPN connection, the server recognizes your host system without additional configuration.

You can leave the remaining settings, such as CPU cores or video memory, as they are for this purpose. However, note: if you allocate significantly more virtual processors than your computer physically has, the machine will become slower.
Step 6: Mount the ISO image and start the server
When you click "Start", VirtualBox asks for the installation medium. Select the Ubuntu image you downloaded earlier and confirm with "Start". The virtual machine now boots from this image, and the installer opens.


Step 7: Set language, keyboard and time zone
The installer first asks for the language. Many experienced administrators prefer English, since error messages and documentation are then directly comprehensible. But you can just as well choose German. Then you define the country and keyboard layout. Select Germany and confirm the keyboard detection. If necessary, test the special characters in the dialog to make sure that Ö, Ä, Ü and the Eszett are in the right place.


For the time zone, the installer usually detects Europe/Vienna or Europe/Berlin automatically. Confirm the selection if it is correct. An incorrectly set time zone affects logs and certificate timestamps later on, so this brief check is worthwhile.
Step 8: Assign computer name, user and password
Give the server a hostname, for example "openvpn-server". Then you define the full name and the username. Choose a secure password, because this account will serve you for administration later. The root user is disabled by default in Ubuntu; you work with sudo instead.


You can decline the encryption of the home directory for this test server. On a server that is not used as a workstation, it brings little in practice and makes automatic startup more difficult.
Step 9: Partition the hard drive
For partitioning, you select "Use entire disk" and enable LVM. The installer then sets up a swap partition and a root partition with the ext4 file system. The default settings are completely sufficient for this purpose. Confirm the overview with "Continue" and then with the confirmation that the changes should be written to the disk.

Step 10: Complete the installation
Now the installer copies the system to the hard drive and downloads current packages from the internet. Depending on your computer and internet connection, this takes about 5 to 15 minutes. You usually do not need a proxy if you are connected directly to the internet.
For updates, you can enable automatic security updates. This makes sense for a server because security vulnerabilities are then closed without any action on your part. In the software selection area, "standalone system utilities" is important. In addition, I recommend the OpenSSH server, with which you can conveniently manage the server remotely later. Make sure to use secure passwords or, even better, key authentication.


You install the GRUB bootloader with "Yes" so that the server can boot from the hard drive at startup. After the installation is complete, you confirm the restart.

Step 11: Install the Guest Additions afterwards
After the restart, you log in with your username and password. For VirtualBox to be able to address the virtual machine optimally, you need the Guest Additions. In Ubuntu, you install them via the package manager. To do so, open a terminal and run the command sudo apt-get install with the appropriate Guest Additions packages. After entering your password, you confirm the installation with "Y". The packages are then downloaded and set up.
Step 12: Fully update the system
A freshly installed version almost always contains outdated packages. So first run sudo apt-get update to update the package lists. Then start sudo apt-get upgrade to renew the installed packages. For kernel updates that require additional dependencies, use sudo apt-get dist-upgrade. If a new kernel has been installed, restart the server with sudo reboot.



After the restart, log in again and check that no more packages are pending for update. If zero software packages and zero security updates appear, your server is up to date and ready for setting up OpenVPN.
Summary – Installing Ubuntu Server in VirtualBox
You have installed VirtualBox, obtained an Ubuntu Server LTS image, and created a virtual machine with suitable memory, hard disk, and a bridged network. Then you set the language, keyboard, time zone, and user account, installed the system, and set up the Guest Additions. With the final updates, you bring the server up to date. This lays the foundation for setting up your OpenVPN server.
FAQ
Why should I choose an LTS version of Ubuntu?LTS versions receive security updates for several years, which is why they are the safe choice for a server that runs permanently.
Do I need root access for this guide?No, you work with your created user account and use sudo when administrator rights are needed.
Why does the network have to be set to Bridged Adapter?The Bridged Adapter gives the virtual machine access to the same network connection as your host system, so that it can later communicate correctly with VPN connections.
How much memory and disk space do I need?For a pure OpenVPN server, 512 MB to 1 GB of RAM and 10 GB of disk space are usually sufficient.
What are the Guest Additions and why do I install them?The Guest Additions are drivers from VirtualBox for the guest system. They improve the performance and the integration of the virtual machine into your environment.
Why should I run updates after the installation?The installation medium often contains older packages. With updates, you close known security vulnerabilities and bring the system up to date.
