Installing rpm file package under Linux

  

1. How to install rpm package The installation of rmp package can be done using program rpm. Execute the following command rpm -i your-package.rpm where your-package.rpm is the file name of the rpm package you want to install, usually placed in the current directory. The following warnings or prompts may appear during the installation process: ... conflict with ... There may be some files in the package to be installed that may overwrite the existing files. By default, this may not be installed correctly. Use rpm --force -i to force the installation... is needed by ... ... is not installed ... Some software needed for this package you have not installed can use rpm --nodeps -i to ignore this information In other words, rpm -i --force --nodeps can ignore all dependencies and file problems, and any package can be installed, but this forced installation of the package is not guaranteed to fully function

2. How to install the .src.rpm package Some packages end with .src.rpm. These packages are rpm packages that contain source code and need to be compiled during installation. There are two ways to install this type of package, Method 1: 1. Execute rpm -i your-package.src.rpm 2. cd /usr/src/redhat/SPECS 3. rpmbuild -bp your-package.specs One and you The package with the same name specs file 4. cd /usr/src/redhat/BUILD/your-package/A directory with the same name as your package 5. ./configure This step is the same as compiling ordinary source software. Parameter 6. make 7. make install

Method 2: 1. Execute rpm -i you-package.src.rpm 2. cd /usr/src/redhat/SPECS The first two steps are the same as method one. Rpmbuild -bb your-package.specs A specs file with the same name as your package. At /usr/src/redhat/RPM/i386/(depending on the package, it may be i686, noarch, etc.) In this directory, there is a new rpm package, this is a compiled binary. Execute rpm -i new-package.rpm to complete the installation.

3. How to uninstall the rpm package using the command rpm -e package name, the package name can contain the version number and other information, but can not have a suffix. rpm For example, uninstall the package proftpd-1.2.8-1, you can Use the following format: rpm -e proftpd-1.2.8-1 rpm -e proftpd-1.2.8 rpm -e proftpd- rpm -e proftpd Cannot be in the following format: rpm -e proftpd-1.2.8-1.i386. Rpm rpm -e proftpd-1.2.8-1.i386 rpm -e proftpd-1.2 rpm -e proftpd-1 Sometimes there are some errors or warnings: ... is needed by ... This means that this software is required by other software Can not be uninstalled freely can be uninstalled with rpm -e --nodeps forced

4. How to not install but get the files in the rpm package using tools rpm2cpio and cpio rpm2cpio xxx.rpm |  Cpio -vi rpm2cpio xxx.rpm |  Cpio -idmv rpm2cpio xxx.rpm |  Cpio --extract --make-directories The parameters i and extract are the same, indicating that the file is extracted. v indicates that the execution process d is the same as the make-directory, indicating that the directory is created according to the original path of the file in the package.

5. How to view the files and other information related to the rpm package. All the examples below assume the use of the package mysql-3.23.54a-11 1. I installed those rpm packages rpm -qa on my system. Speaking of all installed packages, if you want to find all installed packages containing a string sql rpm -qa | Grep sql

2. How to get the full name of a package's file rpm -q mysql can get the full name of the mysql package installed in the system, from which you can get the current package version and other information. In this example, you can get the information mysql-3.23.54a-11

3. Is the file in a rpm package installed there? Rpm -ql package name Note that the name of the package that does not include the .rpm suffix is ​​to use mysql or mysql-3.23.54a-11 instead of mysql-3.23.54a-11.rpm. If you just want to know where the executable is going, you can also use which, such as which mysql

4. A rpm package contains those files that have not been installed, use rpm -qlp ** **.rpm An already installed package, you can also use rpm -ql ****.rpm

5. How to get information about the version, usage and other information of a package? A package that has not been installed, use rpm -qip ****.rpm an already installed package, you can also use rpm -qi ****.rpm

6. A program is Which package is installed, or which package contains this program rpm -qf `which program name ` Returns the full name of the package rpm -qif `which program name ` Returns information about the package rpm -qlf `which program name ` back The file list of the package Note that this is not a quote, but `, which is the key in the upper left corner of the keyboard. You can also use rpm -qilf to output package information and file list at the same time

7. Which package is installed for a file, or which package contains this file. Note the method in the previous question, only Applicable and executable programs, and the following methods can be used not only for executable programs, but also for any ordinary files. The premise is to know the file name. First get the full path to this program, you can use whereis or which, then use rpm -qf for example: # whereis ftptop ftptop: /usr/bin/ftptop /usr/share/man/man1/ftptop.1.gz # rpm -qf /usr/bin/ftptop proftpd-1.2.8-1 # rpm -qf /usr/share/doc/proftpd-1.2.8/rfc/rfc0959.txt proftpd-1.2.8-1

Summary: Obtain information about the package. Use rpm -q,q to query the query. You can use other options, such as i for info and information for the package. l for list, for a list of files.

Copyright © Windows knowledge All Rights Reserved