UbuntuUbuntu Based

How To Install Zlib on Ubuntu 24.04 LTS

Install Zlib on Ubuntu 24.04

In this tutorial, we will show you how to install Zlib on Ubuntu 24.04 LTS. Zlib is a widely used data compression library that plays a crucial role in optimizing data storage and transfer across various applications. It provides developers with a set of functions to compress and decompress data efficiently, making it an essential tool for many software projects.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Zlib on Ubuntu 24.04 (Noble Numbat). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.


  • A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
  • An Ubuntu 24.04 system with root access or a user with sudo privileges.

Install Zlib on Ubuntu 24.04 LTS Noble Numbat

Step 1. Updating the Package Repository.

It’s crucial to keep your system up-to-date to avoid potential compatibility issues and security vulnerabilities. Open your terminal and run the following commands to update the package lists and upgrade installed packages:

sudo apt update

This command will fetch the latest package information from the Ubuntu repositories, allowing you to install the most recent version of Zlib and its dependencies. Updating the package repository is crucial to maintaining the security and stability of your system.

Step 2. Installing Zlib on Ubuntu 24.04.

  • Installing Zlib Using APT

The simplest and most straightforward method to install Zlib on Ubuntu 24.04 LTS is by using the APT package manager. APT streamlines the installation process by automatically handling dependencies and providing a convenient way to manage packages. To install Zlib using APT, follow these steps:

sudo apt install zlib1g

If you require the development files for Zlib, which include header files and static libraries necessary for compiling programs that use Zlib, install the zlib1g-dev package as well:

sudo apt install zlib1g-dev

By installing Zlib using APT, you can quickly set up the library on your Ubuntu system without the need for manual compilation. This method is recommended for most users, as it simplifies the installation process and ensures compatibility with other packages managed by APT.

  • Installing Zlib from Source

While installing Zlib using APT is convenient, there may be situations where you need to install a specific version of Zlib or want more control over the installation process. In such cases, installing Zlib from the source is the way to go. Follow these steps to compile and install Zlib from source on Ubuntu 24.04 LTS:

wget https://zlib.net/zlib-1.3.1.tar.gz

Extract the downloaded archive using the tar command:

tar xvf zlib-1.3.1.tar.gz

Configure the Zlib build by running the configure script:


Compile Zlib by executing the make command:


Once the compilation is complete, install Zlib by running:

sudo make install

This command installs the compiled Zlib library and header files into the appropriate system directories, making them available for use by other programs.

After successfully installing Zlib on your Ubuntu 24.04 LTS system, it’s crucial to verify that the installation was completed correctly. You can use the following commands to check the installed version of Zlib and ensure that it is functioning as expected:

To check the version of Zlib installed, run:

zlib-flate -version

Alternatively, you can use the zlib-config command to retrieve more detailed information about the Zlib installation:

zlib-config --version

This command provides the version number along with additional configuration details.

Congratulations! You have successfully installed Zlib. Thanks for using this tutorial for installing Zlib on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the Zlib website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button