Install ProtonVPN CLI

Setting up a VPN on Ubuntu can be done in several ways, depending on whether you want to connect to a VPN service (like NordVPN, ProtonVPN, etc.) or host your own VPN server (like OpenVPN or WireGuard). Below are the common methods:


Connecting to a VPN Service (e.g., NordVPN, ProtonVPN)

Most commercial VPN providers offer Linux clients or manual setup instructions.

Method 1: Using the Provider’s Official Client

Some VPNs (e.g., NordVPN, ProtonVPN) offer native Linux apps.
Example for ProtonVPN:

sudo apt install -y openvpn dialog python3-pip
sudo pip3 install protonvpn-cli
# Log in and connect
protonvpn init  # Follow setup
protonvpn connect

Method 2: Manual OpenVPN Setup

If your provider supports OpenVPN (most do):

  1. Download the .ovpn config files from your VPN provider.
  2. Install OpenVPN:
    sudo apt update
    sudo apt install openvpn
  3. Connect using a config file:
    sudo openvpn --config /path/to/config.ovpn

    (You may need to enter your VPN username/password.)


Setting Up Your Own VPN Server

Option A: WireGuard (Fast & Modern)

WireGuard is lightweight and secure.

  1. Install WireGuard:

    sudo apt update
    sudo apt install wireguard
  2. Generate keys:

    umask 077
    wg genkey | sudo tee /etc/wireguard/privatekey | wg pubkey | sudo tee /etc/wireguard/publickey
  3. Configure /etc/wireguard/wg0.conf (example):

    [Interface]
    PrivateKey = <your-server-private-key>
    Address = 10.0.0.1/24
    ListenPort = 51820
    PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
    [Peer]  # Client config
    PublicKey = <client-public-key>
    AllowedIPs = 10.0.0.2/32
  4. Enable IP forwarding:

    echo "net.ipv4.ip_forward=1" | sudo tee -a /etc/sysctl.conf
    sudo sysctl -p
  5. Start WireGuard:

    sudo wg-quick up wg0
    sudo systemctl enable wg-quick@wg0

Option B: OpenVPN (Traditional)

Use openvpn-install script for easy setup:

wget https://git.io/vpn -O openvpn-install.sh
chmod +x openvpn-install.sh
sudo ./openvpn-install.sh

Follow the prompts to set up a server and generate client profiles.


Using GNOME’s Built-in VPN Support

Ubuntu (GNOME) has built-in VPN support:

  1. Go to SettingsNetworkVPN.
  2. Click Add VPN and select your protocol (e.g., OpenVPN, WireGuard).
  3. Enter your VPN details (config file, username, password).

Troubleshooting

  • Permission Issues: Use sudo for system-wide VPN setups.
  • DNS Leaks: Check with DNSLeakTest.
  • Firewall: Allow VPN ports (e.g., UDP 51820 for WireGuard).

Would you like help with a specific VPN setup?

Install ProtonVPN CLI

扫码下载闪连翻墙软件

扫码下载闪连翻墙软件

400-33665566
扫码下载闪连翻墙软件

扫码下载闪连翻墙软件