{"id":12945,"date":"2019-03-29T03:44:52","date_gmt":"2019-03-29T03:44:52","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12945"},"modified":"2019-03-29T03:44:52","modified_gmt":"2019-03-29T03:44:52","slug":"how-to-install-openssl-from-source-in-centos-and-ubuntu","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/29\/how-to-install-openssl-from-source-in-centos-and-ubuntu\/","title":{"rendered":"How to Install OpenSSL from Source in CentOS and Ubuntu"},"content":{"rendered":"<p><strong>OpenSSL<\/strong>\u00a0is a full-featured software library that contains an open-source implementation of the\u00a0<strong>Transport Layer Security<\/strong>\u00a0(<strong>TLS<\/strong>) and\u00a0<strong>Secure Sockets Layer<\/strong>\u00a0(<strong>SSL<\/strong>) protocols, used for securing information transmitted over computer networks.<\/p>\n<p>It is a general-purpose cryptography library and supports a number of different cryptographic algorithms including AES, Blowfish; MD5, MD4, SHA-1, SHA-2 cryptographic hash functions; RSA, DSA, Diffie\u2013Hellman key exchange, Elliptic curve and many others.<\/p>\n<p>In this article, we will explain how to install the latest stable version of\u00a0<strong>OpenSSL<\/strong>\u00a0from sources on\u00a0<strong>CentOS<\/strong>\u00a0and\u00a0<strong>Ubuntu<\/strong>\u00a0based distributions.<\/p>\n<h3>Step 1: Install Development Tools<\/h3>\n<p><strong>1.<\/strong>\u00a0To compile\u00a0<strong>OpenSSL<\/strong>\u00a0manually from sources, you need to first install few dependencies such as\u00a0<strong>\u201cDevelopment Tools\u201d<\/strong>\u00a0under\u00a0<strong>RHEL\/CentOS\/Fedora<\/strong>\u00a0or\u00a0<strong>\u201cbuild-essential\u201d<\/strong>\u00a0in\u00a0<strong>Debian\/Ubuntu<\/strong>\u00a0as shown.<\/p>\n<pre><strong>------------------- On CentOS, RHEL &amp; Fedora -------------------<\/strong> \r\n# yum group install 'Development Tools' &amp;&amp; yum install perl-core libtemplate-perl zlib-devel \r\n\r\n<strong>------------------- On Ubuntu &amp; Debian -------------------<\/strong>\r\n$ sudo apt update &amp;&amp; apt install build-essential checkinstall zlib1g-dev libtemplate-perl\r\n<\/pre>\n<h3>Step 2: Compile OpenSSL from Sources<\/h3>\n<p><strong>2.<\/strong>\u00a0Next, download the latest stable version of\u00a0<strong>OpenSSL<\/strong>\u00a0(<strong>v1.0.2<\/strong>\u00a0at the time of writing, which is a\u00a0<strong>Long Term Support<\/strong>\u00a0(<strong>LTS<\/strong>) release, supported until\u00a0<strong>31st December 2019<\/strong>), from the download page using following\u00a0<a href=\"https:\/\/www.tecmint.com\/10-wget-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">wget command<\/a>\u00a0and unpack it using\u00a0<a href=\"https:\/\/www.tecmint.com\/18-tar-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">tar command<\/a>.<\/p>\n<pre>$ wget -c https:\/\/www.openssl.org\/source\/openssl-1.0.2p.tar.gz\r\n$ tar -xzvf openssl-1.0.2p.tar.gz\r\n<\/pre>\n<p><strong>3.<\/strong>\u00a0Now, move into the extracted directory, configure, build, after a successful build, test the libraries and install OpenSSL in the default location, which is\u00a0<strong>\/usr\/local\/ssl<\/strong>, by running the following commands.<\/p>\n<pre>$ cd openssl-1.0.2p\/\r\n$ .\/config\r\n$ make\r\n$ make test\r\n$ sudo make install \r\n<\/pre>\n<p><strong>4.<\/strong>\u00a0Once you have successfully installed\u00a0<strong>OpenSSL<\/strong>, you can move into the installation directory and view the various sub-directories and files using\u00a0<a href=\"https:\/\/www.tecmint.com\/tag\/linux-ls-command\/\" target=\"_blank\" rel=\"noopener\">ls command<\/a>.<\/p>\n<pre>$ cd \/usr\/local\/ssl\/\r\n<strong>$ ls -l<\/strong>\r\n\r\ndrwxr-xr-x. 2 root root  4096 Aug 22 06:37 bin\r\ndrwxr-xr-x. 2 root root  4096 Aug 22 06:37 certs\r\ndrwxr-xr-x. 3 root root  4096 Aug 22 06:37 include\r\ndrwxr-xr-x. 4 root root  4096 Aug 22 06:37 lib\r\ndrwxr-xr-x. 6 root root  4096 Aug 22 06:36 man\r\ndrwxr-xr-x. 2 root root  4096 Aug 22 06:37 misc\r\n-rw-r--r--. 1 root root 10835 Aug 22 06:37 openssl.cnf\r\ndrwxr-xr-x. 2 root root  4096 Aug 22 06:37 private\r\n<\/pre>\n<p>The following are important directories you need to take note of:<\/p>\n<ul>\n<li><strong>bin<\/strong>\u00a0\u2013 contains the openssl binary and some utility scripts.<\/li>\n<li><strong>include\/openssl<\/strong>\u00a0\u2013 contains the header files needed for building your own programs that use libcrypto or libssl.<\/li>\n<li><strong>lib<\/strong>\u00a0\u2013 contains the OpenSSL library files.<\/li>\n<li><strong>lib\/engines<\/strong>\u00a0\u2013 contains the OpenSSL dynamically loadable engines.<\/li>\n<li><strong>man<\/strong>\u00a0\u2013 contains the OpenSSL man-pages.<\/li>\n<li><strong>share\/doc\/openssl\/html<\/strong>\u00a0\u2013 contains HTML rendition of the man-pages.<\/li>\n<li><strong>certs<\/strong>\u00a0\u2013 the default location for certificate files.<\/li>\n<li><strong>private<\/strong>\u00a0\u2013 the default location for private key files.<\/li>\n<\/ul>\n<p><strong>5.<\/strong>\u00a0To check the version of\u00a0<strong>OpenSSL<\/strong>\u00a0you have just installed, run the following command.<\/p>\n<pre><strong>$ \/usr\/local\/ssl\/bin\/openssl version<\/strong>\r\n\r\nOpenSSL 1.0.2p  14 Aug 2018\r\n<\/pre>\n<p><strong>6.<\/strong>\u00a0To use the newly installed\u00a0<strong>OpenSSL<\/strong>\u00a0version on your system, you need to add the directory\u00a0<strong>\/usr\/local\/ssl\/bin\/<\/strong>to your\u00a0<strong>PATH<\/strong>, in the file\u00a0<strong>~\/.bashrc<\/strong>\u00a0(or the equivalent for your shell).<\/p>\n<pre>$ vim ~\/.bashrc\r\n<\/pre>\n<p>Add this line at the bottom of the file.<\/p>\n<pre>export PATH=\"\/usr\/local\/ssl\/bin:${PATH}\"<\/pre>\n<p>Save and close the file and reload the configuration using the command below.<\/p>\n<pre>$ source .bashrc\r\n<\/pre>\n<p><strong>7.<\/strong>\u00a0Now open a new terminal window and run the following commands to confirm that the new\u00a0<strong>OpenSSL<\/strong>\u00a0binary is located in your\u00a0<strong>PATH<\/strong>\u00a0and that you can run it without typing its full path.<\/p>\n<pre><strong>$ whereis openssl<\/strong>\r\n\r\nopenssl: \/usr\/bin\/openssl \/usr\/lib64\/openssl \/usr\/include\/openssl \/usr\/local\/ssl\/bin\/openssl \/usr\/share\/man\/man1\/openssl.1ssl.gz\r\n<\/pre>\n<pre><strong>$ openssl version<\/strong> \t\r\n\r\nOpenSSL 1.0.2p  14 Aug 2018\r\n<\/pre>\n<p>That\u2019s all! In this article, we have explained how to install the latest\u00a0<strong>OpenSSL<\/strong>\u00a0version from source on Linux systems. If you have any questions, use the command form below to reach us.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/install-openssl-from-source-in-centos-ubuntu\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenSSL\u00a0is a full-featured software library that contains an open-source implementation of the\u00a0Transport Layer Security\u00a0(TLS) and\u00a0Secure Sockets Layer\u00a0(SSL) protocols, used for securing information transmitted over computer networks. It is a general-purpose cryptography library and supports a number of different cryptographic algorithms including AES, Blowfish; MD5, MD4, SHA-1, SHA-2 cryptographic hash functions; RSA, DSA, Diffie\u2013Hellman key exchange, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/29\/how-to-install-openssl-from-source-in-centos-and-ubuntu\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Install OpenSSL from Source in CentOS and Ubuntu&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12945","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12945"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12945\/revisions"}],"predecessor-version":[{"id":12946,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12945\/revisions\/12946"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}