Software Management
Define RPM and Yum and Its Principle**
use rpm then check the version of packages and Its Architecture.
Getting ready
$ vagrant up
$ vagrant ssh
How to do it
From the man pages rpm, it RPM package manager
use help command for rpm
# rpm --help
rpm key option for basic
$ rpm --help
Usage: rpm [OPTION...]
Query/Verify package selection options:
-a, --all query/verify all packages
-f, --file query/verify package(s) owning file
-g, --group query/verify package(s) in group
-p, --package query/verify a package file
--pkgid query/verify package(s) with package identifier
--hdrid query/verify package(s) with header identifier
--triggeredby query the package(s) triggered by the package
--whatrequires query/verify the package(s) which require a dependency
--whatprovides query/verify the package(s) which provide a dependency
--nomanifest do not process non-package files as manifests
Query options (with -q or --query):
-c, --configfiles list all configuration files
-d, --docfiles list all documentation files
-L, --licensefiles list all license files
--dump dump basic file information
-l, --list list files in package
--queryformat=QUERYFORMAT use the following query format
-s, --state display the states of the listed files
Verify options (with -V or --verify):
--nofiledigest don't verify digest of files
--nofiles don't verify files in package
--nodeps don't verify package dependencies
--noscript don't execute verify script(s)
Install/Upgrade/Erase options:
--allfiles install all files, even configurations which might otherwise be skipped
--allmatches remove all packages which match <package> (normally an error is generated if <package> specified multiple
packages)
--badreloc relocate files in non-relocatable package
-e, --erase=<package>+ erase (uninstall) package
--excludedocs do not install documentation
--excludepath=<path> skip files with leading component <path>
--force short hand for --replacepkgs --replacefiles
-F, --freshen=<packagefile>+ upgrade package(s) if already installed
-h, --hash print hash marks as package installs (good with -v)
--ignorearch don't verify package architecture
--ignoreos don't verify package operating system
--ignoresize don't check disk space before installing
-i, --install install package(s)
--justdb update the database, but do not modify the filesystem
--nodeps do not verify package dependencies
--nofiledigest don't verify digest of files
--nocontexts don't install file security contexts
--noorder do not reorder package installation to satisfy dependencies
--noscripts do not execute package scriptlet(s)
--notriggers do not execute any scriptlet(s) triggered by this package
--nocollections do not perform any collection actions
--oldpackage upgrade to an old version of the package (--force on upgrades does this automatically)
--percent print percentages as package installs
--prefix=<dir> relocate the package to <dir>, if relocatable
--relocate=<old>=<new> relocate files from path <old> to <new>
--replacefiles ignore file conflicts between packages
--replacepkgs reinstall if the package is already present
--test don't install, but tell if it would work or not
-U, --upgrade=<packagefile>+ upgrade package(s)
Common options for all rpm modes and executables:
-D, --define='MACRO EXPR' define MACRO with value EXPR
--undefine=MACRO undefine MACRO
-E, --eval='EXPR' print macro expansion of EXPR
--macros=<FILE:...> read <FILE:...> instead of default file(s)
--nodigest don't verify package digest(s)
--nosignature don't verify package signature(s)
--rcfile=<FILE:...> read <FILE:...> instead of default file(s)
-r, --root=ROOT use ROOT as top level directory (default: "/")
--dbpath=DIRECTORY use database in DIRECTORY
--querytags display known query tags
--showrc display final rpmrc and macro configuration
--quiet provide less detailed output
-v, --verbose provide more detailed output
--version print the version of rpm being used
Options implemented via popt alias/exec:
--scripts list install/erase scriptlets from package(s)
--setperms set permissions of files in a package
--setugids set user/group ownership of files in a package
--conflicts list capabilities this package conflicts with
--obsoletes list other packages removed by installing this package
--provides list capabilities that this package provides
--requires list capabilities required by package(s)
--info list descriptive information from package(s)
--changelog list change logs for this package
--xml list metadata in xml
--triggers list trigger scriptlets from package(s)
--last list package(s) by install time, most recent first
--dupes list duplicated packages
--filesbypkg list all files from each package
--fileclass list file names with classes
--filecolor list file names with colors
--fscontext list file names with security context from file system
--fileprovide list file names with provides
--filerequire list file names with requires
--filecaps list file names with POSIX1.e capabilities
Help options:
-?, --help Show this help message
--usage Display brief usage message
check the simple query of the package by the command line.
$ rpm --scripts -q <name> for View part of the installation and uninstallation processes.
$ rpm --changelog -q <name> for Display change information for the package
$ rpm --provides -q <name> for List capabilities this package provides.
$ rpm -R -q <name> for List capabilities on which this package depends.
$ rpm -i -q <name> for View Information, including name, version, and description.
$ rpm -c -q <name> for View only configuration file.
$ rpm -l -q <name> for View all file .
$ rpm -d -q <name> for View documentation.
$ rpm -p -q <name.rpm> for View appication file name.
$ rpm -f -q <name> for View Query package owning file.
Example
The command for List of the provide package of yum
$ rpm -R -q yum
/bin/bash
/usr/bin/python
config(yum) = 3.4.3-118.el7.centos
cpio
diffutils
pygpgme
pyliblzma
python >= 2.4
python(abi) = 2.7
python-iniparse
python-sqlite
python-urlgrabber >= 3.9.0-8
pyxattr
rpm >= 0:4.4.2
rpm-python
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
yum-metadata-parser >= 1.1.0
yum-plugin-fastestmirror
rpmlib(PayloadIsXz) <= 5.2-1
Another query command
$ rpm --scripts -q httpd
$ rpm --changelog -q yum
$ rpm --provides -q perl
$ rpm -R -q python
$ rpm -i -q kernel
$ rpm -c -q httpd
$ rpm -l -q openssh-server
$ rpm -d -q httpd
$ rpm -p -q ftp-0.17-66.el7.x86_64.rpm
$ rpm -f -q /etc/yum.repos.d/
How it work
Use Rpm to install/Remove packages Manually
Getting ready
$ vagrant up
$ vagrant ssh
How to do it
Install the rpm package by command line
$ sudo rpm -ivh ftp-0.17-66.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:ftp-0.17-66.el7 ################################# [100%]
Update the package by command line
$ sudo rpm -Uivh ftp-0.17-67.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:ftp-0.17-67.el7 ################################# [100%]
Remove the package by the command line
$ sudo rpm -evh ftp
Preparing... ################################# [100%]
Cleaning up / removing...
1:ftp-0.17-67.el7 ################################# [100%]
How it work
Install the packages by yum and Its type of Syntax.
Getting ready
$ vagrant up
$ vagrant ssh
How to do it
From the man pages yum, it Yellowdog Updater Modified.
use help command for yum
# yum --help
yum key option for basic
$ yum --help
Loaded plugins: fastestmirror
Usage: yum [options] COMMAND
List of Commands:
check Check for problems in the rpmdb
check-update Check for available package updates
clean Remove cached data
deplist List a package's dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package
erase Remove a package or packages from your system
fs Creates filesystem snapshots, or lists/deletes current snapshots.
fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots.
groups Display, or use, the groups information
help Display a helpful usage message
history Display, or use, the transaction history
info Display details about a package or group of packages
install Install a package or packages on your system
list List a package or groups of packages
load-transaction load a saved transaction from filename
makecache Generate the metadata cache
provides Find what package provides the given value
reinstall reinstall a package
repo-pkgs Treat a repo. as a group of packages, so we can install/remove all of them
repolist Display the configured software repositories
search Search package details for the given string
shell Run an interactive yum shell
swap Simple way to swap packages, instead of using shell
update Update a package or packages on your system
update-minimal Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system
updateinfo Acts on repository update information
upgrade Update packages taking obsoletes into account
version Display a version for the machine and/or available repos.
Options:
-h, --help show this help message and exit
-t, --tolerant be tolerant of errors
-C, --cacheonly run entirely from system cache, don't update cache
-c [config file], --config=[config file]
config file location
-R [minutes], --randomwait=[minutes]
maximum command wait time
-d [debug level], --debuglevel=[debug level]
debugging output level
--showduplicates show duplicates, in repos, in list/search commands
-e [error level], --errorlevel=[error level]
error output level
--rpmverbosity=[debug level name]
debugging output level for rpm
-q, --quiet quiet operation
-v, --verbose verbose operation
-y, --assumeyes answer yes for all questions
--assumeno answer no for all questions
--version show Yum version and exit
--installroot=[path] set install root
--enablerepo=[repo] enable one or more repositories (wildcards allowed)
--disablerepo=[repo] disable one or more repositories (wildcards allowed)
-x [package], --exclude=[package]
exclude package(s) by name or glob
--disableexcludes=[repo]
disable exclude from main, for a repo or for
everything
--disableincludes=[repo]
disable includepkgs for a repo or for everything
--obsoletes enable obsoletes processing during updates
--noplugins disable Yum plugins
--nogpgcheck disable gpg signature checking
--disableplugin=[plugin]
disable plugins by name
--enableplugin=[plugin]
enable plugins by name
--skip-broken skip packages with depsolving problems
--color=COLOR control whether color is used
--releasever=RELEASEVER
set value of $releasever in yum config and repo files
--downloadonly don't update, just download
--downloaddir=DLDIR specifies an alternate directory to store packages
--setopt=SETOPTS set arbitrary config and repo options
--bugfix Include bugfix relevant packages, in updates
--security Include security relevant packages, in updates
--advisory=ADVS, --advisories=ADVS
Include packages needed to fix the given advisory, in
updates
--bzs=BZS Include packages needed to fix the given BZ, in
updates
--cves=CVES Include packages needed to fix the given CVE, in
updates
--sec-severity=SEVS, --secseverity=SEVS
Include security relevant packages matching the
severity, in updates
Now ,check the list of package by yum command
$ yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
repo id repo name status
base/7/x86_64 CentOS-7 - Base 9,007
extras/7/x86_64 CentOS-7 - Extras 266
updates/7/x86_64 CentOS-7 - Updates 1,676
repolist: 10,949
also use for all yum repo list
$ yum repolist all
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
repo id repo name status
base/7/x86_64 CentOS-7 - Base enabled: 9,007
base-source/7 CentOS-7 - Base Sources disabled
centosplus/7/x86_64 CentOS-7 - Plus disabled
centosplus-source/7 CentOS-7 - Plus Sources disabled
debug/x86_64 CentOS-7 - Debuginfo disabled
extras/7/x86_64 CentOS-7 - Extras enabled: 266
extras-source/7 CentOS-7 - Extras Sources disabled
updates/7/x86_64 CentOS-7 - Updates enabled: 1,676
updates-source/7 CentOS-7 - Updates Sources disabled
repolist: 10,949
check for yum list of packages
for all list
$ yum list all
for install list
$ yum list installed
check list of kernel
$ yum list kernel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
Installed Packages
kernel.x86_64 3.10.0-123.el7 @anaconda
kernel.x86_64 3.10.0-123.4.4.el7 @updates
Available Packages
kernel.x86_64 3.10.0-327.18.2.el7 updates
$ uname -a
Linux localhost.localdomain 3.10.0-123.4.4.el7.x86_64 #1 SMP Fri Jul 25 05:07:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ uname -r
3.10.0-123.4.4.el7.x86_64
for use find the package by path
$ yum provides /etc/yum.repos.d/
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
yum-3.4.3-132.el7.centos.0.1.noarch : RPM package installer/updater/manager
Repo : base
Matched from:
Filename : /etc/yum.repos.d/
yum-3.4.3-118.el7.centos.noarch : RPM package installer/updater/manager
Repo : @anaconda
Matched from:
Filename : /etc/yum.repos.d/
for group list
$ yum grouplist
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
Available environment groups:
Minimal Install
Compute Node
Infrastructure Server
File and Print Server
Basic Web Server
Virtualization Host
Server with GUI
GNOME Desktop
KDE Plasma Workspaces
Development and Creative Workstation
Available Groups:
Compatibility Libraries
Console Internet Tools
Development Tools
Graphical Administration Tools
Legacy UNIX Compatibility
Scientific Support
Security Tools
Smart Card Support
System Administration Tools
System Management
Done
for check the particular packages from list
$ yum list python
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
Installed Packages
python.x86_64 2.7.5-16.el7 @anaconda
Available Packages
python.x86_64 2.7.5-34.el7 base
for Display information
$ yum info ftp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
Available Packages
Name : ftp
Arch : x86_64
Version : 0.17
Release : 66.el7
Size : 61 k
Repo : base/7/x86_64
Summary : The standard UNIX FTP (File Transfer Protocol) client
URL : ftp://ftp.linux.org.uk/pub/linux/Networking/netkit
License : BSD with advertising
Description : The ftp package provides the standard UNIX command-line FTP (File
: Transfer Protocol) client. FTP is a widely used protocol for
: transferring files over the Internet and for archiving files.
:
: If your system is on a network, you should install ftp in order to do
: file transfers.
search the information of group
$ yum group info 'Virtualization Host'
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
Environment Group: Virtualization Host
Environment-Id: virtualization-host-environment
Description: Minimal virtualization host.
Mandatory Groups:
+base
+core
+virtualization-hypervisor
+virtualization-tools
Optional Groups:
+debugging
+network-file-system-client
+remote-system-management
+virtualization-platform
search the package name by yum
$ yum search all 'Virtualization Host'
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
============================================================ Matched: Virtualization Host ============================================================
libvirt-gobject.i686 : libvirt object APIs for managing virtualization hosts
libvirt-gobject.x86_64 : libvirt object APIs for managing virtualization hosts
libvirt-gobject-devel.i686 : libvirt object APIs for managing virtualization hosts development files
libvirt-gobject-devel.x86_64 : libvirt object APIs for managing virtualization hosts development files
install the group package
$ sudo yum group install 'web server'
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: mirror.fibergrid.in
* extras: mirror.fibergrid.in
* updates: mirror.nbrc.ac.in
Resolving Dependencies
--> Running transaction check
---> Package crypto-utils.x86_64 0:2.4.1-42.el7 will be installed
--> Processing Dependency: perl(Newt) for package: crypto-utils-2.4.1-42.el7.x86_64
---> Package httpd-manual.noarch 0:2.4.6-40.el7.centos.1 will be installed
---> Package mod_fcgid.x86_64 0:2.3.9-4.el7 will be installed
---> Package mod_ssl.x86_64 1:2.4.6-40.el7.centos.1 will be installed
--> Processing Dependency: openssl-libs >= 1:1.0.1e-37 for package: 1:mod_ssl-2.4.6-40.el7.centos.1.x86_64
--> Running transaction check
---> Package openssl-libs.x86_64 1:1.0.1e-34.el7_0.3 will be updated
--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-34.el7_0.3 for package: 1:openssl-1.0.1e-34.el7_0.3.x86_64
---> Package openssl-libs.x86_64 1:1.0.1e-51.el7_2.5 will be an update
---> Package perl-Newt.x86_64 0:1.08-36.el7 will be installed
--> Running transaction check
---> Package openssl.x86_64 1:1.0.1e-34.el7_0.3 will be updated
---> Package openssl.x86_64 1:1.0.1e-51.el7_2.5 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Installing for group install "Web Server":
crypto-utils x86_64 2.4.1-42.el7 base 78 k
httpd-manual noarch 2.4.6-40.el7.centos.1 updates 1.3 M
mod_fcgid x86_64 2.3.9-4.el7 base 79 k
mod_ssl x86_64 1:2.4.6-40.el7.centos.1 updates 103 k
Installing for dependencies:
perl-Newt x86_64 1.08-36.el7 base 64 k
Updating for dependencies:
openssl x86_64 1:1.0.1e-51.el7_2.5 updates 712 k
openssl-libs x86_64 1:1.0.1e-51.el7_2.5 updates 952 k
Transaction Summary
======================================================================================================================================================
Install 4 Packages (+1 Dependent package)
Upgrade ( 2 Dependent packages)
Total download size: 3.3 M
Is this ok [y/d/N]:
Installing and Removing the package
$ yum install ftp
Loaded plugins: fastestmirror
You need to be root to perform this command.
[vagrant@localhost ~]$ sudo yum install ftp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.fibergrid.in
* extras: mirror.fibergrid.in
* updates: mirror.nbrc.ac.in
Resolving Dependencies
--> Running transaction check
---> Package ftp.x86_64 0:0.17-66.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Installing:
ftp x86_64 0.17-66.el7 base 61 k
Transaction Summary
======================================================================================================================================================
Install 1 Package
Total size: 61 k
Installed size: 96 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : ftp-0.17-66.el7.x86_64 1/1
Verifying : ftp-0.17-66.el7.x86_64 1/1
Installed:
ftp.x86_64 0:0.17-66.el7
Complete!
Removing the packages
$ sudo yum remove ftp
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package ftp.x86_64 0:0.17-66.el7 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Removing:
ftp x86_64 0.17-66.el7 @base 96 k
Transaction Summary
======================================================================================================================================================
Remove 1 Package
Installed size: 96 k
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : ftp-0.17-66.el7.x86_64 1/1
Verifying : ftp-0.17-66.el7.x86_64 1/1
Removed:
ftp.x86_64 0:0.17-66.el7
Complete!
for update the packages
$ sudo yum update
for check the history of yum
$ sudo yum history
Loaded plugins: fastestmirror
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
7 | vagrant <vagrant> | 2016-05-18 05:52 | Erase | 1
6 | vagrant <vagrant> | 2016-05-18 05:50 | Install | 1
5 | vagrant <vagrant> | 2016-05-18 03:34 | Install | 3
4 | root <root> | 2014-08-01 08:54 | Install | 1
3 | root <root> | 2014-08-01 08:43 | Install | 4
2 | root <root> | 2014-08-01 08:40 | I, U | 30
1 | System <unset> | 2014-08-01 08:32 | Install | 389
history list
also see history in log
$ sudo tail -3 /var/log/yum.log
May 18 05:50:09 Installed: ftp-0.17-66.el7.x86_64
May 18 05:52:04 Erased: ftp-0.17-66.el7.x86_64
How it work
Making Repository manually
Getting ready
$ vagrant up
$ vagrant ssh
How to do it
Creating repository manually.
$ sudo vim /etc/yum.repos.d/mypack.repo
[packcentos]
name = packcentos
baseurl = file:///packagecentos7
gpgcheck = 0
~
~
~
~
~
:wq!
$ mkdir packagecentos7
$ cp -av
$ sudo createrepo packagecentos7/
Spawning worker 0 with 1 pkgs
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
$ sudo yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras packcentos updates
Cleaning up everything
Cleaning up list of fastest mirrors
$ yum repolist all
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
packcentos | 2.9 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/5): packcentos/primary_db | 2.0 kB 00:00:00
(2/5): extras/7/x86_64/primary_db | 117 kB 00:00:00
(3/5): base/7/x86_64/group_gz | 155 kB 00:00:00
(4/5): updates/7/x86_64/primary_db | 4.9 MB 00:00:30
(5/5): base/7/x86_64/primary_db | 5.3 MB 00:00:57
Determining fastest mirrors
* base: centos.mirror.net.in
* extras: centos.mirror.net.in
* updates: mirror.nbrc.ac.in
repo id repo name status
base/7/x86_64 CentOS-7 - Base enabled: 9,007
base-source/7 CentOS-7 - Base Sources disabled
centosplus/7/x86_64 CentOS-7 - Plus disabled
centosplus-source/7 CentOS-7 - Plus Sources disabled
debug/x86_64 CentOS-7 - Debuginfo disabled
extras/7/x86_64 CentOS-7 - Extras enabled: 266
extras-source/7 CentOS-7 - Extras Sources disabled
packcentos packcentos enabled: 1
updates/7/x86_64 CentOS-7 - Updates enabled: 1,676
updates-source/7 CentOS-7 - Updates Sources disabled
repolist: 10,950
Enable/Disable the yum configuration by command line
$ sudo yum-config-manager --disable