RedHatOpenSSLSharedLibs

How to compile Openssl with shared libraries

This has been requested several times by my users, and it was simple to solve, but the solution took me a little while to find.

So there it is:

1. Getting Openssl.

Download Openssl from its web site. I'll assume, in the rest of this example, that the version we are working with is '0.9.8l'.

Unpack the archive with the traditional command:

$  tar xvzf openssl-0.9.8l.tar.gz

Next, enter the directory created by 'tar' with the command:

$ cd /home/andre/compilation/openssl-0.9.8l

2. Configuring Openssl.

Now, here is the difficult part: you do not want to install Openssl in the standard /lib directory, since it would replace the standard Red Hat libraries, and that's a big no-no. What you really want is to store that new version of Openssl out of the way, so that people can use it, without disturbing the system, and adding the shared libraries at the same time.

Here is the magical command to enter to achieve all this:

$ ./config --prefix=/usr/local/OpenSSL-0.9.8l --openssldir=/usr/local/OpenSSL-0.9.8l shared

Here, everything will be neatly tucked into /usr/local/OpenSSL-0.9.8l, without disturbing anything else. And, the shared libraries will be added to this directory. Of course, if you are using a different version from 0.9.8l, replace this by the correct version number.

3. Compiling and installing.

Simple enough:

$ make all
$ make test

Then, as root, enter the compilation directory and simply type:

# make install

And you are done! You can check all the shared libraries are there by entering:

$ ls -alhF /usr/local/OpenSSL-0.9.8l/lib/
total 4.1M
drwxr-xr-x  4 root root 4.0K Dec 28 18:54 ./
drwxr-xr-x  9 root root 4.0K Dec 28 18:54 ../
drwxr-xr-x  2 root root 4.0K Dec 28 18:54 engines/
-rw-r--r--  1 root root 2.1M Dec 28 18:54 libcrypto.a
lrwxrwxrwx  1 root root   18 Dec 28 18:54 libcrypto.so -> libcrypto.so.0.9.8*
-r-xr-xr-x  1 root root 1.4M Dec 28 18:54 libcrypto.so.0.9.8*
-rw-r--r--  1 root root 382K Dec 28 18:54 libssl.a
lrwxrwxrwx  1 root root   15 Dec 28 18:54 libssl.so -> libssl.so.0.9.8*
-r-xr-xr-x  1 root root 284K Dec 28 18:54 libssl.so.0.9.8*
drwxr-xr-x  2 root root 4.0K Dec 28 18:24 pkgconfig/

You can also check the version of the binary, by entering the following:

$ /usr/local/OpenSSL-0.9.8l/bin/openssl version
OpenSSL 0.9.8l 5 Nov 2009

And that's all for now! Hope this helps...