
Effortless OpenVPN Setup on Ubuntu and CentOS with Network Manager
Connecting to a Virtual Private Network (VPN) is a critical step in securing your online activity and protecting your data. While many power users are comfortable using the command line, a graphical user interface (GUI) often provides a more convenient and user-friendly way to manage network connections. For Linux desktop users on distributions like Ubuntu and CentOS, the built-in Network Manager is the perfect tool for the job.
This guide will walk you through the simple process of configuring an OpenVPN connection directly within your desktop environment, giving you a seamless and integrated experience.
Prerequisites: What You’ll Need
Before we begin, ensure you have the following ready:
- A desktop computer running a modern version of Ubuntu, CentOS, or a similar Linux distribution with the GNOME desktop environment.
- Your OpenVPN configuration file, which typically has a
.ovpnextension. This file is provided by your VPN service or network administrator and contains all the necessary connection settings. - Administrative (sudo) privileges on your system to install software.
Step 1: Install the Network Manager OpenVPN Plugin
By default, Network Manager does not include the necessary components to handle OpenVPN connections. The first and most important step is to install the official plugin. This is a straightforward process using your distribution’s package manager.
Open a terminal window and run the command that corresponds to your operating system.
For Ubuntu and other Debian-based systems (like Linux Mint):
sudo apt update && sudo apt install network-manager-openvpn-gnome
For CentOS, RHEL, and Fedora:
sudo yum install NetworkManager-openvpn-gnome
This command installs the plugin that adds the “Import from file…” option for OpenVPN to your network settings, which is essential for the next step.
Step 2: Import Your OpenVPN Configuration File
With the plugin installed, you can now add your VPN profile to Network Manager.
- Navigate to your system Settings and select the Network panel.
- Click the plus (+) icon next to the VPN section to add a new connection.
- A new window will appear. Instead of manually configuring a connection, select the “Import from file…” option at the bottom.
- Locate and select your
.ovpnconfiguration file and click “Open.”
Network Manager will automatically parse the file and populate most of the required fields, such as the server address and authentication certificates.
Step 3: Add Your Credentials and Finalize the Setup
After importing the file, a configuration window will appear with all the details from your .ovpn file. While most settings are pre-filled, you must add your personal login details.
- In the “Identity” tab, locate the Authentication section.
- Select “Password” from the Type dropdown menu (if not already selected).
- Enter your VPN username and password in the provided fields.
- You can choose to have Network Manager store your password for convenience, but be aware of the security implications of saving credentials on a shared or unsecured machine.
- Once your credentials are entered, click the “Add” or “Apply” button in the top right corner to save the new VPN connection.
Step 4: Connect and Verify Your Secure Connection
Your OpenVPN connection is now configured and ready to use. Connecting is simple:
- Go back to your Network settings and you will now see your new VPN profile listed. Simply click the toggle switch to turn it on.
- Alternatively, you can click on the network icon in your system’s top bar or system tray, find the VPN menu, and select your new connection to activate it.
You’ll know you are successfully connected when a VPN icon appears in your top bar.
Pro Tip: How to Confirm Your VPN is Working
To be absolutely sure your traffic is being routed through the VPN, you can check your public IP address. Open a web browser and search for “what is my IP address” before you connect to the VPN. Note the IP address and location. Then, connect to the VPN and refresh the page. Your IP address and location should now reflect those of the VPN server, confirming your connection is secure and active.
By following these steps, you can easily integrate a powerful OpenVPN connection directly into your Linux desktop for simple, one-click access to a secure and private network.
Source: https://kifarunix.com/connect-to-openvpn-using-network-manager-on-centos-8-ubuntu-18-04/


