在Ubuntu中安装openssl

来源:互联网 发布:手机淘宝6.5.0旧版本 编辑:程序博客网 时间:2024/05/01 07:28

ubuntu12.04上自带安装了1.0.1版本的OpenSSL,由于需要调试1.0.1m版本的代码,所以在官网上下载openssl1.0.1m源码包进行安装。但在安装过程中出现以下错误:

md2test.c:1:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token

通过google找到解决方法:
The problem is that md2test.c is actually a symbolic link, or symlink to dummytest.c.If you extracted openssl-1.0.1m.tar.gz with anything other than tar xf openssl-1.0.1m.tar.gz then these symlinks were not preserved.

正是因为解压方式不对导致该错误,重新解压便能成功安装。安装过程如下:

  • 解压文件
    tar -xf openssl-1.0.1m.tar.gz
  • 配置
    ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
  • 编译
    make
  • 安装
    sudo make install

  • 设置环境变量
    sudo gedit ~/.bashrc
    在最后一行添加export PATH=/usr/local/openssl/bin:$PATH 保存退出,使用source ~/.bashrc使其立即生效。

1 0