In the world of web development, networking, and data transfer, there’s a powerful tool that often flies under the radar – Curl. This versatile command-line utility has been around for decades and remains one of the most trusted tools for various tasks, such as fetching data from URLs, uploading files, testing APIs, and more. In this blog, we’ll explore what Curl is, how to install latest Curl on Linux system, and some of the common use cases that make it an essential tool for developers and sysadmins alike.
What is Curl?
Curl stands for Client URL, and it is a command-line tool used to transfer data to or from a server, supporting various protocols like HTTP, HTTPS, FTP, FTPS, SCP, SFTP, LDAP, and more. It was developed by Daniel Stenberg in the late 1990s and is open-source software, available on a wide range of platforms, including Windows, macOS, and Linux.
Curl Versions and Release date history:
Versions | Released Dates | Since |
8.2.1 | Jul 26 2023 | Latest |
7.88.1 | Feb 20 2023 | 4 months |
6.5.2 | Mar 21 2000 | 23.3 years |
5.11 | Aug 25 1999 | 23.9 years |
4.10 | Oct 26 1998 | 24.7 years |
Steps to install latest Curl on Linux
Currently it doesn’t come with installation package for all platforms. The best way to install Curl is to download binaries from Curl official websites. This tutorial will help you to install latest curl on Linux systems like CentOS, RHEL, Oracle Linux, Rocky Linux, AlmaLinux, Ubuntu or Debian.
Prerequisites:
- sudo privileges.
- Stable internet connection.
First check server OS version then start installation as per OS version:
# egrep '^(VERSION|NAME)=' /etc/os-release
Check installed Curl version:
Before installing Curl, check already installed Curl version on system:
# curl --version
Install latest Curl Using Package Manager on RHEL family
We can install it on CentOS, RHEL, Oracle Linux, Rocky Linux and AlmaLinux using 3rd party repo – city-fan.org-release
Note: Please always check city-fan.org-release repo to install latest one and it may also require dependencies from the EPEL Repository.
# yum install epel-release -y
# rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-3-8.rhel7.noarch.rpm
Then try to update to latest one:
# yum update curl
Install latest Curl using source code on Linux
Install the prerequisite packages:
For RHEL, CentOS and Oracle Linux 7 server
# yum install nghttp2 openssl-devel wget gzip unzip -y
# yum group install 'Development Tools' -y
For RHEL, CentOS, Oracle Linux or Rocky Linux 8 and 9 server
# dnf install nghttp2 openssl-devel wget gzip unzip-y
# dnf group install 'Development Tools' -y
For Ubuntu and Debian server
# apt update -y
# apt install build-essential nghttp2 libnghttp2-dev libssl-dev wget gzip unzip -y
Download the latest source code – Refer to official download page to know the latest version.
# cd /tmp && wget https://curl.se/download/curl-8.2.1.tar.gz
Next step is unzip downloaded zip file and go to unzip directory:
# tar -xzvf curl-8.2.*.tar.gz && rm -rf curl-8.2.*.tar.gz && cd curl-8.2.*
Configure downloaded Curl source code with ssl and http2:
# ./configure --prefix=/usr/local --with-ssl --with-nghttp2
And finally, compile source code:
Note: This process might be take a while.
# make && make install
That’s it. Now we installed the latest version of Curl on Linux system.
Basic Curl Command Syntax
Let’s learn how to use cURL commands. The basic syntax of cURL looks like this:
# curl [OPTIONS] [URL]
The simplest use of cURL is to display the contents of a page. The below example will render the home web page of maggiminutes.com.
# curl maggiminutes.com
This will render the complete source code of the homepage for the domain. If no protocol is specified curl will interpret this to HTTP.
Please check curl commands syntax with example here.
Conclusion
Curl, the versatile command-line tool, has proven its worth time and again in the world of web development and networking. Its ability to handle a wide range of protocols and customizable options make it an indispensable utility for developers, system administrators, and anyone working with data transfers, APIs, or web servers. Embrace Curl’s power, incorporate it into your workflows, and see how it simplifies your data transfer tasks while providing valuable insights into network interactions.
Happy Curling!