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.
Advertisements
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=NtIbXJN2eg7QOjzwESGjYM0JxhjNzFiNEmK1vzTDnt61JBGeUspsnUnwPbQ
wzhSMeJR17wTznkPabxQtzai7fDhXRZuVy_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"