Network client installer

install_openvpn_client_centos7.sh

Designed for CentOS 7 hosts that use username/password OpenVPN client authentication and need a repeatable way to install the package, place client files, attach DNS hooks, and start the systemd service.

One-liner

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

Requirements

  • CentOS 7
  • 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 CentOS 7 host
  • Standardize username/password client deployment for legacy server handoff
  • Avoid manual errors when copying config files, DNS hooks, and service commands

Highlights

  • Re-imports the EPEL GPG key before installing OpenVPN
  • Installs epel-release from the EPEL 7 archive when the OpenVPN package is not yet available
  • Copies client.conf and login.txt into /etc/openvpn/client/
  • Installs /etc/openvpn/update-resolv-conf and adds up/down hooks automatically
  • 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 import the EPEL GPG key, install OpenVPN, copy the client files, install the DNS helper, and restart the OpenVPN client service.
  4. A healthy run should show [OK] epel-release installed, [OK] yum metadata refreshed, [OK] OpenVPN installed, and [OK] openvpn-client@client is active.
  5. Review systemctl status, ip addr show tun0, curl ipinfo.im/ip, and cat /etc/resolv.conf to verify the tunnel and DNS state.

Safety notes

  • Keep login.txt protected with chmod 600 and do not commit it to Git.
  • Review the remote server address, routes, and credentials inside client.conf before copying it onto a production host.
  • If you disable full-tunnel mode with route-nopull, add only the network routes you actually need through the VPN.
  • If the service does not start, inspect journalctl before retrying multiple times.

Example output

Terminal output showing install_openvpn_client_centos7.sh completing successfully and openvpn-client@client becoming active
A corrected CentOS 7 run should show epel-release installation, yum metadata refresh, OpenVPN installation, DNS helper deployment, and an active openvpn-client@client service.

Scenario article

Install an OpenVPN client on CentOS 7 with login.txt auth and DNS helper hooks

A practical guide to using install_openvpn_client_centos7.sh to import the EPEL GPG key, install OpenVPN, place client.conf and login.txt, deploy update-resolv-conf, and enable openvpn-client@client on CentOS 7.

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