第一步:准备安装所需环境,如:ssh、openssl 等:
1.基于基于Debian系统命令(银河麒麟桌面版):
sudo apt-get update
sudo apt-get install build-essential libssl-dev libssh2-1-dev libidn2-0-dev librtmp-dev libnghttp2-dev libkrb5-dev libpsl-dev
2.基于Red Hat的系统命令(银河麒麟服务器版):
sudo yum update
sudo yum groupinstall "Development Tools"
sudo yum install openssl-devel libssh2-devel libidn2-devel librtmp-devel nghttp2-devel krb5-devel libpsl-devel
第二步:下载源码,两种方式:
1.官网下载:https://curl.se/download.html,根据系统版本下载对应的libcurl版本;
2.命令下载方式:
wget https://curl.se/download/curl-7.79.1.tar.gz
tar -zxvf curl-7.79.1.tar.gz
cd curl-7.79.1
第三步:配置configure脚本:注意prefix参数,后面编译完成的库文件就在这个目录中:
./configure --prefix=/usr/local --with-ssl --with-libssh2 --with-libidn2 --with-librtmp --with-nghttp2 --with-libpsl --with-krb5
第四步:编译安装:
make
sudo make install
第五步:验证是否成功:curl --version
第六步:清理编译过程文件:make clean