Linux HOWTOs

About | Home | Search


HOWTO: gzip
Description: Compress or expand gzip (*.gz) files
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# GNU zip (gzip)
# =======
# Slackware 12.1, 12.2, 13.0: gzip 1.3.12
# Slackware 13.1, 13.37: gzip 1.4

# If the download site used below is busy, try one of these:
# http://mirrors.ibiblio.org/pub/mirrors/gnu/ftp/gnu/gzip/
# http://ftp.gnu.org/gnu/gzip/


# gzip 1.2.4 (1.2.4a + b patch) - latest stable
# ==========
# Prerequisites:
# tar

cd
test -f installed/gzip-1.2.4a.tar && mv installed/gzip-1.2.4a.tar .
test ! -f gzip-1.2.4a.tar &&
 wget http://ftpmirror.gnu.org/gnu/gzip/gzip-1.2.4a.tar

# Verify tarball w/ md5sum:
echo "c04db2076b9a25af95fae5dbb6e01c65  gzip-1.2.4a.tar" | md5sum -c

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "gzip-*" -exec rm -r {} \;
tar xvf ~/gzip-1.2.4a.tar
cd gzip-1.2.4a
test $UID = 0 && chown -R root:root .

# Apply patch to fix a buffer overflow when an input file name is too long:
wget -nc http://www.gzip.org/gzip-1.2.4b.patch &&
 patch -p1 < ./gzip-1.2.4b.patch

./configure --prefix=/usr
make
make check

# Become root to install it
su

# Remove the Slackware package and old files that may cause a problem
test -x /sbin/removepkg && /sbin/removepkg gzip
rm -f /bin/gzip /bin/gunzip /bin/zcat

# Install the new version
make install
ln -sf /usr/bin/gzip /bin/gzip
ln -sf /usr/bin/gunzip /bin/gunzip
ln -sf /usr/bin/zcat /bin/zcat

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+rw .

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/gzip-*.tar*
mv gzip-1.2.4a.tar installed/


# gzip 1.4 - the latest beta (released in January 2010)
# ========
# If you don't have gzip already, install the old version (above, which is
# available is a non-compressed tar archive), then use it to gunzip the
# .tar.gz file for this one.

# Prerequisites:
# tar
# XZ Utils

cd
test -f installed/gzip-1.4.tar.xz && mv installed/gzip-1.4.tar.xz .
test ! -f gzip-1.4.tar.xz &&
 wget ftp://ftpmirror.gnu.org/gnu/gzip/gzip-1.4.tar.xz

# Verify tarball w/ md5sum:
# (this also came from my gpg-verified tarball)
echo "fc7be225884ae5324b44167ced89f50a  gzip-1.4.tar.xz" | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "d383b8a1dadc5fa9c34e2a2ebe2452be7dd27393  gzip-1.4.tar.xz" | sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys B9AB9A16 > /dev/null || gpg --recv-keys B9AB9A16 ) &&
 wget -nc ftp://ftpmirror.gnu.org/gnu/gzip/gzip-1.4.tar.xz.sig &&
  gpg --verify gzip-1.4.tar.xz.sig && rm gzip-1.4.tar.xz.sig

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "gzip-*" -exec rm -r {} \;
xz -dc ~/gzip-1.4.tar.xz | tar xv
cd gzip-1.4
test $UID = 0 && chown -R root:root .

./configure --prefix=/usr --infodir=/usr/info --mandir=/usr/man
make

# Become root to install it
su

# Remove the Slackware package and old versions of files
test -x /sbin/removepkg && /sbin/removepkg gzip
rm -f /bin/gzip /bin/gunzip /bin/zcat \
 /usr/bin/gzip /usr/bin/gunzip /usr/bin/zcat

# Install the new version
make install

# Move gzip, gunzip, and zcat into /bin (in case /usr is NFS-mounted,
# etc.) and create symlinks
( cd /usr/bin ; mv -f gzip gunzip zcat /bin/)
ln -s /bin/gzip /usr/bin/gzip
ln -s /bin/gunzip /usr/bin/gunzip
ln -s /bin/zcat /usr/bin/zcat

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+rw .

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/gzip-*.tar*
mv gzip-1.4.tar.xz installed/


# If you ever want to uninstall gzip, this should do it:
cd
su
test -d src/gzip-* && ( cd src/gzip-* ; make uninstall )
( cd /usr/bin ; rm -f gunzip gzexe gzip zcat zcmp zdiff zegrep zfgrep \
zforce zgrep zless zmore znew )
( cd /usr/man/man1 ; rm -f gunzip.1 gzexe.1 gzip.1 zcat.1 zcmp.1 zdiff.1 \
zforce.1 zgrep.1 zless.1 zmore.1 znew.1 )
rm -f /usr/info/gzip.info /usr/share/info/gzip.info
( cd /usr/share/man/man1 ; rm -f gunzip.1 gzexe.1 gzip.1 zcat.1 zcmp.1 \
zdiff.1 zforce.1 zgrep.1 zless.1 zmore.1 znew.1 )
exit
find ~/src -maxdepth 1 -type d -name "gzip-*" -exec rm -r {} \;
rm -f ~/installed/gzip-*.tar.*

Back to the list


Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>