Update curl version under Linux

1. Prospects

Because the low version of curl has certain loopholes, it will cause problems for our server security, so we need to install curl from the low version to the high version.

Two, steps

1. First detect the curl version installed on the server

curl --version

2. View the curl installation package installed on the server

rpm -qa curl

 3. Uninstall the old version of curl

rpm -e --nodeps curl-7.29.0-59.el7_9.1.x86_64

Note: Use yum remove curl to uninstall directly, and an error will be reported. Other software depends on it and cannot be uninstalled, so you must force uninstall rpm -e --nodeps

4. Download curl package

You can find the latest version on this website  http://curl.haxx.se/download/ , we download the latest version 7.87.0

wget https://curl.haxx.se/download/curl-7.87.0.tar.gz

Note: You can also download directly to the local and then upload to the server

5. Unzip the installation package

tar -xzvf curl-7.87.0.tar.gz

6. Enter the curl-7.87.0 directory

cd curl-7.87.0

7. Execute the command

./configure --prefix=/usr/local/curl --with-ssl

8. Compile and install

(1) compile

make

 、

Note: If an error is reported in this step

make[1]: *** [server.o] Error 1

make[1]: Leaving directory 

make: *** [install] Error 2

 First check the gcc version

gcc -v

 

 Upgrade gcc version

yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

 Modify the gcc version

scl enable devtoolset-9 bash
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile

Check the gcc version again

gcc -v

 

After modification, re-execute make

 (2) Installation

make install

 9. Add environment variables

vim /etc/profile

Add the following at the end of the file:

export PATH=$PATH:/usr/local/curl/bin

10. Load environment variables

source /etc/profile

 11. View curl version

curl --version
curl -V

 In this way, the update installation is successful

Guess you like

Origin blog.csdn.net/wd520521/article/details/128693792