How to Install OpenVPN on a VPS

In this guide we will be installing ‘OpenVPN Access Server’ onto a VPS.

1. Get a VPS

You are going to need a VPS with full root access. You can get one here.

In our guide we will be using a 512MB VPS running ‘Ubuntu 14 64bit’ as our operating system. If you choose to use a different operating system, the commands in the ‘Installation’ section will be slightly different.

1. Prepare the server

Connect to your VPS using SSH.

Make sure that TUN/TAP is enabled on your VPS. With some providers, you can enable this feature directly in the Server Control Panel with a single click. Just allow time for the VPS to reboot with the new feature enabled. Then, run the following command:

cat /dev/net/tun

If you get a result that looks like this:

/dev/net/tun: File descriptor in bad state

You are all set. File descriptor in bad state tells you that TUN is enabled. If you get a different result, TUN may not be enabled on your VPS. Try again or contact your provider so they can check.

Now, lets make sure that iptables is running on your server:

iptables --list

It should be running already by default, however if for some reason you get an error or not found result back, you can try installing iptables manually:

apt-get install iptables

2. Install the software

Download the OpenVPN software onto your system:

wget http://swupdate.openvpn.org/as/openvpn-as-2.0.24-Ubuntu14.amd_64.deb

Install the software:

dpkg -i openvpn-as-2.0.24-Ubuntu14.amd_64.deb

Set your admin password:

passwd openvpn

Now OpenVPN is installed.

3. Log into OpenVPN

Go to the admin URL:

https://your-server-ip:943/admin

Put in your actual VPS IP where you see ‘your server IP’. Your browser will warn you that the website uses a self signed certificate, this is normal, tell your browser to proceed.

Head over to the ‘Status Overview’ section and turn your server on if it is not already on.

4. Connect to your VPN

When you want to connect to your VPN, you will use the client webpage:

https://your-server-ip:943/

Follow the steps there. The OpenVPN software will be downloaded to your system so that you can connect.

Done.