cURL shipped with the OS may not be up-to-date, and if you need the newest version for a particular requirement, then you need to build from the source. Lately, I was testing HTTP/3 using cURL with the default shipped version on CentOS, but that didn’t work. BTW, there are more you can do with cURL. However, the latest cURL version (7.67) supports HTTP/3. So, I had only one option – build from the source. This is just one example; you may have some other requirements. The following example is for 7.67 (latest as I write) on CentOS 8.x and Ubuntu 20.x. But the procedure remains the same for any other version.
Prerequisite
Let’s get the required dependencies installed.
Update the system. Though this is optional, I prefer doing so. I always have up-to-date installed packages.
Installing the required packages
Download the latest cURL source – you can refer to their official download page to know the latest version.
Extract the downloaded gz file
It would create a new folder on the present working directory
Building cURL on CentOS/RHEL
Once you’ve downloaded and extracted the latest cURL, it’s time to build them.
Go inside the newly created folder after extraction
Configure with SSL as below
You will see output something like below.
Let’s install them
It will take a few seconds to complete, and once done; you can verify the version to ensure it has installed successfully.
Building cURL on Ubuntu
I assume you have downloaded the latest version as explained in the prerequisite section.
Go to the folder where the downloaded cURL is extractedInstall the dependencies
If you don’t have the above dependencies (binutils) installed then you may get the following error.
And, it’s time to build now with the configure command.
If no error from the above execution, then finally install with the make command.
That’s all!
Verification
Use –version to see the version details. Conclusion You see, its easy when you have the steps. I hope this helps you install cURL from the source.