Install OpenVPN Access Server In A Proxmox Container

We can install OpenVPN Access Server on Proxmox using a Container. I find this preferable to using a VM as it is much more resource-efficient.

Connect to your pve. Replace pve with the hostname or IP address of your Proxmox server. You can also access the shell from the webgui.

ssh root@pve

We’ll use pveam to manage LXC container images. You’ll need the Ubuntu 20.04 (Focal Fossa) for this install.

pveam update
pveam download local ubuntu-20.04-standard_20.04-1_amd64.tar.gz

From there you can head back to the webgui to create your container based on Ubuntu 20.04. Before we start it, there are a few updates we need to make to the container settings.

Edit container configuration. I’m using vim, but nano works. My container ID is 100, but yours will likely be something else.

vim /etc/pve/lxc/100.conf

Add the following lines at the end.

lxc.cgroup.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net dev/net none bind,create=dir

For your unprivileged container to be able to access the /dev/net/tun from your host, you need to set the owner by running this command.

chown 100000:100000 /dev/net/tun

Now we can start the container and enter it. This can be done from the shell or from the webgui.

pct start 100
pct enter 100

Run the following commands to install OpenVPN Access Server.

apt update && apt -y install ca-certificates wget net-tools gnupg
wget -qO - https://as-repository.openvpn.net/as-repo-public.gpg | apt-key add -
echo "deb http://as-repository.openvpn.net/as/debian focal main">/etc/apt/sources.list.d/openvpn-as-repo.list
apt update && apt -y install openvpn-as

Reset the password for the openvpn user.

passwd openvpn

Open https://openvpn:943/admin in the browser. Replace openvpn with your hostname or IP address. Sign in with openvpn and the password you just set, and get to work.