RedHat software package management (I) -- The Learning idea of binary software package management Linux: Linux is very transparent compared with Windows, so whether it is a system or software... There will be their own, or Man provides a very detailed description, help documentation, we need to make good use of this RedHat software package management (on)
-- Binary package management
Linux's learning philosophy: compared with Windows, Linux is very transparent. therefore, whether it is a system or software... There will be their own, or Man provides a very detailed description, help documentation, we need to make good use of these documents, as long as the English is good enough, no textbooks, any teaching video, you can learn Linux well!
I. RPM Package management
Linux software package naming
Sudo-1.7.2p1-5. el5.I386. Rpm
Including software name (sudo), version (1.7.2pl), release number (5. el5), and hardware platform (i386)
(1) uninstall the software package
Rpm-e name // if other software packages are dependent, a message is displayed when you detach the software package.
Rpm-e? Nodeps name // add-nodeps, which can be forcibly uninstalled. However, it is not recommended to uninstall it like this.
(2) installation package: sudo
Rpm-ivh software package [e.g:Sudo-1.7.2p1-5. el5.I386. Rpm]
V: displays details. optional.
H: displays the installation progress. optional.
1. attach a CD: [best practice: attach the CD and USB flash disk to the/mnt Directory]
Mkdir/mnt/cdrom
Mount/dev/cdrom/mnt/cdrom
[Enable/mnt/cdrom is equivalent to accessing the CD content]
[All the binary software on the CD is stored in the CentOS Directory .]
2. check whether the query exists: ls | grep sudo
3. Installation: rpm-ivh sudo-1.7.2p1-5.el5.i386.rpm
4. check whether the command is installed: rpm-q sudo
5. rpm-qa | grep samba // query all samba-related software packages.
-Qa indicates Querying all installed software packages]
Other installation options
-- Excludedocs documents for non-installation of software
-- Prefix = PATH: install the software package to the PATH specified by PATH.
For example, rpm-ivh? Prefix =/usr/local sudo-1.7.2p1-5.el5.i386.rpm
However, most rpm packages do not allow you to change the installation path]
-- Test is only for testing, but not for real installation
[For example, if the dependency is obtained, whether the software package has been installed]
Special cases:
A. overwrite the installation
-- Replacepkgs overwrite the software installation package
B. installation conflict
If a file in the software package to be installed has been installed when other software packages are installed, the following error message is displayed:
Rpm-ivh sudo-1.7.2p1-5.el5.i386.rpm
Conflicts with file from bark-3.2-1l
Sudo-1.7.2p1-5.el5.i386.rpm cannot be installed
Use-replacefiles to ignore the change error message and overwrite the installation
C. unresolved dependencies
This software package may depend on other software packages. it can be installed only after a specific software package is installed.
Rpm-ivh sudo-1.7.2p1-5.el5.i386.rpm
Failed dependencies:
Sudo is needed by bark-3.2-1l
Use the -- nodeps option to forcibly install the software package.
(3) upgrade
Rpm-Uvh sudo-1.8.0p1-5.el5.i386.rpm
(4) query [important]
-A: query all installed software packages.
-F: query the software package of the file
-P query package
-Q: Check whether the software package is installed.
-I: displays the package information.
-L display the file list in the software package
-D: Display the list of files marked as documents
-C: displays the list of files marked as configuration files.
Instance:
1. query the packages of files/commands
Rpm-qf/etc/services
Rpm-qf/bin/ls
2. query the software package information
Rpm-qi samba // query an installed software package
Rpm-qip samba .. // you can query the rpm packages that have not been installed, but you need to write the full name!
3. query the installation file of the installation package and the location of the installation file.
Rpm-ql sudo
Rpm-qlp sudo... // not installed, full name!
4. query the help documentation and location of the software package
Rpm-qd sudo
Rpm-qdp sudo // not installed, full name!
5. query the software package configuration file and its location
Rpm-qc
Rpm-qcp // same as above
RPM integrated application instance
1. what is vncserver used ???
Rpm-qf vncserver
Then rpm-qi vnc-server... learn the details carefully.
II. query vim standard comments
Whether an installation package has been installed in the query system: rpm-qa | grep vim
Instead of using it directly: rpm-a vim
Query example documents: rpm-qa vim | grep example
(5) verification can be used to help us determine whether a software package has a problem and where the problem occurs.
[When rpm installs a software into the system, it will automatically generate an rpm Database. during verification, it will be compared with this database]
Rpm-V name is not prompted normally, and its files are not changed.
[Md5sum: generate a unique check value for the file through the md5 algorithm. the check value will not change as long as the file content remains unchanged]
[If any minor change is made to the content of this file, the verification value will change]
Md5 check value of the iis5 file
S file size
L link file
Creation or last modification time of the snapshot T file
Mongod device file
U file user
User Group of the G file
Permission on the M file
(6) important file repair
For example, if the/etc/inittab file is deleted, the file can be extracted from the original installation disc.
First, locate the software package to which the file belongs.
Rpm-qf/etc/inittab
Then decompress all the files to the current directory [not recommended]
# Rpm2cpi initscripts-8.45.30-2.el5.centos.i386.rpm | cpio-idv
Decompress the specified file to the current directory [recommended]
# Rpm2cpio/mnt/cdrom/initscripts-8.45.30-2.el5.centos.i386.rpm | cpio-idv./etc/inittab
[Note:./etc/inittab can only be extracted to the current directory]
[In terms of Linux Server management, we prefer to be stable, not the latest version]
II. YUM software package management [simple and intelligent]
Benefits of using YUM
(1) automatically solves dependencies between software installation packages
(2) convenient software package upgrade
(3) trusted, official software package
1. Installation
Yum install sudo
2. detection and upgrade
Yum check-update sudo
Yum check-update // check for updates to all software packages
3. upgrade [important: upgrade frequently for commonly used software packages]
Yum update sudo
4. query the software package information
Yum list // lists all software packages on the software source
[Best practice: yum list | less yum list | grep samba]
5. query the software package information
Yum info sudo
6. uninstall the software package
Yum remove sudo
7. View help information
Yum-help or man yum
[Best practice: yum-help | less]