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
![](http://unixcop.com/wp-content/uploads/2022/12/image-24.png)
- 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:
wget https://www.zlib.net/zlib-1.2.13.tar.gz
![](http://unixcop.com/wp-content/uploads/2022/12/image-23.png)
- Extract the downloaded package
tar -xvf zlib-1.2.13.tar.gz
![](http://unixcop.com/wp-content/uploads/2022/12/image-22.png)
Configure the zlib prefix as shown below:
cd zlib-1.2.13/ ./configure --prefix=/usr/local/zlib
![](http://unixcop.com/wp-content/uploads/2022/12/image-21.png)
- Install zlib with compiling the code as shown below:
sudo make install
![](http://unixcop.com/wp-content/uploads/2022/12/image-19.png)
How to Remove (Uninstall) Zlib
- Remove Zlib APT Method
sudo apt autoremove zlib1g-dev --purge -y
Install Zlib -Conclusion
That’s it
Thanks.