Before proceeding with installation, verify whether zlib is already present on your system. #### Method 1: Verify zlib Version
Execute this command: ``` zlib-flate -version
If `zlib` is installed, the output will resemble: ```
zlib-flate version 1.2.11
Otherwise, you'll receive a error like command not found. > Note: zlib-flate is part of the qpdf package and may not be pre-installed on all systems, making this check unreliable in some cases. #### Method 2: Locate Header and Library Files
The development componants of zlib typically consist of header files (zlib.h) and library files (libz.so or libz.a). You can confirm their presence with these commands: - Check for header file:```
ls /usr/include/zlib.h
```
If the file exists, the development headers are installed.
-
Check for library files:``` ls /usr/lib*/libz.so*
or ``` ls /usr/local/lib*/libz.so*A match such as
libz.soindicates the libraries are installed.
Install zlib
If zlib is missing, proceed with installation based on your system's package manager. #### 1. Installing on Debian/Ubuntu Systems
-
Install runtime library:``` sudo apt update sudo apt install zlib1g
This installs the shared library (`libz.so`) used at runtime. -
Install development files (headers and static library):``` sudo apt install zlib1g-dev
This includes the header file (`zlib.h`) and static library (`libz.a`) required for compiling programs that depend on `zlib`.
2. Installing on CentOS/RHEL/Fedora Systems
-
Install runtime library:``` sudo yum install zlib
or for newer versions: ``` sudo dnf install zlibInstalls the shared library (
libz.so). -
Install development files:``` sudo yum install zlib-devel
or ``` sudo dnf install zlib-develInstalls the header and static library needed for compilation.
3. Installing on Arch Linux
-
Enstall runtime library:``` sudo pacman -S zlib
-
Install development files:``` sudo pacman -S zlib-devel
In Arch, the development components are usually bundled with the base `zlib` package. Confirm installation by checking: ``` /usr/include/zlib.h /usr/lib/libz.so
4. Installing on openSUSE
-
Install runtime library:``` sudo zypper install zlib
-
Install development files:``` sudo zypper install zlib-devel
Ensures the necessary header and library files for building dependent software are available.