Setup Linux Cli Openvpn

Setting up an OpenVPN CLI connection on Linux (No GUI).

The following instructions go step by step through the creation process of a CLI (Command Line Interface) setup for an OpenVPN connection on Linux based systems where no GUI is included.

We will assume that each command are entered as the user ‘root’. If you don’t have password for root, you can do this with your current user, but prepending each command with ‘sudo’, e.g: sudo /etc/init.d/openvpn restart

1. First you need to update the current list of packages:

apt-get update

2. You need to install the openvpn daemon:

apt-get install openvpn

3. You now need a copy of our tcp/udp configs, which you can get from our control panel. You should copy them to the linux machine (via scp, for example), and unzip them into /etc/openvpn.

cd /etc/openvpn
unzip /home/linux/openvpn-tcp-udp.zip (Change home/linux to your download location)

4. Choose whichever type of connection you will use – tcp or udp. Copy the necessary files from config subdir into /etc/openvpn:

cp config/* .
rm tcp.ovpn
mv udp.ovpn vpnuk.conf

5. Edit the config and change the name of the server. You can change the port, too, if needed, to one of the ports we support (1194, 55194 or 65194 for UDP or 443, 80 or 8008 for TCP).

6. After the auth-user-pass, enter a filename, e.g. ‘user.txt’. So the line reads ‘auth-user-pass user.txt’
Save the config, and exit to the shell.

7. Create a file with your username and password in it on two different rows, e.g.:

root@linux:/etc/openvpn# cat user.txt
username
password
root@linux:/etc/openvpn#

8. Protect the file:

chmod go-rwx user.txt

9. Restart openvpn:

/etc/init.d/openvpn

10. Thats It! You should be up and running.