Installing OpenSSL on Ubuntu Linux

This short tutorial shows you how to install OpenSSL on Ubuntu 12.04. The process is very simple. For this tutorial, I'll be installing openssl version 1.0.1g (released Apr 07, 2014). Linux kernel is 3.2.0-23-powerpc-smp. I have used a Mac Mini (powerpc/ppc architecture). GCC version number is 4.6.3. Your configuration may be different from mine but the installation steps below should work fine for most configurations.

OpenSSL:

According to openssl.org,

"The OpenSSL Project is a collaborative effort to develop a robust, commercial–grade, full–featured, and Open Source toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well as a full-strength general purpose cryptography library. The project is managed by a worldwide community of volunteers that use the Internet to communicate, plan, and develop the OpenSSL toolkit and its related documentation.

Before starting, please check to see if there is a latest version available to download. Visit http://www.openssl.org/source/ to find out about the available versions. IMPORTANT: See Configuring Ubuntu Linux After Installation to install the development tools required to compile and install openssl from source code.

Steps to download, compile, and install are as follows. Note: Replace 1.0.1g with your version number:

  • Downloading OpenSSL:

    Run the command below,

    wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz

    Also, download the MD5 hash to verify the integrity of the downloaded file. In the same folder, where you downloaded the OpenSSL file, do the following:

    wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz.md5
    md5sum openssl-1.0.1g.tar.gz
    cat openssl-1.0.1g.tar.gz.md5

    The last two commands (above) generate two strings of alpha-numeric characters. Check to see if both strings are identical or not. If not, repeat the steps above from "Downloading OpenSSL". If yes, your file has been downloaded properly. Please note that if you are using openssl for a highly secure/critical setup (or for any other reason) then you should also check the PGP signatures (not covered in this tutorial for simplicity).

  • Extracting files from the downloaded package:

    tar -xvzf openssl-1.0.1g.tar.gz

    Now, enter the directory where the package is extracted.

    cd openssl-1.0.1g
  • Configuring OpenSSL:

    ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl

    Replace "/usr/local/openssl" above with the directory path where you want to copy the files and folders. Note: check for any error message.

  • Compiling OpenSSL:

    make

    Note: check for any error message.

  • Installing OpenSSL:

    As root (for privileges on destination directory), run the following.

    With sudo,
    sudo make install

    Without sudo,

    make install

    Note: check for any error messages.

Thats it. OpenSSL has been successfully installed. You can run the version command to see if it worked or not.

/usr/local/openssl/bin/openssl version
OpenSSL 1.0.1g 7 Apr 2014

Did this tutorial help a little? How about buy me a cup of coffee?

Buy me a coffee at ko-fi.com

Please feel free to use the comments form below if you have any questions or need more explanation on anything. I do not guarantee a response.

IMPORTANT: You must thoroughy test any instructions on a production-like test environment first before trying anything on production systems. And, make sure it is tested for security, privacy, and safety. See our terms here.

Comments (write a comment):

I cannot get exactly the same characters in step "downloading Openssl"
I've tried it about 5 times. what to do Posted by: Jeroen on Jun 21, 2011

Yes, you are right. There can be two issues either their site is down (currently not accessible via a browser too) or they came up with a newer version and removed the older version from their server.

I would recommend that you wait another day and try again but also make sure you can access www.openssl.org through a browser first.

I hope this helps.

Thanks. Posted by: Shahryar G on Jun 23, 2011

Please try now, I was able to download it a minute ago.

Thanks. Posted by: Shahryar G on Jun 23, 2011

I am trying to compile this on Ubuntu 11.04. after I type 'make', i would get this error:
http://rt.openssl.org/Ticket/Display.html?user=guest&pass=guest&id=2104

I got the patch downloaded, but not sure how to apply?! please help. Posted by: linda on Jul 28, 2011

Try downloading the latest version from http://openssl.org/source/. That should have the patch applied including other important bug and security fixes. Posted by: Shahryar G on Jul 30, 2011

I was able to follow the steps.. and it went smoothly good.

but the thing that got me confused a little bit was moving the files to /usr/local

what I did was that I copied the line as it is and executed it without problems..

Thanks,
D Posted by: Da a on May 19, 2012

Thank you. It works absolutely fine ! Posted by: Waqar A on May 25, 2012

thanx a lot its really very easy to install Posted by: shashank a on May 06, 2013

