SysTutorials Forums QA How to install the zlib library in Ubuntu?

On Ubuntu (18.04), installing zlib reported unable to locate package zlib:

$ sudo apt install zlib
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package zlib

How to install zlib in Ubuntu?

In Ubuntu, the zlib package is zlib1g.

$ sudo apt show zlib1g
Package: zlib1g
Version: 1:1.2.11.dfsg-0ubuntu2
Priority: required
Section: libs
Source: zlib
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Mark Brown <broonie@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 173 kB
Provides: libz1
Depends: libc6 (>= 2.14)
Conflicts: zlib1 (<= 1:1.0.4-7)
Breaks: libxml2 (<< 2.7.6.dfsg-2), texlive-binaries (<< 2009-12)
Homepage: http://zlib.net/
Task: minimal
Supported: 5y
Download-Size: 56.5 kB
APT-Manual-Installed: yes
APT-Sources: http://hk.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Description: compression library - runtime
 zlib is a library implementing the deflate compression method found
 in gzip and PKZIP.  This package includes the shared library.

You may install them by

$ sudo apt install zlib1g

If you would install the development package:

$ sudo apt install zlib1g-dev

And if you would link against zlib in your program, add -lz to the gcc or g++ commands.

Download Zlib by using the following command :
wget http://www.zlib.net/zlib-1.2.3.tar.gz
Extract the file from the downloaded package:
tar -xvzf zlib-1.2.3.tar.gz
Enter the directory where the package is extracted:
cd zlib-1.2.3
Now configure Zlib directory:
./configure –prefix=/usr/local/zlib
Replace “/usr/local/zlib” above with the directory path where you want to copy the files and folders. Check whether you get any error message. Compile and install Zlib. If you are root run the following:
sudo make install
Library has bee successfully installed.

Get an awesome experience from https://dissertationpanda.com/ in dissertation writing service .

Reply To: How to install the zlib library in Ubuntu?
Your information:





<a href="" title="" rel="" target=""> <blockquote cite=""> <code> <pre> <em> <strong> <del datetime=""> <ul> <ol start=""> <li> <img src="" border="" alt="" height="" width="">

Please share if you like this post: