Upgrade cUrl from source

Posted on Posted in cUrl

cUrl is a command line tool and library that is used for for transferring data with URLs. It is being used in a number of system tools in linux (ex. yum, apt), it is being used by the websites to communicate with public APIs (ex. PayPal) so it is important to keep it up to date to stay protected.

This article contains the instructions about the way to install the latest cUrl from source package on the CentOS server.

First of all we recommend to download the available rpm packages to have a restore point in case if something goes wrong. The easiest way to do this is to use yum-tools and download the packages from the software repository:
yum -y install yum-utils.noarch
yumdownloader curl libcurl

Next lets install required packages:
yum install libssh2-devel wget make gcc openssl-devel

Download curl:
wget -O /usr/local/src/curl-7.50.3.tar.gz https://curl.haxx.se/download/curl-7.50.3.tar.gz
cd /usr/local/src/ && tzr xf curl-7.50.3.tar.gz && cd curl-7.50.3

There are 2 options to proceed:

  1. If you'd like to have curl installed into isolated folder (ex. opt/curl) run the following configure command:
    ./configure --prefix=/opt/curl --with-ssl --with-libssh2 --with-zlib --with-nghttp2
  2. If you are going to replace the existing cUrl and have it installed into the default system folders, than run the following command (recommended)
    ./configure --prefix=/usr --with-ssl --with-libssh2 --with-zlib --with-nghttp2
  3. If you decided to proceed with option #2 than you'll need to remove currently installed curl:
    rpm -e --nodeps curl

    Now you can install upgraded package:
    make
    make install

    The package fails to be prepared with checkinstall so the only way at this point is to run make install.

    You might need to recompile the software with the new libcurl but PHP works great with upgraded cUrl.

    screenshot-from-2016-09-15-10-18-33

Leave a Reply

Your email address will not be published. Required fields are marked *