Cyberithub

How to Install curl on Debian 10/11 in 6 Easy Steps

Advertisements

In this article, I will take you through the steps to install curl on Debian 10/11 in 6 Easy Steps. curl is a tool for transferring data from or to a server. It is probably one of the most used utility in Linux to transfer the data from Server. Developers and programmers uses this command very frequently to perform API testing and other important tasks. It supports these protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET or TFTP. The command is designed to work without user interaction. More about curl utility.

How to Install curl on Debian 10/11 in 6 Easy Steps

How to Install curl on Debian 10/11 in 6 Easy Steps

Also Read: How to Install jq(JSON Processor on Debian 10/11)

Step 1: Prerequisites

a) You should have a running Debian 10/11 Server.

b) You should have sudo or root access to run privileged commands.

c) You should have apt or apt-get utility installed in your Server.

 

Step 2: Update Your Server

It is always better to first update your installed packages with the latest stable version available from the Debian repo using apt update or apt-get update command. This will prevent any unforeseen issues which might come up due to older version of dependent packages installed in the System.

root@debian:~# apt update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Hit:2 http://deb.debian.org/debian bullseye InRelease
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main Sources [38.9 kB]
Get:5 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [48.0 kB]
Fetched 170 kB in 1s (126 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done

 

Step 3: Install curl

In the next step, you can install curl from Debian repo by using apt install curl -y or apt-get install curl -y command as shown below. This will download and install curl package with all its dependencies.

root@debian:~# apt install curl -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
curl
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 267 kB of archives.
After this operation, 437 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 curl amd64 7.74.0-1.3+b1 [267 kB]
Fetched 267 kB in 1s (407 kB/s)
Selecting previously unselected package curl.
(Reading database ... 141518 files and directories currently installed.)
Preparing to unpack .../curl_7.74.0-1.3+b1_amd64.deb ...
Unpacking curl (7.74.0-1.3+b1) ...
Setting up curl (7.74.0-1.3+b1) ...
Processing triggers for man-db (2.9.4-2) ...

 

Step 4: Check curl version

If you want to check the current installed version of curl command then you need to use curl --version command as shown below. As you can see current version is 7.74.0.

root@debian:~# curl --version
curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3
Release-Date: 2020-12-09
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

 

Step 5: Using curl utility

It is now time to test the usage of curl utility. You can run a simple curl command to get the http header of URL google.com using curl -I https://www.google.com command as shown below. This gives a status code of 200 which means google.com supports HTTP/2 protocol.

root@debian:~# curl -I https://www.google.com
HTTP/2 200
content-type: text/html; charset=ISO-8859-1
p3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."
date: Thu, 14 Oct 2021 21:02:34 GMT
server: gws
x-xss-protection: 0
x-frame-options: SAMEORIGIN
expires: Thu, 14 Oct 2021 21:02:34 GMT
cache-control: private
set-cookie: 1P_JAR=2021-10-14-21; expires=Sat, 13-Nov-2021 21:02:34 GMT; path=/; domain=.google.com; Secure
set-cookie: NID=511=NtIbXJN2eg7QOjzwESGjYM0JxhjNzFiNEmK1vzTDnt61JBGeUspsnUnwPbQwzhSMeJR17wTznkPabxQtzai7fDhXRZuVy_JK9ZIUX-40b-iz7rLrENm3ul64oitXzlAAX5kz0kuZ_x_Il_ZAGQVOj3odf_2TCift-dg94wAluSI; expires=Fri, 15-Apr-2022 21:02:34 GMT; path=/; domain=.google.com; HttpOnly
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"

 

Step 6: Uninstall curl

Once you are done using curl utility then you can also remove it by using apt remove curl -y or apt-get remove curl -y command as shown below.

root@debian:~# apt remove curl -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
libjq1 libonig5
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
curl
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
After this operation, 437 kB disk space will be freed.
(Reading database ... 141519 files and directories currently installed.)
Removing curl (7.74.0-1.3+b1) ...
Processing triggers for man-db (2.9.4-2) ...

Leave a Comment