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.

ワンライナー

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

実行条件

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

適用場面

  • 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

主なポイント

  • 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

推奨手順

  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.

注意事項

  • 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.

関連記事

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.

関連トピック

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.

トピックを見る

問題ページ

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.

ページを見る