CentOS 7 安装 libcurl with openssl;Ubuntu 安装 libcurl with openssl

最近项目需要重新编译libcurl 使其支持ssl,在这里进行记录:

下载openssl : curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.zip

创建安装目录:/opt/openssl 

配置openssl动态库:./config --prefix=/opt/openssl --shared  # 默认安装在 /usr/local/lib下; 但是会与先有的openssl 冲突;建议安装到另外一个文件夹中,方便配合libcurl编译;

编译:make -j 30 && make install 

编译libcurl 

下载curl 源码:https://curl.haxx.se/download.html 

我使用的版本:https://curl.haxx.se/download/curl-7.71.1.tar.gz

创建装目录:/opt/libcurl 

编译:./configure --with-ssl=/opt/openssl # 默认安装在 /usr/local/lib下; --prefix=/opt/libcurl, 我选择安装到默认位置,/usr/local下;

安装:make -j 30 && make install 

配置 LD_LIBRARY_PATH 环境变量,或者库位置,即可引入到项目中;项目编译时,我使用libcurl安装位置的是默认位置,方便配置;openssl 是安装在 /opt/openssl下;通过上述步骤,简单解决了环境依赖问题;

Ubuntu 环境安装libcurl with ssl 支持:

apt install libcurl4-openssl-dev # 用软件源中直接安装libcurl4-openssl库

保持更新,转载请注明出处;更多内容请关注cnblogs.com/xuyaowen; 

posted @ 2020-07-16 22:26  Michael-Xu  阅读(3005)  评论(0编辑  收藏  举报