How to Install Zlib on Ubuntu 22.04

Zlib” is used to compress the network protocols in Linux distributions, decompresses the image of the kernel at the time of booting the operating system, and the openSSH uses it to compress the protocols. Moreover, the Apache server and the PostgreSQL uses “Zlib” for the implementation of “HTTP” and to create database backups, respectively.

Considering its importance, this guide provides an installation method of “Zlib” on Ubuntu 22.04.

How to Install Zlib on Ubuntu 22.04?

As in the above section, it has been explained that Zlib is an important part of the Linux distribution, so it comes pre-installed. Whereas if the Zlib is not pre-installed, it can be installed with the package of “zlib1g-dev” using the command:

$ sudo apt install zlib1g zlib1g-dev -y

When both the packages are installed, their installation can be confirmed by listing out the contents of “zlib1g” with the execution of the command:

$ dpkg -L zlib1g

The files, as well as the configuration files of zlib1g, have been displayed, similarly, to display the contents of zlib1g-dev, use the command:

$ dpkg -L zlib1g-dev

So, the installation of both packages has been verified.

How to Remove Zlib From Ubuntu 22.04

If you want to remove the Zlib from your system, you can just remove the zlibg1g and zlib1g-dev packages via the following command:

$ sudo apt autoremove zlib1g zlib1g-dev -y 

Doing so, the Zlib will be removed from the system.

That’s all from the installation guide of Zlib.


For the installation of the Zlib package on Ubuntu 22.04, open the terminal and execute the command “sudo apt install zlib1g zlib1g-dev -y”. The “Zlib” utility is key in backing up the data for the Apache server and the PostgreSQL. In this blog, the Zlib package has been installed on Ubuntu using the command-line interface.