RHEL6-31-RPM
Red Hat has simplified the installation of software in Linux by
creating the Red Hat Package Manager (RPM). A package, or RPM file, will
install a given application and create the necessary directories to run it.
An RPM package can contain an arbitrary set of files. The larger part
of RPM files encountered are “binary RPMs” (or BRPMs) containing the compiled
version of some software. There are also “source RPMs” (or SRPMs) files
containing the source code used to produce a package. These have an appropriate
tag in the file header that distinguishes them from normal (B)RPMs, causing
them to be extracted to /usr/src on installation. SRPMs customarily carry the
file extension “.src.rpm” (.spm on file systems limited to 3 extension
characters, e.g. old DOS FAT).
Package filename and label
An RPM is delivered in a single file, normally in the format:
<name>-<version>-<release>.<architecture>.rpm
such as:
libgnomeuimm-2.0-2.0.0-3.i386.rpm
where <name> is libgnomeuimm, <version> is 2.0,
<release> is 2.0.0-3, and <architecture> is i386.
vsftpd-2.2.2-11.el6.x86_64
Package-Name Version Release RedHat-Version Platform
Source code may also be distributed in RPM packages in which case the
<architecture> part is specified as src as in,
libgnomeuimm-2.0-2.0.0-3.src.rpm
RPMs with the noarch.rpm extension refer to packages which do not
depend on a certain computer's architecture. These include graphics and text
for another program to use, and programs written in interpreted programming languages
such as Python programs and shell scripts.
FROM WHERE THE RPM GET INFO ABOUT INSTALLED PACKAGES…??
“/var/lib/rpm/” is a RPM database holds information about all the RPM
packages installed on the system, and is used to query what packages are installed,
what versions each package is, and any changes to any files in the package
since installation, among others.
[root@rhel6-test1 ~]# ls /var/lib/rpm/
Basenames __db.004 Name Pubkeys Triggername
Conflictname Dirnames
Obsoletename Requirename
__db.001 Filedigests Packages Requireversion
__db.002 Group Providename Sha1header
__db.003 Installtid Provideversion Sigmd5
These files make up the RPM database. The file __db.001 and similar
files are lock files used by the RPM system. The other files are databases in
Berkeley DB format. The most important file is Packages. The Packages file
contains the header tag information for each package indexed by an index number
for each package. This number slowly grows with time.
It is always better to have the backup of this dir.
WHAT WE CAN DO WITH RPM…??
1. INSTALL
2. UNINSTALL
3. UPGRADE
4. QUERY
5. VERIFY
All is well with RPM’s except their “DEPENDENCY HELL” feature.
QUERY:
·
How to query/dump installed packages in linux?
·
How to get the info about metadata/ info about an
rpm package?
·
How to list the files of an rpm package?
·
How to find the documentation about an rpm
package?
·
How to find the configuration files of an rpm
package?
·
How to find the dependency of an rpm package?
·
How to find the state (installed-replaced-normal)
of an rpm package?
For options that display lists of files, add -v to the command to
display the lists in a familiar ls -l format.
[root@rhel6-test1 ~]# rpm -qa |wc -l
890
[root@rhel6-test1 ~]# rpm -qa |grep -i ssh
openssh-server-5.3p1-84.1.el6.x86_64
libssh2-1.4.2-1.el6.x86_64
openssh-5.3p1-84.1.el6.x86_64
openssh-askpass-5.3p1-84.1.el6.x86_64
openssh-clients-5.3p1-84.1.el6.x86_64
[root@rhel6-test1 ~]# rpm -qa |grep -i vsftpd
vsftpd-2.2.2-11.el6.x86_64
[root@rhel6-test1 /]# rpm -qi openssh
Name : openssh Relocations: (not
relocatable)
Version : 5.3p1 Vendor: Red Hat,
Inc.
Release : 84.1.el6 Build Date: Thu 13 Dec 2012 07:20:49 PM IST
Install
Date: Tue 30 Aug 2016 03:44:57 AM IST
Build Host: x86-010.build.bos.redhat.com
Group : Applications/Internet Source RPM:
openssh-5.3p1-84.1.el6.src.rpm
Size : 675617 License: BSD
Signature : RSA/8, Thu 17 Jan 2013 10:19:49 PM IST,
Key ID 199e2f91fd431d51
Packager : Red Hat, Inc.
<http://bugzilla.redhat.com/bugzilla>
URL : http://www.openssh.com/portable.html
Summary : An open source implementation of SSH
protocol versions 1 and 2
Description
:
SSH
(Secure SHell) is a program for logging into and executing
commands
on a remote machine. SSH is intended to replace rlogin and
rsh,
and to provide secure encrypted communications between two
untrusted
hosts over an insecure network. X11 connections and
arbitrary
TCP/IP ports can also be forwarded over the secure channel.
OpenSSH
is OpenBSD's version of the last free version of SSH, bringing
it
up to date in terms of security and features.
This
package includes the core files necessary for both the OpenSSH
client
and server. To make this package useful, you should also
install
openssh-clients, openssh-server, or both.
[root@rhel6-test1 /]# rpm -ql openssh
/etc/ssh
/etc/ssh/moduli
/usr/bin/ssh-keygen
/usr/libexec/openssh
/usr/libexec/openssh/ssh-keysign
/usr/share/doc/openssh-5.3p1
/usr/share/doc/openssh-5.3p1/CREDITS
/usr/share/doc/openssh-5.3p1/ChangeLog
/usr/share/doc/openssh-5.3p1/INSTALL
/usr/share/doc/openssh-5.3p1/LICENCE
/usr/share/doc/openssh-5.3p1/OVERVIEW
/usr/share/doc/openssh-5.3p1/PROTOCOL
/usr/share/doc/openssh-5.3p1/PROTOCOL.agent
/usr/share/doc/openssh-5.3p1/README
/usr/share/doc/openssh-5.3p1/README.dns
/usr/share/doc/openssh-5.3p1/README.nss
/usr/share/doc/openssh-5.3p1/README.platform
/usr/share/doc/openssh-5.3p1/README.privsep
/usr/share/doc/openssh-5.3p1/README.smartcard
/usr/share/doc/openssh-5.3p1/README.tun
/usr/share/doc/openssh-5.3p1/TODO
/usr/share/doc/openssh-5.3p1/WARNING.RNG
/usr/share/man/man1/ssh-keygen.1.gz
/usr/share/man/man8/ssh-keysign.8.gz
[root@rhel6-test1 /]# rpm -qlv openssh
drwxr-xr-x 2 root
root 0 Dec
13 2012 /etc/ssh
-rw------- 1 root
root 125811 Dec
13 2012 /etc/ssh/moduli
-rwxr-xr-x 1 root
root 154864 Dec
13 2012 /usr/bin/ssh-keygen
drwxr-xr-x 2 root
root 0 Dec
13 2012 /usr/libexec/openssh
-rwsr-xr-x 1 root
root 224912 Dec
13 2012 /usr/libexec/openssh/ssh-keysign
drwxr-xr-x 2 root
root 0 Dec
13 2012 /usr/share/doc/openssh-5.3p1
-rw-r--r-- 1 root
root 5545 Aug
30 2006
/usr/share/doc/openssh-5.3p1/CREDITS
=============O/P REMOVED======================================
[root@rhel6-test1 /]# rpm -qd openssh
/usr/share/doc/openssh-5.3p1/CREDITS
/usr/share/doc/openssh-5.3p1/ChangeLog
/usr/share/doc/openssh-5.3p1/INSTALL
/usr/share/doc/openssh-5.3p1/LICENCE
/usr/share/doc/openssh-5.3p1/OVERVIEW
/usr/share/doc/openssh-5.3p1/PROTOCOL
/usr/share/doc/openssh-5.3p1/PROTOCOL.agent
/usr/share/doc/openssh-5.3p1/README
/usr/share/doc/openssh-5.3p1/README.dns
/usr/share/doc/openssh-5.3p1/README.nss
/usr/share/doc/openssh-5.3p1/README.platform
/usr/share/doc/openssh-5.3p1/README.privsep
/usr/share/doc/openssh-5.3p1/README.smartcard
/usr/share/doc/openssh-5.3p1/README.tun
/usr/share/doc/openssh-5.3p1/TODO
/usr/share/doc/openssh-5.3p1/WARNING.RNG
/usr/share/man/man1/ssh-keygen.1.gz
/usr/share/man/man8/ssh-keysign.8.gz
[root@rhel6-test1 /]# rpm -qc openssh
/etc/ssh/moduli
[root@rhel6-test1 /]# rpm -qR openssh
/sbin/nologin
audit-libs
>= 1.0.8
config(openssh)
= 5.3p1-84.1.el6
initscripts
>= 5.20
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libc.so.6(GLIBC_2.8)(64bit)
libcom_err.so.2()(64bit)
libcrypt.so.1()(64bit)
libcrypto.so.10()(64bit)
libfipscheck.so.1()(64bit)
libgssapi_krb5.so.2()(64bit)
libk5crypto.so.3()(64bit)
libkrb5.so.3()(64bit)
libnsl.so.1()(64bit)
libnss3.so()(64bit)
libnss3.so(NSS_3.2)(64bit)
libnss3.so(NSS_3.3)(64bit)
libnss3.so(NSS_3.4)(64bit)
libnss3.so(NSS_3.6)(64bit)
libnss3.so(NSS_3.9)(64bit)
libnss3.so(NSS_3.9.2)(64bit)
libplc4.so()(64bit)
libresolv.so.2()(64bit)
libresolv.so.2(GLIBC_2.2.5)(64bit)
libselinux
>= 1.27.7
libutil.so.1()(64bit)
libz.so.1()(64bit)
rpmlib(CompressedFileNames)
<= 3.0.4-1
rpmlib(FileDigests)
<= 4.6.0-1
rpmlib(PayloadFilesHavePrefix)
<= 4.0-1
rtld(GNU_HASH)
rpmlib(PayloadIsXz)
<= 5.2-1
[root@rhel6-test1 /]# rpm -qs openssh
normal /etc/ssh
normal /etc/ssh/moduli
normal /usr/bin/ssh-keygen
normal /usr/libexec/openssh
normal /usr/libexec/openssh/ssh-keysign
normal /usr/share/doc/openssh-5.3p1
normal /usr/share/doc/openssh-5.3p1/CREDITS
normal /usr/share/doc/openssh-5.3p1/ChangeLog
normal /usr/share/doc/openssh-5.3p1/INSTALL
normal /usr/share/doc/openssh-5.3p1/LICENCE
normal /usr/share/doc/openssh-5.3p1/OVERVIEW
normal /usr/share/doc/openssh-5.3p1/PROTOCOL
normal
/usr/share/doc/openssh-5.3p1/PROTOCOL.agent
normal /usr/share/doc/openssh-5.3p1/README
normal /usr/share/doc/openssh-5.3p1/README.dns
normal /usr/share/doc/openssh-5.3p1/README.nss
normal
/usr/share/doc/openssh-5.3p1/README.platform
normal
/usr/share/doc/openssh-5.3p1/README.privsep
normal /usr/share/doc/openssh-5.3p1/README.smartcard
normal /usr/share/doc/openssh-5.3p1/README.tun
normal /usr/share/doc/openssh-5.3p1/TODO
normal
/usr/share/doc/openssh-5.3p1/WARNING.RNG
normal /usr/share/man/man1/ssh-keygen.1.gz
normal /usr/share/man/man8/ssh-keysign.8.gz
VERIFY:
·
How to confirm the integrity/genuineness of an rpm
package?
·
How to confirm that which rpm package owns the
given file?
·
How to verify all installed rpm packages in one
go?
Verifying a package compares information about files installed from a
package with the same information from the original package. Among other
things, verifying compares the size, MD5 sum, permissions, type, owner, and
group of each file.
[root@rhel6-test1 /]# rpm -Vv vsftpd
......... c /etc/logrotate.d/vsftpd
......... c /etc/pam.d/vsftpd
......... /etc/rc.d/init.d/vsftpd
......... /etc/vsftpd
......... c /etc/vsftpd/ftpusers
......... c /etc/vsftpd/user_list
......... c /etc/vsftpd/vsftpd.conf ççç
......... /etc/vsftpd/vsftpd_conf_migrate.sh
......... /usr/sbin/vsftpd
......... /usr/share/doc/vsftpd-2.2.2
......... d /usr/share/doc/vsftpd-2.2.2/AUDIT
......... d /usr/share/doc/vsftpd-2.2.2/BENCHMARKS
......... d /usr/share/doc/vsftpd-2.2.2/BUGS
......... d /usr/share/doc/vsftpd-2.2.2/COPYING
......... d /usr/share/doc/vsftpd-2.2.2/Changelog
......... /usr/share/doc/vsftpd-2.2.2/EXAMPLE
.........
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE
......... d
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README
......... d /usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README.configuration
=============O/P REMOVED======================================
I filled some garbage value to “/etc/vsftpd/vsftpd.conf”
[root@rhel6-test1 /]# service vsftpd restart
[root@rhel6-test1 /]# rpm -Vv vsftpd
......... c /etc/logrotate.d/vsftpd
......... c /etc/pam.d/vsftpd
......... /etc/rc.d/init.d/vsftpd
......... /etc/vsftpd
......... c /etc/vsftpd/ftpusers
......... c /etc/vsftpd/user_list
S.5....T.
c /etc/vsftpd/vsftpd.conf ççç
......... /etc/vsftpd/vsftpd_conf_migrate.sh
......... /usr/sbin/vsftpd
......... /usr/share/doc/vsftpd-2.2.2
......... d /usr/share/doc/vsftpd-2.2.2/AUDIT
......... d /usr/share/doc/vsftpd-2.2.2/BENCHMARKS
=============O/P REMOVED======================================
What is this S.5....T.
5 — MD5 checksum differ
S — file size differ
L — symbolic link path mismatch
T — file modification time differ
D — device major/minor no differ
U — user ownership differ
G — group ownership differ
M — mode (includes permissions and file type)
? — Unreadable file
We are getting error of “S-5 & T”
Means file size, MD5 & modification time is different
[root@rhel6-test1 /]# rpm -Vvf /etc/ssh/sshd_config
......... c /etc/pam.d/ssh-keycat
......... c /etc/pam.d/sshd
......... /etc/rc.d/init.d/sshd
.M.....T. c /etc/ssh/sshd_config
......... c /etc/sysconfig/sshd
......... /usr/libexec/openssh/sftp-server
......... /usr/libexec/openssh/ssh-keycat
......... /usr/sbin/.sshd.hmac
......... /usr/sbin/sshd
......... /usr/share/doc/openssh-server-5.3p1
......... d
/usr/share/doc/openssh-server-5.3p1/HOWTO.ssh-keycat
......... d /usr/share/man/man5/moduli.5.gz
......... d /usr/share/man/man5/sshd_config.5.gz
......... d /usr/share/man/man8/sftp-server.8.gz
......... d /usr/share/man/man8/sshd.8.gz
......... /var/empty/sshd
[root@rhel6-test1 /]# rpm -Va
.M....... /media
S.5....T. c /etc/libuser.conf
....L.... c /etc/pam.d/fingerprint-auth
....L.... c /etc/pam.d/password-auth
....L.... c /etc/pam.d/smartcard-auth
....L.... c /etc/pam.d/system-auth
S.5....T. c /etc/updatedb.conf
S.5....T. c /etc/login.defs
..5....T. c /etc/inittab
.......T. c /etc/rc.d/rc.local
S.5....T. c /etc/sysctl.conf
=============O/P REMOVED======================================
INSTALL:
#rpm –ivh <package-name>.rpm
-i install
-v verbose
-h hash mark
[root@rhel6-test1 VM_SHARE]# rpm -ivh
tmux-1.6-1.el6.rf.x86_64.rpm
warning:
tmux-1.6-1.el6.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6:
NOKEY
error:
Failed dependencies:
libevent-1.4.so.2()(64bit) is needed by
tmux-1.6-1.el6.rf.x86_64
If
stuck with “Dependency Hell” then might do forceful installation.
#rpm –ivh --force <package-name>.rpm
[root@rhel6-test1 VM_SHARE]# rpm -ivh --force
tmux-1.6-1.el6.rf.x86_64.rpm
warning:
tmux-1.6-1.el6.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6:
NOKEY
error:
Failed dependencies:
libevent-1.4.so.2()(64bit) is needed by
tmux-1.6-1.el6.rf.x86_64
#rpm –ivh --nodeps <package-name>.rpm
[root@rhel6-test1 VM_SHARE]# rpm -ivh --nodeps
tmux-1.6-1.el6.rf.x86_64.rpm
warning:
tmux-1.6-1.el6.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6:
NOKEY
Preparing...
########################################### [100%]
1:tmux
########################################### [100%]
Though the package has been installed, but this is not a recommended
way to do this.
Definitely, the program will not work.
[root@rhel6-test1 VM_SHARE]# tmux
tmux: error while loading shared libraries: libevent-1.4.so.2: cannot
open shared object file: No such file or directory
Now uninstalling “tmux”,
[root@rhel6-test1 VM_SHARE]# rpm -e tmux
[root@rhel6-test1 VM_SHARE]# tmux
-bash: /usr/bin/tmux: No such file or directory
If you attempt to install a package that contains a file which has
already been installed by another package,
#rpm -ivh --replacefiles <package-name>.rpm
If a package of the same name and version is already installed,
#rpm -ivh --replacepkgs <package-name>.rpm
If you are installing a package from the Red Hat Enterprise Linux
CD-ROM set, it usually suggest the package(s) needed to resolve the dependency.
Find the suggested package(s) on the Red Hat Enterprise Linux CD-ROMs or from
Red Hat Network.
I went to RHEL6 DVD-ROM,
[root@rhel6-test1 VM_SHARE]# cd /media/Packages/
Searched for package “tmux”
[root@rhel6-test1 Packages]# ls -ltr |grep -i
"tmux"
Not available,
Installing from stored place,
[root@rhel6-test1 Packages]# rpm -ivh
/mnt/hgfs/VM_SHARE/tmux-1.6-1.el6.rf.x86_64.rpm
warning:
/mnt/hgfs/VM_SHARE/tmux-1.6-1.el6.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature,
key ID 6b8d79e6: NOKEY
error:
Failed dependencies:
libevent-1.4.so.2()(64bit) is needed by
tmux-1.6-1.el6.rf.x86_64
getting
dependency error. Searching dependency package at DVD
[root@rhel6-test1 Packages]# ls -ltr |grep -i libevent
-r--r--r--. 81 root root 67472 May
3 2012
libevent-1.4.13-4.el6.x86_64.rpm
-r--r--r--. 116 root root
68456 May 3 2012 libevent-1.4.13-4.el6.i686.rpm
Installing dependency first,
[root@rhel6-test1 Packages]# rpm -ivh
libevent-1.4.13-4.el6.x86_64.rpm
warning:
libevent-1.4.13-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID
fd431d51: NOKEY
Preparing...
########################################### [100%]
1:libevent
########################################### [100%]
Now installing package,
[root@rhel6-test1 Packages]# rpm -ivh
/mnt/hgfs/VM_SHARE/tmux-1.6-1.el6.rf.x86_64.rpm
warning:
/mnt/hgfs/VM_SHARE/tmux-1.6-1.el6.rf.x86_64.rpm: Header V3 DSA/SHA1 Signature,
key ID 6b8d79e6: NOKEY
Preparing...
########################################### [100%]
1:tmux
########################################### [100%]
Now the program is working properly.
UNINSTALL:
#rpm –e <package-name>.rpm
[root@rhel6-test1 VM_SHARE]# rpm -e tmux
[root@rhel6-test1 VM_SHARE]# tmux
-bash: /usr/bin/tmux: No such file or directory
It might through the dependency error while uninstalling a package if
another installed package depends on the one we are trying to remove.
To make RPM ignore this error and uninstall the package anyway (which
may break the package dependent on it), use following
#rpm –e --nodeps <package-name>.rpm
Here “--nodeps" means only remove the specified package, leave/don’t-touch
the dependencies.
UPGRADE:
#rpm –Uvh <package-name>.rpm
As part of upgrading a package, RPM automatically uninstalls any old
versions of the mentioned package. “-U” will also install a package even when
there are no previous versions of the package installed.
To force RPM to upgrade anyway, use the --oldpackage option:
#rpm -Uvh --oldpackage <package-name>.rpm
WARNING:
It is never recommended to upgrade a Kernel, always installa kernel so that in
case any issue we can revert back/ boot from previous kernel.
REFERENCES & GOOD READ:
https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-rpm-using.html
https://unix.stackexchange.com/questions/79457/where-do-installed-rpms-go
https://unix.stackexchange.com/questions/79457/where-do-installed-rpms-go
No comments:
Post a Comment