YUM
YUM is the primary package management tool for installing, updating, removing, and managing software packages in Red Hat Enterprise Linux. YUM performs dependency resolution when installing, updating, and removing software packages. YUM can manage packages from installed repositories in the system or from .rpm packages. The main configuration file for YUM is at /etc/yum.conf, and all the repos are at /etc/yum.repos.d.
Syntax: yum -[option] [command] [package]
Options:
-y : Answers yes to all the questions
-C : Runs from system cache
--security : Includes packages that provide a fix for security issues
--skip-broken : Skips packages causing problems
-v : Verbose
1) yum install package
Installs the specified packages
2) yum remove package
Removes the specified package
3) yum search package
Searches package metadata for keywords
4) yum info package
Lists description
5) yum update
Updates each package to the latest version
yum update package
updates an existing package specified
6) yum repolist package
Lists repositories
7) yum history
Displays what was happened in the past transactions
8) yum list
Lists all available packages
9) yum list installed
Lists installed packages
10) yum provides file
Displays which package a particular file belongs to
Ex: yum provides /etc/sysconfig/nfs
RPM
RPM is a popular package management tool in Red Hat Enterprise Linux-based distros. Using RPM, you can install, uninstall, and query individual software packages. Still, it cannot manage dependency resolution like YUM. RPM does provide you useful output, including a list of required packages. An RPM package consists of an archive of files and metadata. Metadata includes helper scripts, file attributes, and information about packages.
RPM maintains a database of installed packages, which enables powerful and fast queries. The RPM database is inside /var/lib, and the file is named __db*.
RPM has some basic modes: query, verify, install, upgrade, erase, show querytags, show configuration. At least one of these modes needs to be selected to perform package management tasks. Every mode has its own set of options. For example, install mode i has its own set of installation options. Options for the modes are found on the RPM man pages at man rpm.
Commonly used modes:
-i : Installs a package
-U : Upgrades a package
-e : Erases a package
-V : Verifies a package
-q : Queries a package
Commonly used General Options :
-? or --help : Prints help
--version : Prints Version Number
-v : Prints Verbose Output
To install or upgrade an .rpm package using RPM, issue this command:
rpm -i package-file
rpm -U package-file
rpm -ivh package-file
The flag -i is for install, U is for upgrade, v for verbose, h for hash (this option displays the # as a progress bar for the operation). In this example, v and h are optional flags.
To query for a package using RPM issue following command:
rpm -q query-options package
rpm -qa query-options package
Option a queries all installed packages on the system.
To erase a package, use the following command:
rpm -e erase-options package-name
rpm -evh vim-enhanced
Create local repository and install packages using local repository
[clint@stbkp01 ~]$ sudo su -
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for clint:
[root@stbkp01 ~]# yum repolist
Determining fastest mirrors
repolist: 0
[root@stbkp01 ~]# cat>/etc/yum.repos.d/local_yum.repo
[local_yum]
name=local_yum
baseurl=file:///packages/downloaded_rpms/
enabled=1
gpgcheck=0
protect=1
apr-1.4.8-5.el7.x86_64.rpm perl-parent-0.225-244.el7.noarch.rpm
apr-util-1.5.2-6.el7.x86_64.rpm perl-PathTools-3.40-5.el7.x86_64.rpm
avahi-libs-0.6.31-19.el7.x86_64.rpm perl-Pod-Escapes-1.04-294.el7_6.noarch.rpm
centos-logos-70.0.6-3.el7.centos.noarch.rpm perl-podlators-2.5.1-3.el7.noarch.rpm
cups-libs-1.6.3-40.el7.x86_64.rpm perl-Pod-Perldoc-3.20-4.el7.noarch.rpm
gpm-libs-1.20.7-6.el7.x86_64.rpm perl-Pod-Simple-3.28-4.el7.noarch.rpm
groff-base-1.22.2-8.el7.x86_64.rpm perl-Pod-Usage-1.63-3.el7.noarch.rpm
httpd-2.4.6-90.el7.centos.x86_64.rpm perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm
httpd-tools-2.4.6-90.el7.centos.x86_64.rpm perl-Socket-2.010-4.el7.x86_64.rpm
jansson-2.10-1.el7.x86_64.rpm perl-Storable-2.45-3.el7.x86_64.rpm
libldb-1.4.2-1.el7.x86_64.rpm perl-Text-ParseWords-3.29-4.el7.noarch.rpm
libtalloc-2.1.14-1.el7.x86_64.rpm perl-threads-1.87-4.el7.x86_64.rpm
libtdb-1.3.16-1.el7.x86_64.rpm perl-threads-shared-1.43-6.el7.x86_64.rpm
libtevent-0.9.37-1.el7.x86_64.rpm perl-Time-HiRes-1.9725-3.el7.x86_64.rpm
libwbclient-4.9.1-10.el7_7.x86_64.rpm perl-Time-Local-1.2300-2.el7.noarch.rpm
mailcap-2.1.41-2.el7.noarch.rpm pytalloc-2.1.14-1.el7.x86_64.rpm
perl-5.16.3-294.el7_6.x86_64.rpm repodata
perl-Carp-1.26-244.el7.noarch.rpm samba-4.9.1-10.el7_7.x86_64.rpm
perl-constant-1.27-2.el7.noarch.rpm samba-client-libs-4.9.1-10.el7_7.x86_64.rpm
perl-Encode-2.51-7.el7.x86_64.rpm samba-common-4.9.1-10.el7_7.noarch.rpm
perl-Exporter-5.68-3.el7.noarch.rpm samba-common-libs-4.9.1-10.el7_7.x86_64.rpm
perl-File-Path-2.09-2.el7.noarch.rpm samba-common-tools-4.9.1-10.el7_7.x86_64.rpm
perl-File-Temp-0.23.01-3.el7.noarch.rpm samba-libs-4.9.1-10.el7_7.x86_64.rpm
perl-Filter-1.49-3.el7.x86_64.rpm vim-common-7.4.629-6.el7.x86_64.rpm
perl-Getopt-Long-2.40-3.el7.noarch.rpm vim-enhanced-7.4.629-6.el7.x86_64.rpm
perl-HTTP-Tiny-0.033-3.el7.noarch.rpm vim-filesystem-7.4.629-6.el7.x86_64.rpm
perl-libs-5.16.3-294.el7_6.x86_64.rpm wget-1.14-18.el7_6.1.x86_64.rpm
perl-macros-5.16.3-294.el7_6.x86_64.rpm which-2.20-7.el7.x86_64.rpm
[root@stbkp01 ~]# yum install vim-enhanced
Loading mirror speeds from cached hostfile
local_yum | 2.9 kB 00:00:00
local_yum/primary_db | 57 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package vim-enhanced.x86_64 2:7.4.629-6.el7 will be installed
--> Processing Dependency: vim-common = 2:7.4.629-6.el7 for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Processing Dependency: which for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Processing Dependency: perl(:MODULE_COMPAT_5.16.3) for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Processing Dependency: libperl.so()(64bit) for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Processing Dependency: libgpm.so.2()(64bit) for package: 2:vim-enhanced-7.4.629-6.el7.x86_64
--> Running transaction check
---> Package gpm-libs.x86_64 0:1.20.7-6.el7 will be installed
---> Package perl.x86_64 4:5.16.3-294.el7_6 will be installed
--> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl-macros for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Getopt::Long) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Temp) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(File::Path) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Exporter) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-294.el7_6.x86_64
--> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-294.el7_6.x86_64
---> Package perl-libs.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package vim-common.x86_64 2:7.4.629-6.el7 will be installed
--> Processing Dependency: vim-filesystem for package: 2:vim-common-7.4.629-6.el7.x86_64
---> Package which.x86_64 0:2.20-7.el7 will be installed
--> Running transaction check
---> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
---> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
---> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
---> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
---> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
---> Package perl-Getopt-Long.noarch 0:2.40-3.el7 will be installed
--> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-3.el7.noarch
--> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-3.el7.noarch
---> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
---> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
--> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
--> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
---> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
---> Package perl-Socket.x86_64 0:2.010-4.el7 will be installed
---> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
---> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
---> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
---> Package perl-constant.noarch 0:1.27-2.el7 will be installed
---> Package perl-macros.x86_64 4:5.16.3-294.el7_6 will be installed
---> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
---> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
---> Package vim-filesystem.x86_64 2:7.4.629-6.el7 will be installed
--> Running transaction check
---> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
---> Package perl-Pod-Escapes.noarch 1:1.04-294.el7_6 will be installed
---> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
--> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
--> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
---> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
--> Running transaction check
---> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
--> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
--> Processing Dependency: groff-base for package: perl-Pod-Perldoc-3.20-4.el7.noarch
---> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
--> Running transaction check
---> Package groff-base.x86_64 0:1.22.2-8.el7 will be installed
---> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
---> Package perl-parent.noarch 1:0.225-244.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================
Installing:
vim-enhanced x86_64 2:7.4.629-6.el7 local_yum 1.1 M
Installing for dependencies:
gpm-libs x86_64 1.20.7-6.el7 local_yum 32 k
groff-base x86_64 1.22.2-8.el7 local_yum 942 k
perl x86_64 4:5.16.3-294.el7_6 local_yum 8.0 M
perl-Carp noarch 1.26-244.el7 local_yum 19 k
perl-Encode x86_64 2.51-7.el7 local_yum 1.5 M
perl-Exporter noarch 5.68-3.el7 local_yum 28 k
perl-File-Path noarch 2.09-2.el7 local_yum 26 k
perl-File-Temp noarch 0.23.01-3.el7 local_yum 56 k
perl-Filter x86_64 1.49-3.el7 local_yum 76 k
perl-Getopt-Long noarch 2.40-3.el7 local_yum 56 k
perl-HTTP-Tiny noarch 0.033-3.el7 local_yum 38 k
perl-PathTools x86_64 3.40-5.el7 local_yum 82 k
perl-Pod-Escapes noarch 1:1.04-294.el7_6 local_yum 51 k
perl-Pod-Perldoc noarch 3.20-4.el7 local_yum 87 k
perl-Pod-Simple noarch 1:3.28-4.el7 local_yum 216 k
perl-Pod-Usage noarch 1.63-3.el7 local_yum 27 k
perl-Scalar-List-Utils x86_64 1.27-248.el7 local_yum 36 k
perl-Socket x86_64 2.010-4.el7 local_yum 49 k
perl-Storable x86_64 2.45-3.el7 local_yum 77 k
perl-Text-ParseWords noarch 3.29-4.el7 local_yum 14 k
perl-Time-HiRes x86_64 4:1.9725-3.el7 local_yum 45 k
perl-Time-Local noarch 1.2300-2.el7 local_yum 24 k
perl-constant noarch 1.27-2.el7 local_yum 19 k
perl-libs x86_64 4:5.16.3-294.el7_6 local_yum 688 k
perl-macros x86_64 4:5.16.3-294.el7_6 local_yum 44 k
perl-parent noarch 1:0.225-244.el7 local_yum 12 k
perl-podlators noarch 2.5.1-3.el7 local_yum 112 k
perl-threads x86_64 1.87-4.el7 local_yum 49 k
perl-threads-shared x86_64 1.43-6.el7 local_yum 39 k
vim-common x86_64 2:7.4.629-6.el7 local_yum 5.9 M
vim-filesystem x86_64 2:7.4.629-6.el7 local_yum 11 k
which x86_64 2.20-7.el7 local_yum 41 k
Transaction Summary
==============================================================================================================================
Install 1 Package (+32 Dependent packages)
Total download size: 19 M
Installed size: 63 M
Is this ok [y/d/N]: y
Downloading packages:
------------------------------------------------------------------------------------------------------------------------------
Total 228 MB/s | 19 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : gpm-libs-1.20.7-6.el7.x86_64 1/33
Installing : 2:vim-filesystem-7.4.629-6.el7.x86_64 2/33
Installing : 2:vim-common-7.4.629-6.el7.x86_64 3/33
Installing : groff-base-1.22.2-8.el7.x86_64 4/33
Installing : 1:perl-parent-0.225-244.el7.noarch 5/33
Installing : perl-HTTP-Tiny-0.033-3.el7.noarch 6/33
Installing : perl-podlators-2.5.1-3.el7.noarch 7/33
Installing : perl-Pod-Perldoc-3.20-4.el7.noarch 8/33
Installing : 1:perl-Pod-Escapes-1.04-294.el7_6.noarch 9/33
Installing : perl-Encode-2.51-7.el7.x86_64 10/33
Installing : perl-Text-ParseWords-3.29-4.el7.noarch 11/33
Installing : perl-Pod-Usage-1.63-3.el7.noarch 12/33
Installing : 4:perl-libs-5.16.3-294.el7_6.x86_64 13/33
Installing : 4:perl-macros-5.16.3-294.el7_6.x86_64 14/33
Installing : perl-Storable-2.45-3.el7.x86_64 15/33
Installing : perl-Exporter-5.68-3.el7.noarch 16/33
Installing : perl-constant-1.27-2.el7.noarch 17/33
Installing : perl-Time-Local-1.2300-2.el7.noarch 18/33
Installing : perl-Socket-2.010-4.el7.x86_64 19/33
Installing : perl-Carp-1.26-244.el7.noarch 20/33
Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 21/33
Installing : perl-PathTools-3.40-5.el7.x86_64 22/33
Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64 23/33
Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch 24/33
Installing : perl-File-Temp-0.23.01-3.el7.noarch 25/33
Installing : perl-File-Path-2.09-2.el7.noarch 26/33
Installing : perl-threads-shared-1.43-6.el7.x86_64 27/33
Installing : perl-threads-1.87-4.el7.x86_64 28/33
Installing : perl-Filter-1.49-3.el7.x86_64 29/33
Installing : perl-Getopt-Long-2.40-3.el7.noarch 30/33
Installing : 4:perl-5.16.3-294.el7_6.x86_64 31/33
Installing : which-2.20-7.el7.x86_64 32/33
install-info: No such file or directory for /usr/share/info/which.info.gz
Installing : 2:vim-enhanced-7.4.629-6.el7.x86_64 33/33
Verifying : perl-HTTP-Tiny-0.033-3.el7.noarch 1/33
Verifying : perl-threads-shared-1.43-6.el7.x86_64 2/33
Verifying : perl-Storable-2.45-3.el7.x86_64 3/33
Verifying : 1:perl-Pod-Escapes-1.04-294.el7_6.noarch 4/33
Verifying : perl-Exporter-5.68-3.el7.noarch 5/33
Verifying : perl-constant-1.27-2.el7.noarch 6/33
Verifying : perl-PathTools-3.40-5.el7.x86_64 7/33
Verifying : 1:perl-parent-0.225-244.el7.noarch 8/33
Verifying : which-2.20-7.el7.x86_64 9/33
Verifying : 4:perl-libs-5.16.3-294.el7_6.x86_64 10/33
Verifying : groff-base-1.22.2-8.el7.x86_64 11/33
Verifying : perl-File-Temp-0.23.01-3.el7.noarch 12/33
Verifying : 1:perl-Pod-Simple-3.28-4.el7.noarch 13/33
Verifying : perl-Time-Local-1.2300-2.el7.noarch 14/33
Verifying : 4:perl-macros-5.16.3-294.el7_6.x86_64 15/33
Verifying : perl-Socket-2.010-4.el7.x86_64 16/33
Verifying : 2:vim-enhanced-7.4.629-6.el7.x86_64 17/33
Verifying : perl-Carp-1.26-244.el7.noarch 18/33
Verifying : 4:perl-Time-HiRes-1.9725-3.el7.x86_64 19/33
Verifying : perl-Scalar-List-Utils-1.27-248.el7.x86_64 20/33
Verifying : perl-Pod-Usage-1.63-3.el7.noarch 21/33
Verifying : 2:vim-common-7.4.629-6.el7.x86_64 22/33
Verifying : 2:vim-filesystem-7.4.629-6.el7.x86_64 23/33
Verifying : perl-Encode-2.51-7.el7.x86_64 24/33
Verifying : perl-Pod-Perldoc-3.20-4.el7.noarch 25/33
Verifying : perl-podlators-2.5.1-3.el7.noarch 26/33
Verifying : perl-File-Path-2.09-2.el7.noarch 27/33
Verifying : perl-threads-1.87-4.el7.x86_64 28/33
Verifying : gpm-libs-1.20.7-6.el7.x86_64 29/33
Verifying : perl-Filter-1.49-3.el7.x86_64 30/33
Verifying : perl-Getopt-Long-2.40-3.el7.noarch 31/33
Verifying : perl-Text-ParseWords-3.29-4.el7.noarch 32/33
Verifying : 4:perl-5.16.3-294.el7_6.x86_64 33/33
Installed:
vim-enhanced.x86_64 2:7.4.629-6.el7
Dependency Installed:
gpm-libs.x86_64 0:1.20.7-6.el7 groff-base.x86_64 0:1.22.2-8.el7 perl.x86_64 4:5.16.3-294.el7_6
perl-Carp.noarch 0:1.26-244.el7 perl-Encode.x86_64 0:2.51-7.el7 perl-Exporter.noarch 0:5.68-3.el7
perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7 perl-Filter.x86_64 0:1.49-3.el7
perl-Getopt-Long.noarch 0:2.40-3.el7 perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.x86_64 0:3.40-5.el7
perl-Pod-Escapes.noarch 1:1.04-294.el7_6 perl-Pod-Perldoc.noarch 0:3.20-4.el7 perl-Pod-Simple.noarch 1:3.28-4.el7
perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-4.el7
perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7
perl-Time-Local.noarch 0:1.2300-2.el7 perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-294.el7_6
perl-macros.x86_64 4:5.16.3-294.el7_6 perl-parent.noarch 1:0.225-244.el7 perl-podlators.noarch 0:2.5.1-3.el7
perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7 vim-common.x86_64 2:7.4.629-6.el7
vim-filesystem.x86_64 2:7.4.629-6.el7 which.x86_64 0:2.20-7.el7
Complete!
No comments:
Post a Comment