Ubuntu 20.04 LTS Set Up OpenVPN Server In 5 Minutes

Originally published at: https://www.cyberciti.biz/faq/ubuntu-20-04-lts-set-up-openvpn-server-in-5-minutes/

I am a new Ubuntu Linux 20.04 LTS server system administrator. How can I set up an OpenVPN Server on an Ubuntu Linux version 20.04 LTS server to shield my browsing activity from bad guys on public Wi-Fi, encrypt all traffic while connecting to 4G LTE network, and more?

Hi there. You mention suggesting using or Google DNS for speed and availability, but I would challenge that. I would suggest you consider OpenDNS as a preferred choice. There has been 100% uptime since inception in 2006 as well as the fastest in most or in top 3 in speed of response time from any country in the world. If you would like more details about this, I’d be happy to share added info with you. And oh by the way, OpenDNS is backed by the best security research group on the industry and OpenDNS gives you the ability to block traffic to known malicious domains and certain categories of sites if you choose.


Being new to this forum I’m not sure I’m adding to this topic correctly.

After running the install script and starting the service sudo systemctl status openvpn@server indicated failure and sudo journalctl -xe indicated the startup could not find server.conf.

`/lib/systemd/system/openvpn@.service` suggested it was looking in `/etc/openvpn`:    
`ExecStart=/usr/sbin/openvpn --daemon ovpn-%i --status /run/openvpn/%i.status 10 --cd /etc/openvpn --script-security 2 --config /etc/openvpn/%i.conf --writepid /run/openvpn/%i.pid`.

In my installation there are client/ and server/ directories in /etc/openvpn and server.conf is under server/.

Adding the server subdirectory in ExecStart […] to form --cd /etc/openvpn/server and --config /etc/openvpn/server/%i.conf led to an error-free start and clean-looking status:

$ sudo systemctl status openvpn@server
● openvpn@server.service - OpenVPN connection to server
     Loaded: loaded (/lib/systemd/system/openvpn@.service; disabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-05-09 06:20:38 EDT; 12h ago
       Docs: man:openvpn(8)
   Main PID: 137066 (openvpn)
     Status: "Initialization Sequence Completed"
      Tasks: 1 (limit: 18706)
     Memory: 1.7M
     CGroup: /system.slice/system-openvpn.slice/openvpn@server.service
             └─137066 /usr/sbin/openvpn --daemon ovpn-server --status /run/openvpn/server.status 10 --cd /etc/openvpn/server --script-security 2 --config /etc/openvpn/server/s[...]

@flathat66, I will look into script again and see if it creating wrong file.

I have the same problem and same error messages after installing OpenVPN using these directives.

@flathat66 - your guide is good, however in which file did you edit the ExecStart statement?

I checked in /etc/init.d/openvpn and its not in there…?

1 Like

I reread your post and realised its: /lib/systemd/system/openvpn@.service
Thanks !

1 Like

Hello @Alister and @flathat66,

I finally updated page. You no longer need to update file manually. It should work out of the box. If you made changes you can either keep it or revert it. Let me know if anyone face any more problems.

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki