In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian introduces in detail "how to install and use rpm commands under Linux" with detailed content, clear steps and proper handling of details. I hope that this article "how to install and use rpm commands under Linux" can help you solve your doubts.
Linux common commands rpm command is the management tool of RPM software package. Rpm, originally a Red Hat Linux distribution program designed to manage Linux suites, is popular because it follows GPL rules and is powerful and convenient.
Management tools of rpmRPM software package
Syntax rpm (option) (parameter) option-a: query all packages;-b + or-t +: set the completion phase of the wrapper package and specify the file name of the package file;-c: list only configuration files, this parameter should be used with the "- l" parameter;-d: list only text files, this parameter should be used with the "- l" parameter;-e or-erase: delete the specified package -hash: query the package with the specified file;-h or-- hash: list the tags when the package is installed;-I: display information about the package;-I or-- install: install the specified package file;-l: display the file list of the suite;-pause: query the specified RPM file;-Q: use the query mode, when any questions are encountered, the rpm instruction will ask the user first. -R: display the relevant information of the suite;-s: display the file status, this parameter needs to be used with the "- l" parameter;-U or-- upgrade: upgrade the specified package file;-v: display the instruction execution process;-vv: show the instruction execution process in detail, easy to debug. Parameter package: specifies the rpm package to manipulate.
How to install rpm software package with an example
The installation of the rpm package can be done using the program rpm. Execute the following command:
Rpm-ivh your-package.rpm where your-package.rpm is the file name of the rpm package you want to install, which is usually placed in the current directory.
The following warnings or prompts may appear during installation:
... Conflict with... It is possible that some files in the package to be installed may overwrite existing files, which cannot be installed correctly by default. You can use rpm-- force-I to force the installation.
... Is needed by...... Is not installed... You can use rpm-- nodeps-I to ignore this information if you do not install some of the software required by this package, that is, 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 be fully functional.
How to install the .src.rpm package
Some packages end in .src.rpm, which are rpm packages that contain source code and need to be compiled at installation time. There are two ways to install such packages:
Method 1:
Rpm-I your-package.src.rpm cd / usr/src/redhat/SPECS rpmbuild-bp your-package.specs # A specs file cd / usr/src/redhat/BUILD/your-package/ # with the same name as your software package and a directory with the same name as your software package. / configure # this step is the same as compiling ordinary source software, you can add the parameter make make install method 2:
The first two steps of rpm-I you-package.src.rpm cd / usr/src/redhat/SPECS are the same as method one.
Rpmbuild-bb your-package.specs # A specs file with the same name as your package is now in / usr/src/redhat/RPM/i386/ (depending on the package, it may be i686 philosophy noarch, etc.) in this directory, there is a new rpm package, which is a compiled binary.
Execute rpm-I new-package.rpm to complete the installation.
How to uninstall the rpm package
Use the command rpm-e package name, which can contain information such as the version number, but cannot have the suffix .rpm, such as uninstalling 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 has some errors or warnings:
... Is needed by... This shows that this software is needed by other software and can not be uninstalled casually. It can be forced to be uninstalled with rpm-e-nodeps.
How to get the files in the rpm package without installing
Use the tools rpm2cpio and cpio
Rpm2cpio xxx.rpm | cpio-vi rpm2cpio xxx.rpm | cpio-idmv rpm2cpio xxx.rpm | cpio-- extract-- make-directories parameter I is the same as extract, which means the file is extracted. V indicates the execution process, d is the same as make-directory, indicates that the directory is established according to the original path of the file in the package, and m indicates the update time of the file.
How to view files and other information related to rpm packages
All of the following examples assume the use of the package mysql-3.23.54a-11
1. Those rpm packages are installed on my system.
Rpm-qa will list all installed packages if you want to find all installed packages that contain a string sql
Rpm-qa | grep sql2, how to get the full file name of a software package.
Rpm-Q mysql can get the full name of the mysql package installed in the system, from which you can get information such as the version of the current package. In this example, you can get the information mysql-3.23.54a-11.
3. Where are the files in a rpm package installed?
Rpm-ql package name Note here is the name of the package that does not include the .rpm suffix, which means you can only 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 put, you can also use which, such as:
Which mysql4, a rpm package contains those files.
An uninstalled software package, using rpm-qlp * .rpm
A software package that has already been installed, you can also use rpm-ql * .rpm
5. How to get information about the version and purpose of a software package?
An uninstalled software package, using rpm-qip * .rpm
A software package that has already been installed, you can also use rpm-qi * .rpm
6. Which package installed a program, or which package contains the program.
Rpm-qf `program name `# returns the full name of the package rpm-qif `which program name` # returns information about the package rpm-qlf `which program name` # returns the file list of the package note that it is not a quotation mark, but the key in the upper left corner of the keyboard. You can also use rpm-qilf` to output package information and a list of files.
7. Which package installed a file, or which package contains the file.
Note that the method in the previous question applies only to executable programs, while the following methods can be used not only for executable programs, but also for any ordinary file. As long as you know the file name. First get the full path to the program, using whereis or which, and 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 more instance source packages-> compile-> binary packages (rpm package / system default package)
Rpm naming rules: software (software name, software version) + system (os version, os digits) rpm check: SM5DLUGT-> size modified (type / permission) md5 device L (file path) user group time (modified time)
Yum: solving the problem of rpm dependency
# rpm mysql57-community-release-el6-8.noarch.rpm # an example of a rpm package / var/lib/rpm/ # package full name-> database of package name rpm-Uivh-- dodeps xxx # upgrade install verbose hash rpm-qilpfa | grep xxx # query info list (location of files after rpm package installation) package (rpm package) file (which rpm file the file belongs to) all rpm-e # erase rpm-V # verify rpm2cpio | cpio-idv # rpm default security Install location / etc/ configuration file / usr/bin/ executable file / function library used by urs/lib/ program / usr/share/doc/ user manual / usr/share/man/ manual read here This article "how to install and use rpm commands under Linux" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself. If you want to know more about the article, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.