OpenVPN server on Ubuntu 22.04 LTS

OpenVPN server on Ubuntu 22.04 LTS

Setup OpenVPN server

First of all You need install necessary utilities:

sudo apt update && sudo apt -y install wget iproute2

After this download and run OpenVPN configuration script from GitHub:

sudo wget -O
sudo chmod +x
sudo bash
Answer questions (It's OK to press Enter for all questions). Script will generate file client.ovpn. Yor need copy this client.ovpn file to client computer.

To stop, start, restart, status of OpenVPN server plese use commands:

sudo systemctl status openvpn-server@server.service
sudo systemctl restart openvpn-server@server.service
sudo systemctl stop openvpn-server@server.service
sudo systemctl start openvpn-server@server.service

Setup OpenVPN client on MacOS

Download tunnelblick, install and run tunnelblick, then drag-n-drop file client.ovpn to the config window, then press "Connect".

Setup OpenVPN client on Ubuntu Linux

Install openvpn openssh-client:

sudo apt update && apt -y install openvpn openssh-client
Copy client.ovpn to /etc/openvpn/client.conf
sudo scp USER-NAME@YOUR-VPN-SERVER.COM:client.conf /etc/openvpn/client.conf
Test the configuration:
sudo openvpn --client --config /etc/openvpn/client.conf
Start client
sudo /etc/init.d/openvpn start