1. 程式人生 > >OpenSSL 在Windows的安裝(參照官方文件)

OpenSSL 在Windows的安裝(參照官方文件)

開篇說明

優秀成熟的開源專案,文件都是很完備的,不過大多數是英文的。為了準確和快速,以下參照OpenSSL官方說明文件,安裝OpenSSL-1.1.0C.

官方安裝說明文件

  • 1. 主參照文件:INSTALL

    安裝前提:

    To install OpenSSL, you will need:

    • A make implementation
    • Perl 5 with core modules (please read NOTES.PERL)
    • The perl module Text::Template (please read NOTES.PERL)
    • an ANSI C compiler
    • a development environment in the form of development libraries and C
      header files
    • a supported operating system

    安裝步驟:

    • on Unix:
      $ ./config
      $ make
      $ make test
      $ make install

    • on OpenVMS:
      $ @config
      $ mms
      $ mms test
      $ mms install

    • on Windows (only pick one of the targets for configuration):


      $ perl Configure { VC-WIN32 | VC-WIN64A | VC-WIN64I | VC-CE }
      $ nmake
      $ nmake test
      $ nmake install

  • 2. 次參照文件:NOTES.WIN

    依賴軟體:

    In addition to the requirements and instructions listed in INSTALL,
    this are required as well:

    • You need Perl. We recommend ActiveState Perl, available from

      https://www.activestate.com/ActivePerl.
      You also need the perl module Text::Template, available on CPAN. Please read NOTES.PERL for more information.

    • You need a C compiler. OpenSSL has been tested to build with these:
      Visual C++

    • Netwide Assembler, a.k.a. NASM, available from http://www.nasm.us, is required if you intend to utilize assembler modules. Note that NASM is the only supported assembler. The Microsoft provided assembler is NOT supported.

    預設安裝目錄:

    The default installation directories are derived from environment variables.

    • For VC-WIN32, the following defaults are use:
      • PREFIX: %ProgramFiles(86)%\OpenSSL
      • OPENSSLDIR: %CommonProgramFiles(86)%\SSL
    • For VC-WIN64, the following defaults are use:
      • PREFIX: %ProgramW6432%\OpenSSL
      • OPENSSLDIR: %CommonProgramW6432%\SSL

安裝步驟

1. 依賴軟體的安裝

  • VC++

    執行VC\Bin\vcvars32.bat, 將VC加入到系統環境變數

  • ActivePerl 5

  • NASM

    將NASM安裝目錄加入到系統變數PATH中

2. 配置OpenSSL

進入OpenSSL原始碼主目錄,執行:

perl Configure VC-WIN32

配置成功圖例:
配置OpenSSL圖例

3. 編譯構建OpenSSL

執行命令:

nmake

這一步執行的時間較長,實際是VC 的 cl.exe命令編譯連結的過程。
執行結果:
這裡寫圖片描述
編譯前後目錄變化:
這裡寫圖片描述

4. 測試編譯生成的庫

上一步生成了重要的庫檔案:
這裡寫圖片描述

執行命令測試庫檔案的正確性:

nmake test

執行結果:
這裡寫圖片描述

5. 安裝OpenSSL

執行命令:

nmake install

預設安裝目錄:

C:\Program Files\OpenSSL

執行結果:
這裡寫圖片描述