Installing OpenVPN on Linux and Unix Systems: Part 1

0
255
9 min read

Prerequisites

All Linux/Unix systems must meet the following requirements to install OpenVPN successfully:

  • Your system must provide support for the Universal TUN/TAP driver. The kernels newer than version 2.4 of almost all modern Linux distributions provide support for TUN/TAP devices. Only if you are using an old distribution or if you have built your own kernel, will you have to add this support to your configuration. This project’s web site can be found at http://vtun.sourceforge.net/tun/.
  • OpenSSL libraries have to be installed on your system. I have never encountered any modern Linux/Unix system that does not meet this requirement. However, if you want to compile OpenVPN from source code, the SSL development package may be necessary. The web site is http://www.openssl.org/.
  • The Lempel-Ziv-Oberhumer (LZO) Compression library has to be installed. Again, most modern Linux/Unix systems provide these packages, so there shouldn’t be any problem. LZO is a real-time compression library that is used by OpenVPN to compress data before sending. Packages can be found on http://openvpn.net/download.html, and the web site of this project is http://www.oberhumer.com/opensource/lzo/.
  • Most Linux/Unix systems’ installation tools are able to resolve these so-called dependencies on their own, but it might be helpful to know where to get the required software.
  • Most commercial Linux systems, like SuSE, provide installation tools, like Yet another Setup Tool (YaST), and contain up-to-date versions of OpenVPN on their installation media (CD or DVD). Furthermore, systems based on RPM software can also install and manage OpenVPN software at the command line.
  • Linux systems, like Debian, use sophisticated package management tools that can install software that is provided by repositories on web servers. No local media is needed, the package management will resolve potential dependencies by itself, and install the newest and safest possible version of OpenVPN.
  • FreeBSD and other BSD-style systems use their package management tools such as pkg_add or the ports system.
  • Like all open source projects, OpenVPN source code is available for download. These compressed tar.gz or tar.bz2 archives can be downloaded from http://openvpn.net/download.html and unpacked to a local directory. This source code has to be configured and translated (compiled) for your operating system.
  • You can also install unstable, developer, or older versions of OpenVPN from http://openvpn.net/download.html. This may be interesting if you want to test new features of forthcoming versions.
  • Daily (unstable!) OpenVPN source code extracts can be obtained from http://sourceforge.net/cvs/?group_id=48978. Here you find the Concurrent Versions System (CVS) repository, where all OpenVPN developers post their changes to the project files.

Installing OpenVPN on SuSE Linux

Installing OpenVPN on SuSE Linux is almost as easy as installing under Windows or Mac OS X. Linux users may consider it even easier. On SuSE Linux almost all administrative tasks can be carried out using the administration interface YaST. OpenVPN can be installed completely using this. The people distributing SuSE have always tried to include up-to-date software in their distribution. Thus, the installation media of OpenSuSE 11 already contains version 2.0.9 of OpenVPN, and both the Enterprise editions SLES 10 and the forthcoming SLES 11 that offer five years of support. Updates include up-to-date versions of OpenVPN. Both OpenSuSE and SLES use YaST for installing software.

Using YaST to install software

Start YaST. Under both GNOME and the K Desktop Environment (KDE—the standard desktop under SuSE Linux), you will find YaST in the main menu under System | YaST, or as an icon on the Desktop. If you are logged in as a normal user, you will be prompted to enter your root password and confirm the same. The YaST control center is started.

Beginning OpenVPN 2.0.9

This administration interface consists of many different modules, which are represented by symbols in the right half of the window and grouped by the labels on the left.

Beginning OpenVPN 2.0.9

After starting YaST, click on the symbol labeled Software Management in the right column to start the software management interface of YaST.

The software management tool in YaST is very powerful. Under SuSE, data about the installed and installable software is kept in a database, which can be searched very easily. Select the entry Search in the drop-down list Filter: and enter openvpn in the Search field.

YaST will find at least one entry that matches your search value openvpn. Depending on the (online) installation sources that you have configured, various add-ons and tools for OpenVPN will be found. If you chose to add the community repositories like I did on this system, then OpenSuSE will list more than 10 hits.

Beginning OpenVPN 2.0.9

Select the entry openvpn by checking the box besides the entry in the first column. If you want to obtain information about the OpenVPN package, have a look at the lower half of the right side—here you will find the software Description, Technical Data, Dependencies, and more information about the package that you have selected. Click on the Accept button to start the OpenVPN installation.

If you installed from a local medium, then put your CD or DVD in your local drive now. YaST will retrieve the OpenVPN files from your installation media. If you have configured your system to use one of the web/FTP servers of SuSE for installation, then this might take a while. The files are unpacked and installed on your system, and YaST updates the configuration. This is managed by the script SuSEconfig and other scripts that are called by it.

SuSEconfig and YaST were once very infamous for deleting local configuration created by the local administrator or omitting relevant changes. This problem only occurred when updating and re-installing software that was previously installed. However, the latest SuSE versions have proven very reliable, and the system configuration tools never delete configuration files that you have added manually. Instead, the standard configuration files installed with the new software package may be renamed to <file>.rpmnew or similar, and your configuration is loaded.

