Network client installer

install_openvpn_client_ubuntu.sh

Designed for Ubuntu 20.04, 22.04, and 24.04 LTS hosts that use username/password OpenVPN client authentication and need a repeatable way to install, copy client files, and start the service.

One-liner

curl -fsSL helper.sh/install_openvpn_client_ubuntu.sh | sudo bash
sudo bash install_openvpn_client_ubuntu.sh --source-conf ./client.conf --source-login ./login.txt

Requirements

  • Ubuntu 20.04 / 22.04 / 24.04 LTS
  • root privileges or sudo
  • Current directory contains client.conf
  • Current directory contains login.txt

Best for

  • Bring up an OpenVPN client quickly on a fresh Ubuntu host
  • Standardize username/password client deployment for server handoff
  • Avoid manual file copy mistakes when enabling openvpn-client@client

Highlights

  • Stops immediately if client.conf or login.txt is missing in the current directory
  • Copies client.conf and login.txt into /etc/openvpn/client/
  • Uses a local update-resolv-conf if present and adds DNS hooks only in that case
  • Enables and restarts openvpn-client@client automatically

Recommended procedure

  1. Put client.conf and login.txt in the current working directory.
  2. Run the helper.sh installer with sudo or as root.
  3. Let the script install OpenVPN, copy the client files, optionally attach a local DNS helper, and restart the OpenVPN client service.
  4. Review systemctl status and ip addr show tun0 to verify the tunnel. If you provided update-resolv-conf, also review cat /etc/resolv.conf.

Safety notes

  • Keep login.txt protected with chmod 600 and do not commit it to Git.
  • Review client.conf carefully before copying it onto a production host.
  • If the service does not start, inspect journalctl before retrying multiple times.
  • If you provide update-resolv-conf, remember that the DNS values are defined inside that helper script.
  • On Ubuntu hosts using systemd-resolved, prefer a resolvectl-aware update-resolv-conf instead of writing /etc/resolv.conf directly.

Scenario article

Install an OpenVPN client on Ubuntu with local client.conf and login.txt checks

A practical guide to using install_openvpn_client_ubuntu.sh to install OpenVPN, verify local client files, optionally copy update-resolv-conf, and enable the openvpn-client@client service on Ubuntu.

Related topics

OpenVPN client access and DNS handling

Set up OpenVPN client access on Ubuntu and CentOS 7 hosts, keep login files in the expected place, and handle DNS switching safely when private domains depend on the tunnel.

Open topic

Problem pages

Why OpenVPN update-resolv-conf is not working

Troubleshoot login files, CRLF script issues, and Ubuntu systemd-resolved behavior when private DNS is expected over OpenVPN.

Open page