Table of Contents
cURL is a command-line tool used to transfer data between servers using protocols such as HTTP, HTTPS, FTP, and SFTP. It is commonly used for API requests, downloading files, testing endpoints, and server troubleshooting.
Most developers install cURL immediately after deploying a Linux VPS server because many applications, scripts, and package managers depend on it.
Step 1: Connect to the Ubuntu Server
Access the server using SSH:
ssh root@your_server_ip
Step 2: Update Package Information
Refresh the Ubuntu package index:
apt update
Keeping package lists updated helps install the latest available version of cURL.
Step 3: Install cURL on Ubuntu 26.04
Install the cURL package:
apt install curl -y
Ubuntu will automatically download and install all required dependencies.
Step 4: Verify the Installation
Check the installed cURL version:
curl --version
Example output:
curl 8.x.x (x86_64-pc-linux-gnu)
This confirms that cURL is installed successfully.
Step 5: Test cURL with a Website Request
Send a basic HTTP request:
curl https://example.com
To display only the response headers:
curl -I https://example.com
These commands are commonly used for testing web servers and APIs.
Step 6: Download Files Using cURL
Download a file directly from a URL:
curl -O https://example.com/file.zip
Save the file with a custom name:
curl -o backup.zip https://example.com/file.zip
Step 7: Use cURL with APIs
Send a request to a public API:
curl https://api.github.com
cURL is widely used for testing REST APIs and automation scripts on Linux servers.
Many administrators also install Wget on Linux alongside cURL for additional file downloading and automation capabilities.
Step 8: Remove cURL from Ubuntu
If cURL is no longer needed, remove it using:
apt remove curl -y
Installing cURL on Ubuntu 26.04 provides a powerful command-line utility for downloading files, testing network services, and interacting with APIs directly from the terminal.
