Linux
OpenVPN OpenVPN Nov 21, 2024

How to install OpenVPN on Linux

With NetworkManager

  1. Download and install OpenVPN and the NetworkManager plugin with your package manager.

Debian:

sudo apt-get install openvpn resolvconf network-manager-openvpn network-manager-openvpn-gnome

Fedora:

sudo yum install openvpn networkmanager-openvpn

Arch Linux:

sudo pacman -S openvpn networkmanager-openvpn
  1. Download the .ovpn file you need in your account and put it in /etc/openvpn/.
    ie: /etc/openvpn/xeovo.conf

  2. Download the ca.crt file and put it in /etc/openvpn/ aswell.

  3. Create the NetworkManager profile:

    Create a new OpenVPN connection. This highly depends on your environment:
    Mint: Left click on the Network icon in the Control Panel> Network Connections> Add
    Select "Import a saved VPN configuration"
    Select your xeovo-*.conf config file from the /etc/openvpn/ directory
    Select "password authentication" as the authentication type
    Enter your Xeovo username and password.
    Select the ca.crt you saved into /etc/openvpn as the CA Certificate and click "Save".

  4. Your VPN is now ready to use with NetworkManager.

With systemd

  1. Download and install OpenVPN with your package manager.

Debian:

sudo apt-get install openvpn

Fedora:

sudo yum install openvpn

Arch Linux:

sudo pacman -S openvpn
  1. Download the .ovpn file you need in your account and put it in /etc/openvpn/.
    ie: /etc/openvpn/xeovo.conf

  2. Start the OpenVPN service: sudo systemctl start openvpn@xeovo

  3. (Optional) To make OpenVPN start at boot, create a text file anywhere and write your username and password inside, on two lines.

Then, add at the end of your xeovo.conf file: auth-user-pass /path/to/the/file.txt

And enable the systemd service: systemctl enable openvpn@xeovo

For additional security, you can make sure only root is be able to access this file:

sudo chown root:root /path/to/the/file.txt
sudo chmod 600 /path/to/the/file.txt

Without systemd

  1. Download and install OpenVPN with your package manager.

Debian:

sudo apt-get install openvpn resolvconf

Fedora:

sudo yum install openvpn
  1. Download the .ovpn file you need in your account and put it in /etc/openvpn/.
    ie: /etc/openvpn/xeovo.conf

  2. Start the OpenVPN service: sudo service openvpn start xeovo

  3. (Optional) To make OpenVPN start at boot, create a text file anywhere and write your username and password inside, on two lines.

Then, add at the end of your xeovo.conf file: auth-user-pass /path/to/the/file.txt

And enable the systemd service: systemctl enable openvpn@xeovo

And add the configuration file name to the AUTOSTART list in /etc/default/openvpn (you can add it at the end): AUTOSTART="xeovo"

For additional security, you can make sure only root is be able to access this file:

sudo chown root:root /path/to/the/file.txt
sudo chmod 600 /path/to/the/file.txt