How to Install Zip Utility in Linux CentOS 7

Posted on

Introduction

This is an article where the focus of the content is for installing an utility in Linux CentOS 7.  It is not only working for CentOS operating system, but it is possible for every operating system using ‘yum’ package installer. The utility name is ‘zip’ and it is a command available for further execution in the command line interface. According to the manual page, it is useful for packaging and compressing (archive) files.

 

Installation Steps

Before the actual zip command is available in the operating system, install it first. In order to install the zip utility, execute the following command to check the availability of the ‘zip’ package first :

1. Search the package first. It is important to search whether it is actually available in the current registered repository in Linux CentOS 7. Just execute the following command :

yum search zip

2. Depend on the output from the above command execution, just execute the following command to search whether it is already available from the previous installation or it is currently not exist. Execute the following command for searching the installed package of ‘zip’ in the machine :

yum list installed | grep zip

3. If there is an output appears on the above command execution, it means the ‘zip’ utility is already available in the operating system. But if there is no trace of any installed ‘zip’ package, just execute the following command to install the ‘zip’ package :

[root@localhost ~]# yum -y install zip 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.mirror.xxxxxxx.xxx
 * epel: mirrors.nipa.cloud
 * extras: centos.mirror.xxxxxxx.xxx
 * ius: hkg.mirror.rackspace.com
 * updates: centos.mirror.xxxxxxx.xxx
Resolving Dependencies
--> Running transaction check
---> Package zip.x86_64 0:3.0-11.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================
 Package                                       Arch                                             Version                                                Repository                                      Size
============================================================================================================================================================================================================
Installing:
 zip                                           x86_64                                           3.0-11.el7                                             base                                           260 k

Transaction Summary
============================================================================================================================================================================================================
Install  1 Package

Total size: 260 k
Installed size: 796 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : zip-3.0-11.el7.x86_64                                                                                                                                                                    1/1 
  Verifying  : zip-3.0-11.el7.x86_64                                                                                                                                                                    1/1 

Installed:
  zip.x86_64 0:3.0-11.el7                                                                                                                                                                                   

Complete!
[root@localhost ~]#

3. Don’t forget to execute the command by typing it in the command line interface. For an example, the following is an actual command for creating a zip file from several files :

user@hostname:~$ zip -rv images.zip images/
  adding: images/   (in=0) (out=0) (stored 0%)
  ...  
  adding: images/IMG_20190529_135624.jpg    (in=3576288) (out=3568446) (deflated 0%)
  adding: images/IMG_20190618_105558.jpg    (in=3976456) (out=3957527) (deflated 0%)
  adding: images/IMG_20190527_114932.jpg    (in=4718354) (out=4704662) (deflated 0%)
  adding: images/IMG_20190617_103600.jpg    (in=4088633) (out=4074612) (deflated 0%)
  adding: images/IMG_20190529_152149.jpg    (in=3801424) (out=3792616) (deflated 0%)
  adding: images/IMG_20190617_103556.jpg    (in=4101101) (out=4087162) (deflated 0%)
  adding: images/IMG_20190527_114937.jpg    (in=4673254) (out=4659537) (deflated 0%)
  adding: images/IMG_20190618_105603.jpg    (in=4027090) (out=4011022) (deflated 0%)
  adding: images/IMG_20190529_152151.jpg    (in=3787512) (out=3777842) (deflated 0%)
  adding: images/IMG_20190618_105551.jpg    (in=4105536) (out=4087796) (deflated 0%)
  adding: images/IMG_20190529_135622.jpg    (in=3456242) (out=3447227) (deflated 0%)
  adding: images/IMG_20190527_114942.jpg    (in=4663627) (out=4649506) (deflated 0%)
total bytes=55225343, compressed=54453246 -> 1% savings
user@hostname:~$ 

The above command execution is actually a command for recursively add any files in the images directory into one compressed file with the name of images.zip.

Leave a Reply