Deja, šio puslapio turinio jūsų pasirinkta kalba nėra.

Jūsų IP:nėra informacijos

·

Jūsų statusas: nėra informacijos

Pereiti prie pagrindinio turinio

How to set up a VPN on Ubuntu

If you’re using Ubuntu, adding a VPN is one of those small changes that can make a big difference to your online life. A VPN client creates an encrypted connection between your local machine and a remote server, routing your internet traffic through a VPN server rather than sending it directly through your internet service provider (ISP). As a result, your browsing activity stays more secure. This article will walk you through the methods of creating an Ubuntu VPN connection and help you decide which one works best for you.

2026-03-24

Skaitymo trukmė: 9 min.

How to set up a VPN on Ubuntu

Method 1: Using the graphical user interface (GUI)

For most people, the easiest way to create a VPN connection on Ubuntu is through the GUI. Ubuntu includes built-in networking tools that let you manage connections through the network manager, so you don’t need to work with the Terminal. If you’re new to Linux or just prefer clicking through menus, this is usually the simplest place to start.

To configure a Linux VPN using the GUI, simply follow these steps:

  1. 1.

    Click on the network icon in the top-right corner of the desktop and choose “Settings” in the shortcuts menu.

    How to set up a VPN on Ubuntu using the GUI: Step 1

  2. 2.

    In the settings window, click “Network” in the sidebar to open the network manager window. Under the VPN section, click the “+” button to add a new VPN connection.

    How to set up a VPN on Ubuntu using the GUI: Step 2

  3. 3.

    Choose which type of VPN connection you want to add. Select the protocol your VPN provider uses (for example, OpenVPN or L2TP/IPsec). For convenience, you can also import an existing VPN connection from an “.ovpn” config file instead of entering all the settings manually. 

    How to set up a VPN on Ubuntu using the GUI: Step 3

    If you’re using NordVPN, you can get the “.ovpn” file by logging in to your Nord account. Click “NordVPN,” go to “Set up NordVPN manually” under “Advanced settings,” and open “OpenVPN config files.” Choose the server and download the config file. You can choose between UDP and TCP files depending on your preference. For the best performance, go to “Server recommendation” and download the config file for the recommended server.

    How to set up a VPN on Ubuntu using the GUI: Step 4
  4. 4.

    Under the “Identity” tab, you also need to input your user credentials. 

    How to set up a VPN on Ubuntu using the GUI: Step 5

    You can find your NordVPN service credentials by going back to your Nord account > “Set up NordVPN manually” > “Service credentials.”

    How to set up a VPN on Ubuntu using the GUI: Step 6
  5. 5.

    Once you have filled in all the information, click “Add” to save the settings.

    How to set up a VPN on Ubuntu using the GUI: Step 7

    To connect to the VPN, open the system menu in the top-right corner again, select your VPN connection, and toggle the switch on.

    How to set up a VPN on Ubuntu using the GUI: Step 8

If you’d rather avoid manually importing any files, or you want an easier way to choose between many server locations, you can also use the NordVPN Linux app. It works as a dedicated VPN client, which makes it easier to browse available servers and manage your VPN connection.

