How to Install Zlib on Ubuntu Linux [Easily] – It's FOSS

A Linux and Open Source Web Portal
Last updated By 10 Comments
Zlib is an open source library for used for data compression.
As an end user, you are likely to encounter the need of installing Zlib (or zlib devel package) as a dependency of another application.
But here comes the problem. If you try installing Zlib on Ubuntu, it will throw “unable to locate package zlib” error.
Why do you see this unable to locate package error? Because there is no package named zlib.
If you use the apt search command, you’ll find that the there are a couple of packages that let you install zlib: zlib1g and zlib1g-dev. When you have that information, installing them is just one apt command away.
Open a terminal and use the following command:
Please keep in mind that the the letter before g is 1 (one), not lowercase L. Many people make this mistake while typing the command.
The other package, zlib1g-dev is development package. Only install it if you require it otherwise you should be good with the main runtime zlib1g package.
You may also download the source code of Zlib from its website and install it. However, I won’t recommend going the source code way just for installing zlib unless you have a good reason to do so. For example, if you need the latest or a specific version of zlib which is not available in the distribution’s repository.
It is interesting how a seemingly small stuff like installing zlib could become a pain for two reasons: a different package name and the package name containing a “hidden” numeral one (1) which is confused with lowercase L.
I hope this quick tip helps you. Feel free to drop your questions, suggestions or a simple “thank you” in the comment section.
Like what you read? Please share it with others.
Filed Under: Tutorial
Creator of It’s FOSS. An ardent Linux user & open source promoter. Huge fan of classic detective mysteries ranging from Agatha Christie and Sherlock Holmes to Detective Columbo & Ellery Queen. Also a movie buff with a soft corner for film noir.
Thank-you for your post – I believe I have downloaded zlib, but I cannot find the programme anywhere on the computer. Do I need to unpack it or similar? Apologies! I have read forums and still confused. Terminal data below:
Reading package lists… Done
Building dependency tree
Reading state information… Done
zlib1g is already the newest version (1:1.2.11.dfsg-2ubuntu1.2).
The following packages were automatically installed and are no longer required:
libllvm10 linux-headers-5.4.0-74 linux-headers-5.4.0-74-generic linux-headers-5.4.0-80 linux-headers-5.4.0-80-generic
linux-image-5.4.0-74-generic linux-image-5.4.0-80-generic linux-modules-5.4.0-74-generic linux-modules-5.4.0-80-generic
linux-modules-extra-5.4.0-74-generic linux-modules-extra-5.4.0-80-generic shim
Use ‘sudo apt autoremove’ to remove them.
0 to upgrade, 0 to newly install, 0 to remove and 16 not to upgrade.
Hello Jeremy,
zlib is a library, a piece of software that is not an executable. You cannot run zlib like a linux command or an application. If installed, other software use it as dependency.
No wonder I was having trouble – Thank-you!
You are welcome.
It loaded. Thank you.
You are welcome
You are welcome
thank you
Join 75,000 other Linux users and start your journey to become a better, informed desktop Linux user.
It’s FOSS is Part of chmod777 Media Tech (OPC) Pvt Ltd· Built on Genesis Framework and Powered by UpCloud
Session expired
Please log in again. The login page will open in a new tab. After logging in you can close it and return to this page.


We will be happy to hear your thoughts

Leave a reply

Compare items
  • Total (0)