How To Install Packages In Linux Command Line And Using Yum

Introduction:

Installing, updating and removing installed programs are key responsibilities in a system administrator’s daily life. When a machine is connected to the internet, these task can be easily performed using a package management system such as yum. However, when a machine does not have access to the internet, another method is necessary. Local yum repository is the most effective way to perform any type of package installation without any internet connection.

RPM:

RPM (Red Hat Package Manager) is a default open source and most popular management utility for Red Hat based systems. The tool allows system administrators and users to install, update, uninstall, query, verify and manage system software packages in Linux operating systems. The RPM formerly known as (.rpm) file, that includes compiled software programs and libraries needed by the packages. This utility only works with packages that built on (.rpm) format.

Go to Package directory
[root@asim ~]# cd /run/media/cms/CentOS\ 7\ x86_64/
Install package
[root@asim Packages]# rpm -ivh vsftpd-3.0.2-25.el7.x86_64.rpm
Upgrade and Install
[root@asim Packages]# rpm -U vsftpd-3.0.2-25.el7.x86_64.rpm
Upgrade package if already  installed
[root@asim Packages]# rpm -F vsftpd-3.0.2-25.el7.x86_64.rpm
Show all queries
[root@asim Packages]# rpm -qa
Queries whether package is install or not
[root@asim Packages]# rpm -q vsftpd
Display information
[root@asim Packages]# rpm -qi vsftpd
Erase or uninstall
[root@asim Packages]# rpm -e vsftpd

YUM (Yellowdog update Modifier) Server:

YUM stands for Yellowdog Updater Modified. It is an interactive, rpm based package manager. When installing RPM packages most of packages require dependencies but when installing any package with the help of YUM package management tool it helps to install, remove or update the package through the network or local, at the same time it provides an easy method to install a package with its dependent packages.

List all enabled repositories
[root@asim ~]# yum repolist
List all packages that are installed
[root@asim ~]# yum list
List all available packages
[root@asim ~]# yum list all
Searches the package
[root@asim ~]# yum search httpd
Display information about a package
[root@asim ~]# yum info httpd
Installs the specified package
[root@asim ~]# yum install httpd
Checks whether updates exist for all pack
[root@asim ~]# yum check-update
Update all packages
[root@asim ~]# yum update
Remove the specified package
[root@asim ~]# yum remove httpd
Remove the specified package
[root@asim ~]# yum erase httpd
Remove all cached package download
[root@asim ~]# yum clean all
Displays help about yum usage
[root@asim ~]# yum help
Show you history of all install and remove packages
[root@asim ~]# yum history

Local YUM Repository:

To add a new or update an existing repository, go to the /etc/repos.d directory and create or open a file that end with .repo. Repository sources can be created using the create repo package. The main aim to create such an offline repository it works faster than online repository which can be configured locally.

If you have to install software, security updates and fixes often in multiple systems in your local network, then having a local repository is an efficient way. Because all required packages are downloaded over the fast LAN connection from your local server, so that it will save your internet bandwidth.

Local YUM with DVD configuration

Create directory for mounting   Linux DVD
[root@asim ~]#mkdir /dev/cdrom/dev
Mount Linux DVD in dvd mounting  directory
[root@asim ~]#mount /dev/cdrom/dvd
Move the existing repo files present in folder
[root@asim ~]#mv /etc/yum.repos.d/* .repo /
OR Remove the existing repo files
[root@asim ~]#rm –rf /etc/yum.repos.d/*
Create new repo file call local.repo
[root@asim ~]#vim /etc/yum.repos.d/local.repo
[LocalRepo] Name of the section
name=Local-Repository Name of the Repository
baseurl=file:///dvd            location of the package
enabled=1    enable repository to work
gpgcheck=0 checking gpg signature set to no

Leave a Reply

Your email address will not be published. Required fields are marked *