How to Install curl and php-curl on Linux

Curl is a free and open source data transfer tool used for transfer of data to and from a server using the following supported protocols: IMAP, IMAPS, POP, POP3, POP3S, DICT, FILE HTTP, HTTPS, SMB, SMBS, SMTP, SMTPS, FTP, FTPS, TELNET, RTSP, RMTP and TFTP.

During its normal operation, it displays a meter-like progress bar indicating parameters such as data transfer speed, amount of data transferred, and estimated time left. The speed is indicated in bytes per second. Let's see how we can install curl and php-curl in various Linux distributions.

Ubuntu 18.04, 17.10 and Debian 9.3

Login as root and update your Ubuntu system first

apt-get update

Install curl

apt-get install curl

Install php-curl

PHP 7.0

apt-get install php-curl

PHP 5.6

apt-get install php5.6-curl

PHP 5.5

apt-get install php5.5-curl

Verify curl is installed and check its version

dpkg -l curl

dpkg -l curl

From source

Visit curl's website and download the latest curl version by copying the link and using wget command

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

Uncompress the tarball file using the tar command below

tax -xvf curl-7.57.0.tar.gz

Navigate to the uncompressed folder

cd curl-7.57.0

You'll require the C compiler to build the source code. Install the C compiler as shown below.

apt-get install build-essential

Run the commands below in succession to compile the source code

./configure
make
make install

Centos 7

Login as  root and run

yum install curl

Installing php-curl

yum install php-curl

From source

Just like we did in Ubuntu 17.10, navigate to curl's website and download the curl tarball.

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

Uncompress the tarball

tax -xvf curl-7.57.0.tar.gz

Navigate to the uncompressed folder

cd curl-7.57.0

Centos 7 comes already installed with a C compiler. Run the commands below to compile the source code

./configure
make
make install

Verify installation of curl

curl --verison

curl --version centos 7

Fedora 27

NOTE Fedora 27 comes pre-installed with curl.

To install php-curl simply log in as root and run

dnf -y install php-curl

Verify installation of curl

curl --verison

php-curl fedora

Arch 2017 Linux

First, log in as root and update the system

pacman -Sy

Install curl

pacman -S curl

Verify whether curl in installed

pacman -Qi curl

Alpine Linux 3.7

Run apk add curl

apk add curl

alpine-curl

Verify installation of Curl

 apk search curl

apk-search curl

Curl is the backbone of internet data transfer for thousands of software applications using a myriad of protocols. Being free and open source has enabled many contributors to work on the curl project and continually come up with newer and improved versions.

Jamie Arthur 3:17 am

About Jamie Arthur

Hey, I'm James, a passionate Linux Systems administrator, and a tech enthusiast. I derive immense gratification in conducting research on Linux systems and keeping myself up to date with the latest in the technology world.

Author Archive Page

Have anything to say?

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

All comments are subject to moderation.