Compile openvpn on Debian

First download the latest source tarball from OpenVPN

wget http://swupdate.openvpn.org/community/releases/openvpn-2.3.2.tar.gz

Extract and try to configure:

wget http://swupdate.openvpn.org/community/releases/openvpn-2.3.2.tar.gz
tar xf openvpn-2.3.2.tar.gz
cd openvpn-2.3.2
./configure

Here, you get the first error:

ssl is required but missing openvpn

Fix:

apt-get install libssl-dev

Try again and you get:

configure: error: lzo enabled but missing

Fix:

apt-get install liblzo2-dev

And then:

configure: error: libpam required but missing

Fix:

apt-get install libpam0g-dev

Now, configuration and make will work.

Summary:

apt-get install libssl-dev liblzo2-dev libpam0g-dev build-essential -y
wget http://swupdate.openvpn.org/community/releases/openvpn-2.3.2.tar.gz
tar xf openvpn-2.3.2.tar.gz
cd openvpn-2.3.2
./configure
make
make install

Tip: In most cases, when you get prompted that something is missing, try searching for it in apt-cache.
Eg:
ssl is required but missing

I’d search:

#apt-cache search 'openssl'
libace-ssl-5.7.7 - ACE secure socket layer library
aolserver4-nsopenssl - AOLserver 4 module: module for SSL mode
libcrypt-ssleay-perl - Support for https protocol in LWP
cryptmount - Management of encrypted file systems
cryptonit - A client side PKI (X.509) cryptographic tool
libengine-pkcs11-openssl - OpenSSL engine for PKCS#11 modules
erlang-crypto - Erlang/OTP cryptographic modules
etpan-ng - console mail user agent based on libEtPan!
fp-units-net - Free Pascal - networking units
gjots2 - A simple jotter (outline processor) for X11/gtk-gnome
globus-gsi-openssl-error-dbg - Globus Toolkit - Globus OpenSSL Error Handling Debug Symbols
libglobus-gsi-openssl-error-dev - Globus Toolkit - Globus OpenSSL Error Handling Development Files
libglobus-gsi-openssl-error-doc - Globus Toolkit - Globus OpenSSL Error Handling Documentation Files
libglobus-gsi-openssl-error0 - Globus Toolkit - Globus OpenSSL Error Handling
globus-openssl-module-dbg - Globus Toolkit - Globus OpenSSL Module Wrapper Debug Symbols
libglobus-openssl-module-dev - Globus Toolkit - Globus OpenSSL Module Wrapper Development Files
libglobus-openssl-module-doc - Globus Toolkit - Globus OpenSSL Module Wrapper Documentation Files
libglobus-openssl-module0 - Globus Toolkit - Globus OpenSSL Module Wrapper
globus-openssl-progs - Globus Toolkit - Openssl Library Programs
libglobus-openssl-dev - Globus Toolkit - Openssl Library Development Files
libglobus-openssl - Globus Toolkit - Openssl Library
libghc6-sha-dev - Haskell SHA suite of message digest functions - GHC 6 libraries
libghc6-sha-doc - Haskell SHA suite of message digest functions - documentation
libghc6-sha-prof - Haskell SHA suite of message digest functions - GHC 6 profiling libraries
liblwt-ocaml-doc - cooperative light-weight thread library (documentation)
liblwt-ssl-ocaml-dev - cooperative OpenSSL bindings for OCaml
libcrypt-openssl-bignum-perl - Access OpenSSL multiprecision integer arithmetic libraries
libcrypt-openssl-dsa-perl - module which implements the DSA signature verification system
libcrypt-openssl-random-perl - Access to the OpenSSL pseudo-random number generator
libcrypt-openssl-rsa-perl - Perl module providing basic RSA functionality
libcrypt-openssl-x509-perl - Perl extension to OpenSSL's X509 API
libengine-tpm-openssl - OpenSSL engine for TPM modules
libruby-extras - a bundle of additional libraries for Ruby
libruby1.8-extras - a bundle of additional libraries for Ruby 1.8
mcrypt - Replacement for old unix crypt(1)
libapache2-mod-gnutls - Apache module for SSL and TLS encryption with GnuTLS
libneon27 - An HTTP and WebDAV client library
libssl-ocaml-dev - OCaml bindings for OpenSSL
libssl-ocaml - OCaml bindings for OpenSSL (runtime)
openssl-blacklist-extra - list of non-default blacklisted OpenSSL RSA keys
openssl-blacklist - list of blacklisted OpenSSL RSA keys
libssl-dev - SSL development libraries, header files and documentation
libssl0.9.8-dbg - Symbol tables for libssl and libcrypto
libssl0.9.8 - SSL shared libraries
openssl - Secure Socket Layer (SSL) binary and related cryptographic tools
openvpn - virtual private network daemon
libpathfinder-dev - Development files for pathfinder
libpathfinder-openssl-1 - Pathfinder integration Library for OpenSSL
libpion-common-3.0 - lightweight HTTP interface library - common runtime files
libpion-common-dbg - lightweight HTTP interface library - common debug files
libpion-common-dev - lightweight HTTP interface library - common development files
libpion-net-3.0 - lightweight HTTP interface library - runtime files
libpion-net-dbg - lightweight HTTP interface library - debug files
libpion-net-dev - lightweight HTTP interface library - development files
libpion-net-doc - lightweight HTTP interface library - documentation
libpion-net-plugins-dbg - lightweight HTTP interface library - plugins debug files
libpion-net-plugins - lightweight HTTP interface library - plugins
libpoconetssl9-dbg - The C++ Portable Components Network library with SSL, dbg version
libpoconetssl9 - The C++ Portable Components Network library with SSL
pyca - Certification Authority written in Python
python-openssl-dbg - Python wrapper around the OpenSSL library (debug extension)
python-openssl-doc - Python wrapper around the OpenSSL library (documentation package)
python-openssl - Python wrapper around the OpenSSL library
libqca2-plugin-ossl - QCA OSSL plugin for libqca2
libruby - Libraries necessary to run Ruby 1.8.x
libruby1.8 - Libraries necessary to run Ruby 1.8
libruby1.9.1 - Libraries necessary to run Ruby 1.9.1
ssl-cert - simple debconf wrapper for OpenSSL
stone - TCP/IP packet repeater in the application layer
libjs-strophe - Library for writing XMPP clients
tcl-tls - the TLS OpenSSL extension to Tcl
tinyca - simple graphical program for certification authority management
libtcnative-1 - Tomcat native library using the apache portable runtime
libxmlsec1-openssl - Openssl engine for the XML security library
libcurl3 - Multi-protocol file transfer library (OpenSSL)
libcurl3-dbg - libcurl compiled with debug symbols
libcurl4-openssl-dev - Development files and documentation for libcurl (OpenSSL)
libapache2-mod-php5 - server-side, HTML-embedded scripting language (Apache 2 module)
libapache2-mod-php5filter - server-side, HTML-embedded scripting language (apache 2 filter module)
php5-cgi - server-side, HTML-embedded scripting language (CGI binary)
php5-cli - command-line interpreter for the php5 scripting language

