In this article, I will take you through the steps to install curl on Ubuntu 22.04 LTS. curl is a free and open source command line utility used in Windows, Linux and Unix based systems to transfer data from remote server using URL. It supports almost all the famous protocols including FTP, POP3, SMTP, SCP, TELNET, SMB, HTTP, HTTPS, IMAP, LDAP and TFTP. curl can also be easily integrated with scripting languages such as bash shell scripting.
This tool is pretty famous among developers and testers due to its wide range of features and applications. While it can be easily installed in almost any systems, here we will see the steps to install curl utility on Ubuntu 22.04 LTS based systems.
How to Install curl on Ubuntu 22.04 LTS (Jammy Jellyfish)
Also Read: How to Install netstat on Ubuntu 22.04 LTS (Jammy Jellyfish)
Step 1: Prerequisites
a) You should have a running Ubuntu 22.04 LTS
Server.
b) You should have sudo
or root
access to run privileged commands.
c) You should have apt
or apt-get
utility available in your Server.
Step 2: Update Your Server
If you haven't updated your system from a quite some time, then I would recommend to first run the update and upgrade the installed packages to the latest version by using sudo apt update && sudo apt upgrade
command as shown below.
socialyzehub@ubuntu:~$ sudo apt update && sudo apt upgrade
[sudo] password for socialyzehub:
Hit:1 https://dl.google.com/linux/chrome/deb stable InRelease
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:3 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Get:4 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB]
Get:6 http://security.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [41.6 kB]
Get:7 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 DEP-11 Metadata [18.5 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [467 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [990 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 DEP-11 Metadata [101 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu jammy-updates/restricted i386 Packages [27.1 kB]
Get:12 http://in.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [744 kB]
Get:13 http://in.archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [607 kB]
........................................................
Step 3: Install curl
In the next step, you can install the utility by using any of the below methods.
a) Using apt or apt-get
You can install curl utility from default Ubuntu repo by using sudo apt install curl
command as shown below. This will download and install the package along with all its dependencies.
socialyzehub@ubuntu:~$ sudo apt install curl Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-5.19.0-32-generic linux-hwe-5.19-headers-5.19.0-32 linux-image-5.19.0-32-generic linux-modules-5.19.0-32-generic linux-modules-extra-5.19.0-32-generic Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: curl 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 194 kB of archives. After this operation, 454 kB of additional disk space will be used. Get:1 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 curl amd64 7.81.0-1ubuntu1.10 [194 kB] Fetched 194 kB in 1s (134 kB/s) Selecting previously unselected package curl. (Reading database ... 237185 files and directories currently installed.) Preparing to unpack .../curl_7.81.0-1ubuntu1.10_amd64.deb ... Unpacking curl (7.81.0-1ubuntu1.10) ... Setting up curl (7.81.0-1ubuntu1.10) ... Processing triggers for man-db (2.10.2-1) ...
b) Using snap
You can also choose to install curl as a snap package from Snap store using sudo snap install curl
command as shown below.
socialyzehub@ubuntu:~$ sudo snap install curl curl 8.0.1 from Wouter van Bommel (woutervb) installed
Step 4: Check Version
After installing the utility, you can check the current installed version by using curl --version
command as shown below.
socialyzehub@ubuntu:~$ curl --version curl 8.0.1 (x86_64-pc-linux-gnu) libcurl/8.0.1 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 zstd/1.4.4 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3 libgsasl/1.8.1 Release-Date: 2023-03-20 Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp Features: alt-svc AsynchDNS brotli gsasl GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
Step 5: Using curl
Now that curl utility is installed, it is time to test the utility. For example, here we are testing the utility by checking google.com
remote Port 443
status by using curl -v telnet://google.com:443
command as shown below. This confirms that Port 443
of google.com
is open for connection.
socialyzehub@ubuntu:~$ curl -v telnet://google.com:443 * Trying 142.250.182.14:443... * Connected to google.com (142.250.182.14) port 443 (#0)
Step 6: Uninstall curl
Once you are done using curl, you can choose to uninstall the utility by any of the below method depending on how you have installed it.
a) Using apt or apt-get
If you installed curl utility from default Ubuntu repo, then to uninstall you need to run sudo apt remove curl
command as shown below.
NOTE:
socialyzehub@ubuntu:~$ sudo apt remove curl Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages will be REMOVED: curl 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. After this operation, 454 kB disk space will be freed. Do you want to continue? [Y/n] Y (Reading database ... 200838 files and directories currently installed.) Removing curl (7.81.0-1ubuntu1.10) ... Processing triggers for man-db (2.10.2-1) ...
b) Using snap
If you installed the utility from Snap store, then you need to run sudo snap remove curl
command as shown below.
socialyzehub@ubuntu:~$ sudo snap remove curl curl removed