unixcop Admin

How To Install Zlib on Ubuntu 20.04 | 22.04 LTS

In this guide, we will show you how to install zlib on Ubuntu systems.

zlib is a software library used for data compression. zlib was written by Jean-loup Gailly and Mark Adler and is an abstraction of the DEFLATE compression algorithm used in their gzip file compression program. zlib is also a crucial component of many software platforms, including Linux, macOS, and iOS. It has also been used in gaming consoles such as the PlayStation 4, PlayStation 3, Wii U, Wii, Xbox One and Xbox 360.

zlib is designed to be a free, general-purpose, legally unencumbered — that is, not covered by any patents — lossless data-compression library for use on virtually any computer hardware and operating system. The zlib data format is itself portable across platforms. Unlike the LZW compression method used in Unix compress(1) and in the GIF image format, the compression method currently used in zlib essentially never expands the data. (LZW can double or triple the file size in extreme cases.) zlib’s memory footprint is also independent of the input data and can be reduced, if necessary, at some cost in compression.

Install Zlib on Ubuntu-APT method

Follow the steps below to get started with Zlib :

  • Update your Ubuntu system packages with running the below command:
sudo apt update -y && sudo apt upgrade -y
  • Zlib package is available on Ubuntu base repository. So You can install it directly via the below command line
sudo apt install zlib1g-dev -y
  • Verify that the Zlib package with
zlib-config --version

Install Zlib on Ubuntu- official source code

Follow the steps below to get started with Zlib:

  • Update your Ubuntu system packages with running the below command:
sudo apt update -y && sudo apt upgrade -y
  • Install the required package for the code compiling:
sudo apt install -y gcc make
  • Download the source code with running the command below:
  • Extract the downloaded package
tar -xvf zlib-1.2.13.tar.gz

Configure the zlib prefix as shown below:

cd zlib-1.2.13/
./configure --prefix=/usr/local/zlib
  • Install zlib with compiling the code as shown below:
sudo make install

How to Remove (Uninstall) Zlib

  • Remove Zlib APT Method
sudo apt autoremove zlib1g-dev --purge -y

Install Zlib -Conclusion

That’s it



Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook