How To Install openvpn on Ubuntu 20.04

In this tutorial we learn how to install openvpn on Ubuntu 20.04. openvpn is virtual private network daemon virtual private network daemon virtual private network daemon

Introduction

In this tutorial we learn how to install openvpn on Ubuntu 20.04.

What is openvpn

openvpn is:

OpenVPN is an application to securely tunnel IP networks over a single UDP or TCP port. It can be used to access remote sites, make secure point-to-point connections, enhance wireless security, etc.

OpenVPN uses all of the encryption, authentication, and certification features provided by the OpenSSL library (any cipher, key size, or HMAC digest).

OpenVPN may use static, pre-shared keys or TLS-based dynamic key exchange. It also supports VPNs with dynamic endpoints (DHCP or dial-up clients), tunnels over NAT or connection-oriented stateful firewalls (such as Linux’s iptables). Task: ubuntu-desktop-minimal, ubuntu-desktop, ubuntu-mate-core, ubuntu-mate-desktop, ubuntu-budgie-desktop

Package: openvpn Architecture: amd64 Version: 2.4.7-1ubuntu2.20.04.2 Priority: optional Section: net Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Bernhard Schmidt [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 1160 Depends: debconf (>= 0.5) | debconf-2.0, libc6 (>= 2.15), liblz4-1 (>= 0.0~r130), liblzo2-2 (>= 2.02), libpam0g (>= 0.99.7.1), libpkcs11-helper1 (>= 1.11), libssl1.1 (>= 1.1.1), libsystemd0, iproute2, lsb-base (>= 3.0-6) Suggests: openssl, resolvconf, openvpn-systemd-resolved, easy-rsa Filename: pool/main/o/openvpn/openvpn_2.4.7-1ubuntu2.20.04.2_amd64.deb Size: 476916 MD5sum: bc5a62e15ce7247282fa56d20b43e8e2 SHA1: 66f551ac0589a429d841bf26c7d75db9b1fbd93b SHA256: 160c88633f343b6fb15d820be2dcdf6c5839d9c71c018303b71f7afe3814674d SHA512: d4e9c3637ba425bbab0ff9773a226c2deff6ae5f9cea9f6d1b62bf0e39e2f81665db1beb57f3c80342c51e8da423bf80ea307abeff6f79c8f8cd32de9442e3c1 Homepage: https://openvpn.net/ Description-en: virtual private network daemon OpenVPN is an application to securely tunnel IP networks over a single UDP or TCP port. It can be used to access remote sites, make secure point-to-point connections, enhance wireless security, etc.

OpenVPN uses all of the encryption, authentication, and certification features provided by the OpenSSL library (any cipher, key size, or HMAC digest).

OpenVPN may use static, pre-shared keys or TLS-based dynamic key exchange. It also supports VPNs with dynamic endpoints (DHCP or dial-up clients), tunnels over NAT or connection-oriented stateful firewalls (such as Linux’s iptables). Task: ubuntu-desktop-minimal, ubuntu-desktop, ubuntu-mate-core, ubuntu-mate-desktop, ubuntu-budgie-desktop

Package: openvpn Architecture: amd64 Version: 2.4.7-1ubuntu2 Priority: optional Section: net Origin: Ubuntu Maintainer: Ubuntu Developers [email protected] Original-Maintainer: Bernhard Schmidt [email protected] Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 1160 Depends: debconf (>= 0.5) | debconf-2.0, libc6 (>= 2.15), liblz4-1 (>= 0.0~r130), liblzo2-2, libpam0g (>= 0.99.7.1), libpkcs11-helper1 (>= 1.11), libssl1.1 (>= 1.1.1), libsystemd0, iproute2, lsb-base (>= 3.0-6) Suggests: openssl, resolvconf, openvpn-systemd-resolved, easy-rsa Filename: pool/main/o/openvpn/openvpn_2.4.7-1ubuntu2_amd64.deb Size: 477512 MD5sum: defc631ce103be6c8b9320653480d70f SHA1: 9d29465582a9d8302492421033e401723fbba14a SHA256: 8585dd576aac637d4ce6e1e1d0244fa4d1ad15c27da2ef56cc0affd82da45050 Homepage: https://openvpn.net/ Description-en: virtual private network daemon OpenVPN is an application to securely tunnel IP networks over a single UDP or TCP port. It can be used to access remote sites, make secure point-to-point connections, enhance wireless security, etc.

OpenVPN uses all of the encryption, authentication, and certification features provided by the OpenSSL library (any cipher, key size, or HMAC digest).

OpenVPN may use static, pre-shared keys or TLS-based dynamic key exchange. It also supports VPNs with dynamic endpoints (DHCP or dial-up clients), tunnels over NAT or connection-oriented stateful firewalls (such as Linux’s iptables). Task: ubuntu-desktop-minimal, ubuntu-desktop, ubuntu-mate-core, ubuntu-mate-desktop, ubuntu-budgie-desktop

There are three methods to install openvpn on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install openvpn Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install openvpn using apt-get by running the following command:

sudo apt-get -y install openvpn

Install openvpn Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install openvpn using apt by running the following command:

sudo apt -y install openvpn

Install openvpn Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install openvpn using aptitude by running the following command:

sudo aptitude -y install openvpn

How To Uninstall openvpn on Ubuntu 20.04

To uninstall only the openvpn package we can use the following command:

sudo apt-get remove openvpn

Uninstall openvpn And Its Dependencies

To uninstall openvpn and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove openvpn

Remove openvpn Configurations and Data

To remove openvpn configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge openvpn

Remove openvpn configuration, data, and all of its dependencies

We can use the following command to remove openvpn configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge openvpn

References

Summary

In this tutorial we learn how to install openvpn package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.