During installation, SuSEconfig calls several helper scripts and updates your configuration, and informs you of the progress in a separate window. After successful software installation, you are prompted if you want to install more packages or exit the installation. Click on the Finish button.

The Novell/OpenSuSE teams have added a very handy tool called zypper to their package management. From version 10.1 onwards, you can simply install software from a root console by typing zypper in openvpn. Of course this only works if you know the exact name of the package that you want to install. If not, then you will have to search for it, for example, by using zypper search vpn.

Beginning OpenVPN 2.0.9

Installing OpenVPN on Red Hat Fedora using yum

If you are using Red Hat Fedora, the Yellow dog Updater, Modified (yum) is probably the easiest way to install software. It can be found on http://linux.duke.edu/projects/yum/, and provides many interesting features, such as automatic updates, solving dependency problems, and managing installation of software packages.

Even though OpenVPN installation on Fedora can only be done on the command line, it still is a very easy task. The installation makes use of the commands wget, rpm, and yum.

  • wget: A command-line download manager suitable for ftp or http downloads.
  • rpm: The Red Hat Package Manager is a software management system used by distributions like SuSE or Red Hat. It keeps track of changes and can solve dependencies between programs.
  • yum: This provides a simple installation program for RPM-based software.

To use yum, you have to adapt its configuration file as follows:

  • Log in as administrator (root).
  • Change to Fedora’s configuration directory /etc.
  • Save the old, probably original, configurations file yum.conf by renaming or moving it. You can use commands such as mv yum.conf yum.conf_fedora_org to accomplish this.
  • The web site http://www.fedorafaq.org/ provides a suitable configuration file for yum. Download the file http://www.fedorafaq.org/samples/yum.conf using wget. The command-line syntax is:
    wget http://www.fedorafaq.org/samples/yum.conf
  • At the same web site a sophisticated yum configuration is available for downloading. Install this as well:
    rpm -Uvh http://www.fedorafaq.org/yum

The following excerpt shows the output of these five steps on the system:

[root@fedora ~]# cd /etc
[root@fedora etc]# mv yum.conf yum.conf.org
[root@fedora etc]# wget http://www.fedorafaq.org/samples/yum.conf
--11:33:25-- http://www.fedorafaq.org/samples/yum.conf
=> `yum.conf'
Resolving www.fedorafaq.org... 70.84.209.18
Connecting to www.fedorafaq.org[70.84.209.18]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 595 [text/plain]100%[==========================================================
================================================>] 595 --.-
-K/s
11:33:25 (405.20 KB/s) - `yum.conf' saved [595/595][root@fedora etc]# rpm -Uvh http://www.fedorafaq.org/yum
Retrieving http://www.fedorafaq.org/yum
Preparing... #########################################
## [100%]1:yum-fedorafaq #########################################
## [100%][root@fedora etc]#

The rest of the OpenVPN installation is very simple. Just enter yum install openvpn in your root shell. Now yum will start and give you a lot of output. We will have a short look at the things yum does.

[root@fedora ~]#yum install openvpn
Setting up Install Process
Setting up repositories
livna 100% |=========================| 951 B
00:00
updates-released 100% |=========================| 951 B
00:00
base 100% |=========================| 1.1 kB
00:00
extras 100% |=========================| 1.1 kB
00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 127 kB
00:00
livna : ################################################## 380/380
Added 380 new packages, deleted 0 old in 1.36 seconds
primary.xml.gz 100% |=========================| 371 kB
00:00
updates-re: ##################################################
1053/1053
Added 0 new packages, deleted 13 old in 0.93 seconds

yum has set up the installation process and integrated online repositories for the installation of software. This feature is the reason why Fedora does not need a URL source for installing OpenVPN. The repository metadata contains information about location, availability, and dependencies between packages. Resolving the dependencies is the next step.

Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for openvpn to pack into transaction set.
openvpn-2.0.9-1.fc5.i386. 100% |=========================| 18 kB
00:00
---> Package openvpn.i386 0:2.0.9-1.fc5 set to be updated
--> Running transaction check
--> Processing Dependency: liblzo.so.1 for package: openvpn
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for lzo to pack into transaction set.
lzo-1.08-4.i386.rpm 100% |=========================| 3.2 kB
00:00
---> Package lzo.i386 0:1.08-4 set to be updated
--> Running transaction check
Dependencies Resolved

OpenVPN needs the LZO library for installation, and yum is about to resolve this dependency. As a next step, yum tests whether this library has unresolved dependencies. If this is not the case, we are presented with an overview of the packages to be installed. Confirm by entering y and press the Enter key. yum will start downloading the required packages.

If the RPM process that yum is using to install the software packages encounters a missing encryption key, then confirm the import of this key from http://www.fedoraproject.org by entering y and pressing the Enter key. This GPG key is used to control the authenticity of the packages selected for installation.

Key imported successfully
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: lzo #########################
[1/2]Installing: openvpn #########################
[2/2]Installed: openvpn.i386 0:2.0.9-1.fc5
Dependency Installed: lzo.i386 0:1.08-4
Complete!
[root@fedora etc]#

That’s all! yum has been downloaded, checked, and has installed OpenVPN and the LZO libraries.

LEAVE A REPLY

Please enter your comment!
Please enter your name here