Linux - Autostart OpenVPN in systemd (Fedora)
In order to configure OpenVPN to autostart for systemd, complete the following steps :
Step 1: Move the .ovpn file with the desired server location to the ‘/etc/openvpn’ folder:
# sudo cp /location/whereYouDownloadedConfigfilesTo/eu10.ovpn /etc/openvpn/
Step 2: Edit the .ovpn file you copied in the previous step and change the line ‘auth-user-pass’ to ‘auth-user-pass pass’:
# sudo nano /etc/openvpn/eu10.ovpn
Step 3: If nano is not installed:
# sudo yum install nano
Step 4: In the ‘/etc/openvpn/client’ folder, create a text file:
# sudo nano /etc/openvpn/client/pass
and enter your LimeVPN Account ID (in most cases your email address) on the first line and any non-blank text on the 2nd line, then press ‘Ctrl X’ to save the changes and exit the text editor.
(Optional) Change the permissions on the pass file to protect the credentials:
# sudo chmod 400 /etc/openvpn/client/pass
Step 5: Rename and move the .ovpn file to ‘client.conf’:
# sudo cp /etc/openvpn/eu10.ovpn /etc/openvpn/client/client.conf
Step 6: Enable the OpenVPN service to run while booting:
# sudo systemctl enable openvpn-client@client.service
Step 7: Reload the daemons:
# sudo systemctl daemon-reload
Step 8: Start the OpenVPN service:
# sudo service openvpn-client@client.service start
Step 9: Reboot and test if it is working by checking the external IP:
# curl ifconfig.co