In this article, we will see how to install zlib package on Ubuntu 22.04 LTS (Jammy Jellyfish). zlib is a free and open source data compression and data format library, used as crucial component for many of the software packages installed in some of the major platforms such as Linux, Unix, iOS. It was famously written by Jean-loup Gailly and Mark Adler. It is also widely used in gaming consoles such as PlayStation 4, PlayStation 3, Wii U, Wii, Xbox One and Xbox 360.
It is also very easy to install and use in almost all the famous Linux and Unix distributions. Here we will see the steps to install zlib package on Ubuntu 22.04 LTS based systems. It is also important to note here that now a days zlib package is coming as pre installed in most of the latest available distributions but if in case it’s missing in your system then you can easily install it by following below given steps.
How to Install zlib package on Ubuntu 22.04 LTS (Jammy Jellyfish)
Also Read: How to Install Meld on Ubuntu 20.04 LTS (Focal Fossa)
Step 1: Prerequisites
a) You should have a running Ubuntu 22.04 LTS
Server.
b) You should have sudo
or root
access to run privileged commands.
c) You should have apt
or apt-get
utility available in your Server.
Step 2: Update Your Server
You need to first look for all the available updates from default Ubuntu repo and then download and install them using sudo apt update && sudo apt upgrade
command as shown below. This is an important step to perform before attempting to install any new packages in the system.
cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
Hit:1 https://artifacts.elastic.co/packages/8.x/apt stable InRelease
Hit:2 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:4 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease
Get:6 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Fetched 109 kB in 2s (49.9 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
#
# You can verify the status of security fixes using the `pro fix` command.
# E.g., a recent Ruby vulnerability can be checked with: `pro fix USN-6219-1`
# For more detail see: https://ubuntu.com/security/notices/USN-6219-1
#
The following packages have been kept back:
gjs libgjs0g
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Step 3: Install zlib package
Although most of the time you will find zlib package already installed in the system as is the case in my system but in case if it’s not installed then you can run sudo apt install zlib1g
command to install the latest available version from default Ubuntu repo.
cyberithub@ubuntu:~$ sudo apt install zlib1g Reading package lists... Done Building dependency tree... Done Reading state information... Done zlib1g is already the newest version (1:1.2.11.dfsg-2ubuntu9.2). zlib1g set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Similarly, to install zlib1g-dev package, you need to use sudo apt install zlib1g-dev
command as shown below.
cyberithub@ubuntu:~$ sudo apt install zlib1g-dev Reading package lists... Done Building dependency tree... Done Reading state information... Done The following NEW packages will be installed: zlib1g-dev 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 164 kB of archives. After this operation, 606 kB of additional disk space will be used. Get:1 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu9.2 [164 kB] Fetched 164 kB in 1s (123 kB/s) Selecting previously unselected package zlib1g-dev:amd64. (Reading database ... 232731 files and directories currently installed.) Preparing to unpack .../zlib1g-dev_1%3a1.2.11.dfsg-2ubuntu9.2_amd64.deb ... Unpacking zlib1g-dev:amd64 (1:1.2.11.dfsg-2ubuntu9.2) ... Setting up zlib1g-dev:amd64 (1:1.2.11.dfsg-2ubuntu9.2) ... Processing triggers for man-db (2.10.2-1) ...
Step 4: Verify Installation
After successful installation, you can verify the installed files path of zlib1g package by using dpkg -L zlib1g
command as shown below.
cyberithub@ubuntu:~$ dpkg -L zlib1g
/.
/lib
/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu/libz.so.1.2.11
/usr
/usr/share
/usr/share/doc
/usr/share/doc/zlib1g
/usr/share/doc/zlib1g/changelog.Debian.gz
/usr/share/doc/zlib1g/copyright
/lib/x86_64-linux-gnu/libz.so.1
Similarly, to verify the installed files path of zlib1g-dev package, you need to use dpkg -L zlib1g-dev
command as shown below.
cyberithub@ubuntu:~$ dpkg -L zlib1g-dev
/.
/usr
/usr/include
/usr/include/zconf.h
/usr/include/zlib.h
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libz.a
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/zlib.pc
/usr/share
/usr/share/doc
/usr/share/doc/zlib1g-dev
/usr/share/doc/zlib1g-dev/FAQ.gz
/usr/share/doc/zlib1g-dev/README.gz
/usr/share/doc/zlib1g-dev/algorithm.txt.gz
/usr/share/doc/zlib1g-dev/copyright
/usr/share/doc/zlib1g-dev/examples
/usr/share/doc/zlib1g-dev/examples/README.examples
/usr/share/doc/zlib1g-dev/examples/crc32_test.c
/usr/share/doc/zlib1g-dev/examples/enough.c
/usr/share/doc/zlib1g-dev/examples/example.c
/usr/share/doc/zlib1g-dev/examples/fitblk.c
/usr/share/doc/zlib1g-dev/examples/gun.c
/usr/share/doc/zlib1g-dev/examples/gzappend.c
/usr/share/doc/zlib1g-dev/examples/gzjoin.c
/usr/share/doc/zlib1g-dev/examples/gzlog.c
/usr/share/doc/zlib1g-dev/examples/gzlog.h
/usr/share/doc/zlib1g-dev/examples/infcover.c
/usr/share/doc/zlib1g-dev/examples/minigzip.c
/usr/share/doc/zlib1g-dev/examples/zlib_how.html
/usr/share/doc/zlib1g-dev/examples/zpipe.c
/usr/share/doc/zlib1g-dev/examples/zran.c
/usr/share/doc/zlib1g-dev/txtvsbin.txt.gz
/usr/share/man
/usr/share/man/man3
/usr/share/man/man3/zlib.3.gz
/usr/lib/x86_64-linux-gnu/libz.so
/usr/share/doc/zlib1g-dev/changelog.Debian.gz
Step 5: Uninstall zlib package
It is important to understand that you should never attempt to uninstall zlib packages from your system as it will make your system unstable and forceful uninstallation might result in complete system breakdown as you can see from below warning and error messages.
cyberithub@ubuntu:~$ sudo apt remove zlib1g [sudo] password for cyberithub: Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: apt : Depends: gpgv or gpgv2 but it is not going to be installed or gpgv1 but it is not going to be installed Depends: libapt-pkg6.0 (>= 2.4.10) but it is not going to be installed dpkg : PreDepends: zlib1g (>= 1:1.1.4) but it is not going to be installed shim-signed : Depends: grub-efi-amd64-signed (>= 1.187.2~) but it is not going to be installed or grub-efi-arm64-signed (>= 1.187.2~) but it is not installable Depends: grub2-common (>= 2.04-1ubuntu24) util-linux : PreDepends: zlib1g (>= 1:1.1.4) but it is not going to be installed E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
Discover more from Ubuntu-Server.com
Subscribe to get the latest posts sent to your email.