Launch OpenVPN client as a daemon.

Here I assume you already have your own cert file: filename.ovpn. 🙂

Modify its file extension to a conf file like so:

1
mv filename.ovpn filename.conf

Move the file inside /etc/openvpn directory like so:

1
mv /path/to/filename.conf /etc/openvpn/

OpenVPN client service name would be openvpn@filename.

Well, you might already know what to do to launch the service.

1
2
sudo killall openvpn
sudo systemctl enable --now openvpn@filename

Reload the system daemons.

1
sudo systemctl daemon-reload

That’s it. 🙂

If you have username and password for the certfile, you need this step

Make a credential file like so:

1
sudo touch /etc/openvpn/login.conf

Enter the following into the file.

1
2
your-username
your-password

Open your certfile to edit.

1
sudo vim /etc/openvpn/filename.conf

Add this line or edit it if it already exists.

1
auth-user-pass login.conf

If you want to launch it manually each time, I recommend a shell script

Write a shell script with the following contents.

1
2
3
#!/bin/bash
sudo killall openvpn
sudo openvpn --daemon --config /path/to/filename.ovpn

You can now use the script file whenever you need it, even on startup.

Happy networking! 🙂