Compile and install openssl in Linux and generate the dynamic system connection Library dynamic/shared libraries

Source: Internet
Author: User
Tags chmod install openssl openssl install perl


Openssl: a multi-purpose command line tool. Each function is implemented using sub-commands.
Libcrypto: public encryption library (stores various encryption algorithms)
Libssl: implementation of the ssl protocol

Yum-y install perl gcc

Http://zlib.net/zlib-1.2.8.tar.gz wget-4
Tar-zxvf zlib-1.2.8.tar.gz
Cd zlib-1.2.8
./Configure -- shared
Make
Make install

Cp libz. a/usr/local/lib
Chmod 644/usr/local/lib/libz.
Cp libz. so.1.2.8/usr/local/lib
Chmod 755/usr/local/lib/libz. so.1.2.8
Cp zlib.3/usr/local/share/man/man3
Chmod 644/usr/local/share/man/man3/zlib.3
Cp zlib. pc/usr/local/lib/pkgconfig
Chmod 644/usr/local/lib/pkgconfig/zlib. pc
Cp zlib. h zconf. h/usr/local/include
Chmod 644/usr/local/include/zlib. h/usr/local/include/zconf. h

Wget-4 -- no-check-certificate https://www.openssl.org/source/openssl-1.0.1t.tar.gz
Tar-zxvf openssl-1.0.1t.tar.gz
Cd openssl-1.0.1t
./Config -- prefix =/usr shared zlib
Make
Make install

Installing libcrypto.
Installing libssl.
Installing libcrypto. so.1.0.0
Installing libssl. so.1.0.0
Make [1]: Entering directory '/usr/lib64'
Make [2]: Entering directory '/usr/lib64'
Make [2]: Leaving directory '/usr/lib64'
Make [2]: Entering directory '/usr/lib64'
Make [2]: Leaving directory '/usr/lib64'
Make [1]: Leaving directory '/usr/lib64'
Cp libcrypto. pc/usr/lib64/pkgconfig
Chmod 644/usr/lib64/pkgconfig/libcrypto. pc
Cp libssl. pc/usr/lib64/pkgconfig
Chmod 644/usr/lib64/pkgconfig/libssl. pc
Cp openssl. pc/usr/lib64/pkgconfig
Chmod 644/usr/lib64/pkgconfig/openssl. pc

Another config method
./Config -- prefix =/usr/local/openssl-fPIC shared zlib
Cp-r/usr/local/openssl/include/openssl/usr/include/openssl Include stores the header files required for using OpenSSL libraries.
Cp-r/usr/local/openssl/lib/*/usr/lib64
In this way, you can continue to compile nginx.

#-FPIC: the dynamic link library in Linux. The "standard" approach is to compile the Code into Position Independent Code (PIC) and link it into a dynamic link library, it can run normally without being added, but it is created. so will have a warning.
# The ldd command is used to print the list of shared libraries that the program or library files depend on.

Ldd $ (which nginx)
Linux-vdso.so.1 => (0x00007fff079e7000)
Libdl. so.2 =>/lib64/libdl. so.2 (0x00007fbceb888000)
Libpthread. so.0 =>/lib64/libpthread. so.0 (0x00007fbceb66b000)
Libcrypt. so.1 =>/lib64/libcrypt. so.1 (0x00007fbceb433000)
Libpcre. so.0 =>/lib64/libpcre. so.0 (0x00007fbceb206000)
Libssl. so.1.0.0 =>/usr/lib64/libssl. so.1.0.0 (0x00007fbceafa2000)
Libcrypto. so.1.0.0 =>/usr/lib64/libcrypto. so.1.0.0 (0x00007fbceabc2000)
Libz. so.1 =>/lib64/libz. so.1 (0x00007fbcea9ac000)
Libc. so.6 =>/lib64/libc. so.6 (0x00007fbcea618000)
/Lib64/ld-linux-x86-64.so.2 (0x00007fbceba91000)
Libfreebl3.so =>/lib64/libfreebl3.so (0x00007fbcea414000)

If the -- prefix =/usr directory is another directory, you need to use ldconfig (a dynamic link library management command) to make the dynamic link library shared by the system
Echo "/usr/local/openssl/lib">/etc/ld. so. conf # Not Required
Ldconfig-v
Ldconfig is related to running the program and compilation.

Dynamic/shared libraries
/Lib/lib64 is kernel-level
/Usr/lib/usr/lib64 is system-level
/Usr/local/lib/usr/local/lib64 is user-level

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.