Narrow down the result by searching for dev libraries:

#apt-cache search 'openssl' | grep --color 'dev'
libglobus-gsi-openssl-error-dev - Globus Toolkit - Globus OpenSSL Error Handling Development Files
libglobus-openssl-module-dev - Globus Toolkit - Globus OpenSSL Module Wrapper Development Files
libglobus-openssl-dev - Globus Toolkit - Openssl Library Development Files
libghc6-sha-dev - Haskell SHA suite of message digest functions - GHC 6 libraries
liblwt-ssl-ocaml-dev - cooperative OpenSSL bindings for OCaml
libssl-ocaml-dev - OCaml bindings for OpenSSL
libssl-dev - SSL development libraries, header files and documentation
libpathfinder-dev - Development files for pathfinder
libpion-common-dev - lightweight HTTP interface library - common development files
libpion-net-dev - lightweight HTTP interface library - development files
libcurl4-openssl-dev - Development files and documentation for libcurl (OpenSSL)

It’s quite clear now that the lib we need is libssl-dev

Similiarly with “lzo enabled but missing”:

#apt-cache search lzo | grep --color 'dev'
liblzo2-dev - data compression library (development files)

And with “libpam required but missing”:

#apt-cache search libpam | grep --color 'dev'
libpam-blue - PAM module for local authenticaction with bluetooth devices
libpam-usb - PAM module for authentication with removable USB block devices
libpam-ocaml-dev - OCaml bindings for the PAM library (development files)
libpam-devperm - PAM module to change device ownership on login
libpam0g-dev - Development files for PAM
libpasswdqc-dev - password strength checking and policy enforcement library (C development files)

Sometimes you might get this:

~# apt-get install libssl-dev liblzo2-dev libpam0g-dev build-essential -y
Reading package lists… 64%
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package libpam0g-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libpam-runtime