zip: command not found – Install Zip Command CentOS 7

zip: command not found – How to Install Zip Command on CentOS 7 / RHEL 7 server

Follow the below steps to install zip command on CentOS 7 / RHEL 7 server.

ERROR:

root@server [/]# zip -r sam.zip directory1
-bash: zip: command not found

bash: /usr/bin/zip: No such file or directory

I got the above error on my CentOS 7 server while trying to zip a directory.

On CentOS and Redhat servers, zip command is provided by the zip package.

1. First you should log into your CentOS 7 Server via SSH as ‘root’ user

2. Run the below command to check whether zip package is installed or not.

command: #rpm -qa | grep zip

3. Install rpm package using yum command

command: #yum install zip
 

root@server [/]# yum install zip

Resolving Dependencies
–> Running transaction check
—> Package zip.x86_64 0:3.0-10.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

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

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

Total download size: 260 k
Installed size: 796 k
Is this ok [y/d/N]: y
Downloading packages:
zip-3.0-10.el7.x86_64.rpm | 260 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : zip-3.0-10.el7.x86_64 1/1
Verifying : zip-3.0-10.el7.x86_64 1/1

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

Complete!

 
install zip command centos redhat 7
 
root@server [/]# zip
This is Zip 3.0

Zip Command is now installed on your Linux Server.
 

How to Download and install zip rpm on CentOS7 / RHEL 7 server

1. Log into Linux server via SSH as ‘root’ user

2. Download zip rpm file from centos.org website using wget command

# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/zip-3.0-11.el7.x86_64.rpm

3. You can install zip rpm either using yum command or rpm command

# yum install zip-3.0-11.el7.x86_64.rpm

yum command will install zip package and the required dependencies for zip package.

#rpm -ivh zip-3.0-11.el7.x86_64.rpm

If you’re installing using rpm command, you must first install the required dependencies manually before installing the zip package.

The below dependencies are required: (install only if it is not installed)

glibc
bzip2-libs

Install the above dependencies only if it is not installed on your CentOS/Redhat server. Some dependencies might be already installed on your server.
 
install zip command centos redhat 7