Very helpful........Thanks Posted by: yemmy on Sep 19, 2013

DID NO work in Ubuntu 10.04 LTS. Posted by: chillaxin on Apr 16, 2014

@chillaxin: I did not get any errors when I tried on Ubuntu 12.04 (ppc). I was able to compile and install it successfully using the instructions above.


make[1]: Leaving directory `/home/geeksww/openssl-0.9.8e/tools'
installing libcrypto.a
installing libssl.a
cp libcrypto.pc /usr/local/openssl/lib/pkgconfig
chmod 644 /usr/local/openssl/lib/pkgconfig/libcrypto.pc
cp libssl.pc /usr/local/openssl/lib/pkgconfig
chmod 644 /usr/local/openssl/lib/pkgconfig/libssl.pc
cp openssl.pc /usr/local/openssl/lib/pkgconfig
chmod 644 /usr/local/openssl/lib/pkgconfig/openssl.pc
geeksww@desktop:~/openssl-0.9.8e$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.4 LTS"
NAME="Ubuntu"
VERSION="12.04.4 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.4 LTS)"
VERSION_ID="12.04" Posted by: Shahryar on Apr 18, 2014

Works flawless Posted by: andre on Apr 25, 2014

While compiling I am getting below error.
*****************************************************
make[1]: Entering directory `/home/stin/openssl-1.0.1h/test'
gcc -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -march=pentium -Wa,--noexecstack -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -c -o md2test.o md2test.c
md2test.c:1:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
make[1]: *** [md2test.o] Error 1
make[1]: Leaving directory `/home/stin/openssl-1.0.1h/test'
make: *** [build_tests] Error 1
***************************************************** Posted by: Sampath on Jun 11, 2014

Hello! I have the next problems:
make[1]: gcc: Command not found Posted by: Pavel on Jul 15, 2014

Hey, nice post!

Just to point out that the MD5 verification process you described is kind of unnecessary considering that a hacker would change the .md5 file if they had access to the main tar.gz :-) Posted by: Nikolay on Aug 15, 2014

Thank you, this article was of great help to me. Posted by: Frank on Aug 31, 2014

Hi, how to install open ssl as particular user not as root. Posted by: Tejasree on Jun 25, 2015

@Tejasree: not sure how useful it'd be for you but you should be able to install as a regular user to any of the directories where user has permissions (for example, user's home directory).

You just need to mention that directory in config command as --openssldir=~/openssl

Please note that I haven't tested it but you can test in lab/dev first. Posted by: shahryar on Jun 26, 2015

That is old version...
please install this :
wget http://www.openssl.org/source/openssl-1.0.2d.tar.gz1.0.2d

THANKS... Posted by: Payment - on Jul 12, 2015

I have updated openssl 1.0.2e using this method , Now it is showing the new version. But rpm is still showing the old versions. Please confirm and suggest. Posted by: Sandeep on Dec 26, 2015

@sandeep: installing from RPM is different and this tutorial only shows you installation using source which is separate from RPM packages installed on your system. Posted by: shahryar on Feb 02, 2016

hey sorry i can't install
i have a error
I did all the steps, but when I type the following command I'm having trouble
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
this is my warning
No such file or directory Posted by: coal c on Sep 04, 2017

i had this error after i enter 'sudo make install'

created directory `/usr/local/openssl'
created directory `/usr/local/openssl/man'
created directory `/usr/local/openssl/man/man1'
created directory `/usr/local/openssl/man/man3'
created directory `/usr/local/openssl/man/man5'
created directory `/usr/local/openssl/man/man7'
installing man1/CA.pl.1
installing man1/asn1parse.1
installing man1/ca.1
installing man1/ciphers.1
installing man1/cms.1
cms.pod around line 457: Expected text after =item, not a number
cms.pod around line 461: Expected text after =item, not a number
cms.pod around line 465: Expected text after =item, not a number
cms.pod around line 470: Expected text after =item, not a number
cms.pod around line 474: Expected text after =item, not a number
POD document had syntax errors at /usr/bin/pod2man line 68.
Makefile:640: recipe for target 'install_docs' failed
make: *** [install_docs] Error 255 Posted by: Naduni on Nov 02, 2017

/usr/local/openssl exists? Posted by: shahryar on Aug 18, 2018

leave a comment on tutorial leave a comment