To install the NordVPN GUI app:

  1. 1.

    Open Terminal (“Ctrl” + “Alt” + “T”) and run the command to install the app.

    sh <(wget -qO - https://downloads.nordcdn.com/apps/linux/install.sh) -p nordvpn-gui
    How to set up a VPN on Ubuntu using the NordVPN GUI app: Step 1
  2. 2.

    After the install process finishes, look for the NordVPN icon in your applications menu and open it. Enter your Nord account email and password.

    How to set up a VPN on Ubuntu using the NordVPN GUI app: Step 2
  3. 3.

    Click “Quick connect” to connect to the recommended server for you or choose from a list of available ones.

    How to set up a VPN on Ubuntu using the NordVPN GUI app: Step 3

Method 2: Using the Terminal 

The second method involves setting up a VPN connection via OpenVPN and controlling it manually through the Terminal (command line). Many Linux users prefer this approach because it provides more control over the configuration and the connection itself.

It might require a little bit of effort and technical know-how, but it’s pretty straightforward and repeatable once you’ve done it once. The exact steps may vary slightly depending on your Ubuntu version, but the overall setup process remains similar. To set up a VPN on Linux using Terminal:

  1. 1.

    Open Terminal (“Ctrl” + “Alt” + “T”). Before installing OpenVPN, make sure to disable IPv6.

    Install an OpenVPN client using an install command. You may be asked for your system password.

    sudo apt install openvpn
    How to set up a VPN on Ubuntu using the terminal: Step 3
  2. 2.

    Go to the OpenVPN configuration directory.

    cd /etc/openvpn
    How to set up a VPN on Ubuntu using the NordVPN GUI app: Step 1
  3. 3.

    Download the OpenVPN configuration archive.

    sudo wget https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip
    How to set up a VPN on Ubuntu using the NordVPN GUI app: Step 1
  4. 4.

    If you get an SSL certificate error, run the following to fix it.

    sudo apt install ca-certificates
  5. 5.

    Extract the “.ovpn” files from the archive.

    sudo unzip ovpn.zip
    How to set up a VPN on Ubuntu using the terminal: Step 4

    But first, make sure the “unzip” package is installed on your device. If you don’t have it, run this command before extracting the configuration files.

    sudo apt install unzip
  6. 6.

    Once you extract the files, you’ll see two folders — one for UDP connection files and another for TCP connection files. To open either folder in the Terminal, use one of these commands.

    cd /etc/openvpn/ovpn_udp/
    cd /etc/openvpn/ovpn_tcp/
    How to set up a VPN on Ubuntu using the terminal: Step 5
  7. 7.

    To run a VPN on Linux, you first need to find a server. To find the recommended one for you, log in to your Nord account and go to “NordVPN” > “Advanced settings” > “Set up NordVPN manually” > “Server recommendation.”

    How to set up a VPN on Ubuntu using the terminal: Step 6
  8. 8.

    Start the VPN.

    sudo openvpn /etc/openvpn/ovpn_udp/us2957.nordvpn.com.udp.ovpn
    How to set up a VPN on Ubuntu using the terminal: Step 7

    Replace “us2957.nordvpn.com.udp.ovpn” with the “.ovpn” file that matches the server and protocol you want to use.

  9. 9.

    Enter your NordVPN service credentials. To find them, log in to your Nord account, go to “NordVPN” > “Set up NordVPN manually” > “Service credentials.”

    How to set up a VPN on Ubuntu using the terminal: Step 8

The VPN will stay active as long as the Terminal window remains open. To stop the connection, press “Ctrl” + “C,” which will close the session and disconnect from the VPN.

A comparison: Which method should you choose?

Both methods mentioned above ultimately do the same thing: they help you set up a VPN on your Ubuntu device. However, some differences exist between the methods. Mainly, in the level of control, the setup process, and how you manage the VPN connection once it’s running.

If you want the easiest setup, the GUI method is usually the better choice. Using the network manager, you can add a VPN connection through Ubuntu’s settings and connect to it with a simple toggle switch. Once everything is set up, turning the VPN on or off takes just a few clicks.

The Terminal method, on the other hand, gives you more control over how the connection works. Instead of relying on Ubuntu’s built-in tools, you manually install OpenVPN, download the configuration files, and start the connection through Terminal. This approach may look more technical at first, but many Linux users prefer it because it makes it easier to see what’s happening behind the scenes.

The table below summarizes the main differences between the two methods.

Method

Pros

Things to keep in mind

Best for

GUI

✅ Easy setup
✅ Quick connection

You have less control over configuration details.

Beginners or users who prefer visual tools

Terminal

✅ More control over configuration
✅ Easier troubleshooting

Requires more steps, and the VPN connection stops when the Terminal closes.

Users who are comfortable with Terminal

Troubleshooting

If your VPN connection doesn’t work right away, don’t worry. Small configuration mistakes, missing files, or network settings can sometimes interrupt the setup process. Some possible troubleshooting steps you can try are:

  • Checking your internet connection first. Make sure your regular internet connection works before starting the VPN. If your system isn’t online, the VPN client won’t be able to reach the server.
  • Verifying your credentials. Incorrect user credentials are one of the most common causes of connection problems. Double-check that you’re using the correct username and password provided by your VPN service.
  • Trying another server. Sometimes a specific VPN server may be temporarily unavailable or overloaded because too many client machines are trying to connect to the same server. Switching to another server location can quickly fix connection issues.
  • Checking that OpenVPN is installed properly. If you’re using the manual method, confirm that the OpenVPN client is installed correctly, the configurations work properly, and that the required configuration files are in the correct folder. Make sure OpenVPN is installed properly before attempting to start the connection.
  • Reviewing firewall or network rules. In some cases, firewall settings may be restricting VPN traffic before the connection is established. Make sure that network address translation (NAT) is correctly routing client connections.
  • Connecting without administrator privileges. In some environments, you may need to configure a Linux Ubuntu VPN setup without root or sudo privileges.

Online security starts with a click.

Stay safe with the world’s leading VPN

FAQ

Aurelija Skebaite | NordVPN

Aurelija Skebaite

Aurelija is passionate about cybersecurity and wants to make the online world safer for everyone. She believes the best way to learn is by doing, so she approaches cybersecurity topics from a practical standpoint and aims to help people protect themselves online.