Current location - Quotes Website - Personality signature - Some basic questions about redhat linux 9.2!
Some basic questions about redhat linux 9.2!
Hello!

If you decide to be a good person, accept it.

No, you need to use the rpm command and go online to find some parameters of this command.

I. Installation

Command format:

Rpm -i (or-install) option file1.rpm ... filen.rpm.

Parameters:

File 1. Revolutions per minute ... the file name of the rpm package to be installed.

Detailed options:

-h (or -hash) output hash mark (`` #'') during installation.

-test only tests the installation, not the actual installation.

-percent outputs the installation progress as a percentage.

-excludedocs does not install document files in the package.

-Includes docs installation files

-replacepkgs forces the reinstallation of the installed software package.

-replacefiles replaces files belonging to other packages.

-force ignores conflicts between packages and files.

-noscripts does not run pre-installation and post-installation scripts.

-prefix installs the package to the specified path.

-ignorearch does not check the structure of the package.

-ignoreos does not check the operating system on which the package is running.

-nodeps does not check dependencies.

-ftpproxy acts as an FTP proxy.

-ftpport specifies that the port number of FTP is

Universal option

-v displays additional information.

-vv displays debugging information.

-root lets RPM use the specified path as the "root directory", so that both the pre-installation program and the post-installation program will be installed in this directory.

-rcfile sets the rpmrc file to

-dbpath sets the path where the RPM data list is located, as shown below

Second, delete

Command format:

Rpm -e (or-erase) option pkg 1...pkgN

parameter

Pkg 1...pkgN: Software package to be deleted.

Detailed options

-Tests only execute deleted tests.

-noscripts does not run pre-installation and post-installation scripts.

-nodeps does not check dependencies.

Universal option

-vv displays debugging information.

-root lets RPM use the specified path as the "root directory", so that both the pre-installation program and the post-installation program will be installed in this directory.

-rcfile sets the rpmrc file to

-dbpath sets the path where the RPM data list is located, as shown below

Third, upgrade

Command format

Rpm -U (or-upgrade) option file1.rpm ... filen.rpm.

parameter

File name 1.rpm...fileN.rpm package.

Detailed options

-h (or -hash) output hash mark (`` #'') during installation.

-oldpackage allows "upgrading" to an older version.

-Test Only upgrade tests are performed.

-excludedocs does not install document files in the package.

-Includes docs installation files

-replacepkgs forces the reinstallation of the installed software package.

-replacefiles replaces files belonging to other packages.

-force ignores conflicts between packages and files.

-percent outputs the installation progress as a percentage.

-noscripts does not run pre-installation and post-installation scripts.

-prefix installs the package to the specified path.

-ignorearch does not check the structure of the package.

-ignoreos does not check the operating system on which the package is running.

-nodeps does not check dependencies.

-ftpproxy acts as an FTP proxy.

-ftpport specifies that the port number of FTP is

Universal option

-v displays additional information.

-vv displays debugging information.

-root lets RPM use the specified path as the "root directory", so that both the pre-installation program and the post-installation program will be installed in this directory.

-rcfile sets the rpmrc file to

-dbpath sets the path where the RPM data list is located, as shown below

Fourth, query

Command format:

Rpm -q (or-query) option

Parameters:

Pkg 1...pkgN: Query the installed software packages.

Detailed options

-p (or ``-') to query the files of the software package.

-f Which package does the query belong to?

-Query all installed software packages

-whatprovides queries the packages that provide functionality.

-g Queries the packages belonging to this group.

-whatrequires queries all packages that require functions.

Information options

Displays all identities of the package.

-i Displays summary information of the software package.

-l Displays a list of files in the package.

-c displays the list of configuration files.

-d Displays a list of document files.

-s displays a list of files in the package and shows the status of each file.

-scripts displays installation, uninstallation, and verification scripts.

-queryformat (or-qf) displays query information in a user-specified way.

-dump displays all the verification information for each file.

-provides shows the functions provided by the software package.

-requires (or -r) shows the functions required by the software package.

Universal option

-v displays additional information.

-vv displays debugging information.

-root lets RPM use the specified path as the "root directory", so that both the pre-installation program and the post-installation program will be installed in this directory.

-rcfile sets the rpmrc file to

-dbpath sets the path where the RPM data list is located, as shown below

Verb (short for verb) Check the installed software package.

Command format:

Rpm -V (or-verify, or -y) option

parameter

Pkg1... The name of the package that pkgn will verify.

Software package options

-p Verify according to package file.

-f The bag to which the check belongs.

-Verify Verify all software packages.

-g Verify all packages that belong to this group.

Detailed options

-noscripts does not run validation scripts.

-nodeps does not check dependencies.

-nofiles is not an mcrc attribute.

Universal option

-v displays additional information.

-vv displays debugging information.

-root lets RPM use the specified path as the "root directory", so that both the pre-installation program and the post-installation program will be installed in this directory.

-rcfile sets the rpmrc file to

-dbpath sets the path where the RPM data list is located, as shown below

Six, check the files in the software package

Grammar:

Rpm -K (or-checksig) option file1.rpm ... filen.rpm.

Parameters:

The file name of File 1.rpm...filen.rpm software package.

Checksig-detailed options

-nopgp does not verify pgp signatures.

Universal option

-v displays additional information.

-vv displays debugging information.

-rcfile sets the rpmrc file to

Seven, other RPM options

-rebuild the RPM database with-rebuilddb.

-initdb creates a new RPM repository.

-Reduce output as quietly as possible.

-help displays the help file.

-version displays the current version of RPM.

First, install the specified options.

1.hash (or -h): use # to indicate the installation progress. If a software package is large and requires a lot of installation time, users must use this option if they want to know the installation progress in time. This option displays # to indicate progress, and each # represents 2% progress, with a total of 50 # displayed. Install the MySQL package as follows:

# rpm-I-hash MySQL-3 . 22 . 32- 1 . i386 . rpm

##################################################

#

As can be seen from the above, the software package installation was successfully completed.

2.percent: Displays the installation progress as a percentage.

Percent means percentage, and the function of this option is to display the installation progress as a percentage (%). The MySQL software package is also installed, and the following output is different:

# rpm- one percent MySQL-3.22.32-1.i386.rpm

%% 0.000000

%% 0.002600

%% 0.020586

......

%% 100.000000

#

In the above example, many outputs (...) are omitted. Because if the software package is large, there will be a lot of output when using-percent, so users had better use the-hash option and use # to indicate the installation progress, which is concise and clear.

3. Test: Installation test

The so-called installation test means that it is not a real installation, and it does not copy and create any files. The purpose of using this option is to detect whether the dependencies of the software package are met, whether there are potential conflicts, and so on.

# rpm-I-test autofs-3. 1.3-2.i386 . rpm

Error: Failed dependency:

Autofs-3. 1.3-2 requires mktemp.

#

In this example, a dependency error was found during the installation test. The mktemp package required by autofs does not exist, and the installation was interrupted.

Let's install the mktemp software package first, and then do the autofs installation test to see what it is:

# rpm-I MK temp- 1.5-2 . i386 . rpm

# rpm-I-test autofs-3. 1.3-2.i386 . rpm

#

As can be seen from the above, there is no mistake in this test.

4.replacepkgs: replace the software package

Why change the software package? The reason may be that the software package in the system is damaged, and one or more files are lost or damaged. If the user wants to repair this software package and install it directly, RPM will exit with an error:

# rpm -V file

/usr/man/man1/file.1

# rpm -i file -3.26-6.i386.rpm

The package file -3.26-6 has been installed.

#

Note: In this example, first check the file package with the RPM check command, and find that/usr/man/man1/file.1file is missing. Then use the installation command to install, and the RPM prompts that the software package file-3.26-6 has been installed. (For the RPM check command,> will introduce it in detail)

What happens if the-replacepkgs option is used?

# rpm -i-replacepkgs file -3.26-6.i386.rpm

# rpm -V file

#

It seems that RPM has successfully replaced the original software package. After checking the package, it is found that there is no error output, so the current package is complete.

5. Replace file: Replace file

RPM is an intelligent package manager, which maintains the file information of each installed package. If, when installing a new software package, RPM finds that one of the files has the same name as the file in the installed software package, but the contents are different, RPM will consider this as a file conflict and will exit in case of an error:

# rpm -i ff-4.0-2.i386.rpm

The file /root/my.a in ff-4.0-2 installation conflicts with the file in the software package.

Zoo -6.0- 1

#

Note: In this example, RPM finds that the software package ff-4.0-2 to be installed and the installed software package zoo-6.0- 1 contain the same file /root/my.a, but their contents are different, so it prompts the error of file conflict.

If users want to ignore this error, they can use the-replacefiles option to instruct RPM to directly replace the original file when file conflicts are found. Note: Unless the user has a deep understanding of the conflicting files, do not replace the files easily, so as not to destroy the integrity of the installed software package and ensure its normal operation.

# rpm-I-replace files ff-4.0-2 . i386 . rpm

#

With this option, the software package can be installed smoothly.

In addition, when replacing files, if the file in the software package to be installed already exists, but the file does not belong to any software package, the RPM method is to save the file with a different name (file name suffix plus sign). Rpmorig) and alert users with warning messages. As follows:

# rpm-I foo-6.0- 1. 1386 . rpm

Warning: /etc/foo.conf is saved as//etc/foo.conf.rpmorig

#

6.allfiles: install all files

When readers see this option, they may ask: Didn't the RPM installation package contain all the files? My answer is: If it is the first installation, RPM does install all the files in the software package. But if it is a repair package (with the-replacepkgs option), the result is not necessarily. The reason is that some configuration files in the RPM package can be recognized as missingok attributes (missingok means ok even if it is lost). After the software package is installed, if such configuration files are deleted, RPM will not install such files by default when repairing, unless the-allfiles option is adopted. Let's look at a practical example:

# rpm-I foo-6.0- 1. 1386 . rpm

# ls -l /etc/foo.conf

-rw-r-r- 1 root root 9 Oct 1 1 09:50/etc/foo . conf

# rm -f /etc/foo.conf

# rpm-I-replace pkgs foo-6.0- 1. 1386 . rpm

# ls -l /etc/foo.conf

Ls: /etc/foo.conf: The file or directory does not exist.

# rpm-I-replace pkgs-all files foo-6.0- 1 . i386 . rpm

# ls -l /etc/foo.conf

-rw-r-r- 1 root root 9 Oct 1 1 09:50/etc/foo . conf

Note: In this example, it is known in advance that the configuration file /etc/foo.conf in the foo package has the missingok attribute.

(1) install the foo package with rpm -i command;

(2) List the configuration file /etc/foo.conf to which the package belongs with the ls command (it can be listed, indicating that the file exists);

(3) Delete the file with rm command;

(4) using the rpm -i-replacepkgs command to repair the foo software package;

(5) Because the-allfiles option was not used during the repair, an error occurred when using the ls command to list the file /etc/foo.conf: the file did not exist and was not installed;

(6) install and repair foo software package with rpm-i-replace pkgs-all files command;

(7) List the files with the ls command again, and list them, indicating that they are installed this time.

In this example, if the user really wants to safely restore (repair) the software package, it is best to use the-allfiles option. In general, you don't have to do this, because the configuration file with the missingok attribute may be lost, so don't worry too much.

Pig, you made it.