Linux中安裝SSL協議依賴庫OpenSSL的教程

來源:互聯網
上載者:User

0.由一個錯誤引入

代碼如下:

fatal error: openssl/aes.h: No such file or directory

如果你在編譯時間遇到這個錯誤,這可能是下面的原因:你嘗試編譯的程式使用OpenSSL,但是需要和OpenSSL連結的檔案(庫和標頭檔)在你Linux平台上缺少。

要解決這個問題,你需要安裝OpenSSL 開發包,這在所有的現代Linux發行版的標準軟體倉庫中都有。

要在Debian、Ubuntu或者其他衍生版上安裝OpenSSL:

代碼如下:

$ sudo apt-get install libssl-dev

要在Fedora、CentOS或者RHEL上安裝OpenSSL開發包:

代碼如下:

$ sudo yum install openssl-devel

下面我們再來看一下下載壓縮包自己安裝的方式:

1. 下載

代碼如下:

# wget ftp://ftp.openssl.org/source/openssl-1.0.1g.tar.gz

# tar openssl-1.0.1g.tar.gz

# cd openssl-1.0.1g

2. 確認和安裝

代碼如下:

# ./config shared zlib

# make

# make install

3. 串連

代碼如下:

# mv /usr/bin/openssl /usr/bin/openssl.OFF

# mv /usr/include/openssl /usr/include/openssl.OFF

# ln –s /usr/local/ssl/bin/openssl /usr/bin/openssl

# ln –s /usr/local/ssl/include/openssl /usr/include/openssl

# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf

# ldconfig -v

4. 驗證

代碼如下:

openssl version

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.