RPM MANAGEMENT
rpm is a powerful Package Manager, which can be used to build, install, query, verify, update, and erase individual software packages. A package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages.
One of the following basic modes must be selected: Query, Verify, Signature Check, Install/Upgrade/Freshen, Uninstall, Initialize Database, Rebuild Database, Resign, Add Signature, Set Owners/Groups, Show Querytags, and Show Configuration.
INSTALL AND UPGRADE OPTIONS
The general form of an rpm install command is
rpm {-i|--install} [install-options] PACKAGE_FILE ...
This installs a new package.
The general form of an rpm upgrade command is
rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...
This upgrades or installs the package currently installed to a newer version. This is the same as install, except all other version(s) of the package are removed after the new package is installed. Red Hat Package Manager
Some Linux distribution uses rpm the “Red Hat Package Manager” for all its distribution software. RPM maintains a detailed database of all software installed in the system.
To install a RPM package, do:
rpm -i [package].rpm
The package will be installed only if the dependency are met and there is no conflict with another package. To upgrade a package, do:
rpm -U [package].rpm
The files of the old package version will be removed and replaced by the new files. To remove a RPM package, do:
rpm -e [package]
The package will be removed only if there are unresolved dependencies.
RPM Queries
With the -q option you can query the RPM database.
rpm -q -i apache
The -i is to get package information.\
There are several switches that you can use:
● -l: To get a file list of a package.
$ rpm -q -l pciutils
/sbin/lspci
/sbin/setpci
/usr/share/doc/package/pciutils
...
/usr/share/pci.ids
● -f file: Query a package owned by file.
$ rpm -q -f /sbin/lspci
pciutils-2.1.9-58
● -s: File list with status information.
● -d: list only documentation files.
● -a: List all the installed packages.
RPM Commands
To get general information on a package or program, use rpmlocate.
rpmlocate ipcs -q -i apache
Searching for ipcs in rpm db:
util-linux-2.11n-75:
/usr/bin/ipcs
/usr/share/man/man8/ipcs.8.gz
To list all the installed packages, use rpmqpack.
rpmqpack
Source Installation
The RPM source files have generally the format package.src.rpm and can be installed the same way as binaries. The directories where they will be installed from /usr/src/packages are:
● SOURCES: For the original sources.
● SPECS: For the .spec file that controls the build process.
● BUILD: All the sources are built in this directory.
● RPMS: Where the complete binary packages are stored.
● SRPMS: The sources.
To install the source of a package, do:
$ rpm -i mypack.src.rpm
The source files will be stored in the /usr/src/packages in directories SPEC and SOURCES. To compile the sources, do:
$ rpm -ba /usr/src/packages/SPECS/mypack.spec
Or
In rpm-4 the build stuff was moved into a separate binary called rpmbuild.
So the command you want now is: "rpmbuild -ba mypack.spec"
The result of the compilation will be stored in the BUILD directory
rpm {-F|--freshen} [install-options] PACKAGE_FILE ...
This will upgrade packages, but only if an earlier version currently exists. The PACKAGE_FILE may be specified as an ftp or http URL, in which case the package will be downloaded before being installed.
--aid
Add suggested packages to the transaction set when needed.
--force
Same as using --replacepkgs, --replacefiles, and –oldpackage.
-h, --hash
Print 50 hash marks as the package archive is unpacked. Use with -v|--verbose for a nicer display.
--nodeps
Don't check dependencies before uninstalling the packages.
Example:
rpm -ivh screen-3.9.11-3.i386.rpm
warning: screen-3.9.11-3.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:screen ########################################### [100%]
Example:
rpm –ivh –nodeps screen-3.9.11-3.i386.rpm
warning: screen-3.9.11-3.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:screen ########################################### [100%]
Example:
rpm –ivh --force screen-3.9.11-3.i386.rpm
warning: screen-3.9.11-3.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:screen ########################################### [100%]
QUERY OPTIONS
The general form of an rpm query command is
rpm {-q|--query} [select-options] [query-options]
You may specify the format that package information should be printed in. To do this, you use the
--qf|--queryformat QUERYFMT
E:g
Rpm –qa |grep –i httpd
REBUILD DATABASE OPTIONS
The general form of an rpm rebuild database command is
rpm {--initdb|--rebuilddb} [-v] [--dbpath DIRECTORY] [--root DIRECTORY]
Use --initdb to create a new database, use --rebuilddb to rebuild the database indices from the installed package headers.
rpm –rebuilddb
Red Hat Package Manager
Some Linux distribution uses rpm the “Red Hat Package Manager” for all its distribution software. RPM maintains a detailed database of all software installed in the system.
To install a RPM package, do:
rpm -i [package].rpm
The package will be installed only if the dependency are met and there is no conflict with another package. To upgrade a package, do:
rpm -U [package].rpm
The files of the old package version will be removed and replaced by the new files. To remove a RPM package, do:
rpm -e [package]
The package will be removed only if there are unresolved dependencies.
RPM Queries
With the -q option you can query the RPM database.
rpm -q -i apache
The -i is to get package information.\
There are several switches that you can use:
● -l: To get a file list of a package.
$ rpm -q -l pciutils
/sbin/lspci
/sbin/setpci
/usr/share/doc/package/pciutils
...
/usr/share/pci.ids
● -f file: Query a package owned by file.
$ rpm -q -f /sbin/lspci
pciutils-2.1.9-58
● -s: File list with status information.
● -d: list only documentation files.
● -a: List all the installed packages.
RPM Commands
To get general information on a package or program, use rpmlocate.
rpmlocate ipcs -q -i apache
Searching for ipcs in rpm db:
util-linux-2.11n-75:
/usr/bin/ipcs
/usr/share/man/man8/ipcs.8.gz
To list all the installed packages, use rpmqpack.
rpmqpack
Source Installation
The RPM source files have generally the format package.src.rpm and can be installed the same way as binaries. The directories where they will be installed from /usr/src/packages are:
● SOURCES: For the original sources.
● SPECS: For the .spec file that controls the build process.
● BUILD: All the sources are built in this directory.
● RPMS: Where the complete binary packages are stored.
● SRPMS: The sources.
To install the source of a package, do:
$ rpm -i mypack.src.rpm
The source files will be stored in the /usr/src/packages in directories SPEC and SOURCES. To compile the sources, do:
$ rpm -ba /usr/src/packages/SPECS/mypack.spec
Or
In rpm-4 the build stuff was moved into a separate binary called rpmbuild.
So the command you want now is: "rpmbuild -ba mypack.spec"
The result of the compilation will be stored in the BUILD directory
No comments:
Post a Comment