1. Introduction of package Management 1. Package classification
SOURCE Package
- Script installation Package
Binary package (RPM package, system default package)
2. The advantages of source code package are:
- Open source, if you have enough ability, you can modify the original code
- Be free to choose the functions you need
- Software design compiled and installed, so more suitable for their own system, more stable and effective
- Easy to uninstall
The disadvantages of the source package:
- Many steps in the installation process, especially when installing large software collections (such as lamp environment), prone to spelling errors
- Longer compilation time, longer installation time than binary installation
- Because it is compiled and installed, it is difficult for novice to solve the error during installation.
Advantages of 3.RPM Package binary packages:
- Package management system is simple, with only a few commands to implement package installation, upgrade, query and Uninstall
- Installation speed is much faster than the source package installation
Binary Package Disadvantages:
- The source code can no longer be seen after compiling
- Feature selection is not as flexible as source package
- Dependence
4. Script installation Package
The so-called script installation package, that is, the complex package installation process as a program script, beginners can execute the program script implementation of one-click installation. But the actual installation is the source package and the binary package.
Advantages: Easy and quick installation
Cons: Total loss of customization
2. RPM Command Management
Red Hat package manager/rpm software Manager
RPM Package naming rules 1.RPM package source
RPM package on the system CD
2.RPM Package Naming principle
httpd-2.2.15-15.el6.centos.1.i686.rpm
- HTTPD Package Name
- 2.2.15 software version
- 15 Number of software releases
- El6.centos the right Linux platform
- i686 the right hardware platform
- RPM RPM Extension
3.RPM Packet Dependency
Tree-dependent: C, a-B
Ring-dependent: A, B, C, a
Module dependency: module dependency, query website: www.rpmfind.net
Installation commands 1. Full name of package and package name
Package Full Name: The package full name is used when the operating package is not installed. and pay attention to the path.
Package Name: When you operate a package that has already been installed, the package name is used to search for the database in/var/lib/rpm/.
2.RPM Installation
RPM-IVH Package Full Name
Options:
- -I (Install) installation
- -V (verbose) Show details
- -H (hash) Show progress
- --nodeps does not detect dependencies
Upgrade and Uninstall 1, RPM package upgrade
RPM-UVH Package Full Name
Options:
2. Uninstall
RPM-E Package Name
Options:
- -E (Erase) Uninstall
- --nodeps does not check for dependencies
RPM Package Query 1. Whether the query is installed
RPM-Q Package Name
# query whether packages are installed
Rpm-qa
# query all installed RPM packages
Rpm-qa | grep httpd
2. Query Package Details
RPM-QI Package Name
Options:
- -I query software information (information)
- -P Query No package information installed
3. Query the file installation location in the package
RPM-QL Package Name
Options:
- -l lists (list)
- -P Query No package information installed
RPM Package Default installation location
RPM Package Default installation path |
/etc/ |
Configuration file installation directory |
/usr/bin |
Executable Command installation directory |
/usr/lib/ |
function library where the program is stored |
/usr/share/doc |
Basic software User manual save location |
/usr/share/man/ |
Help File Save location |
4, the query system files belong to which RPM package
RPM-QF System File name
Options:
- -F Query which package the system file belongs to (file)
5, query the dependencies of the package
RPM-QR Package Name
Options:
- -R Query Package dependencies (requires)
- -P Query No package information installed
RPM Package Check 1, RPM package check
RPM-V Package Name
The details of the 8 information in the verification content are as follows:
- S file size is changed
- M file type or file permission (RWX) is changed
- 5 file MD5 Checksum is changed (can be seen as file content changes)
- Whether the master/slave Code of the D device has been changed
- L file path is changed
- Whether the owner of the U file has changed
- Whether the genus Group of G files has changed
- T File modification Time changed
- File type
- C Profile (config file)
- D Normal document (documentation)
- G "Ghost file", rarely seen, is that the file should not be included in this RPM package
- L Authorization Document (license file)
- R profile (Read Me)
2. File extraction in RPM package
Rpm2cpio Package Full Name | Cpio-idv. File absolute Path
- Rpm2cpio
# convert RPM package to cpio Format command
- Cpio
# is a standard tool for creating software archive files and extracting files from archive files
[[email protected] ~]# cpio Options < [file | device]
Options:
- -i:copy-in mode, restoring
- -D: Automatically create a new directory when restoring
- -V: Displays the restore process
rpm-qf/bin/ls# query which package the LS command belongs to, MV/bin/ls /tmp//mnt/cdrom/package/ coreutils-8.4-el6.i686.rpm | Cpio-idv./bin/ls# extract RPM packet in the LS command to the current directory of /bin/ls under cp /root/bin/ls /bin/ # Copy the ls command back to the/bin/directory to repair file loss
3. Yum Online Management
RPM Package Disadvantage: During the installation process, the RPM package is too dependent. If all RPM packages are manually installed, the RPM package is more difficult to use.
Yum Advantage: Put all packages on the official server, when the Yum online installation, can automatically solve the dependency problem.
Yum Cons: Red hat's yum online installation requires a fee
1.yum source File
vi /etc/yum.repos.d/CentOS-Base.repo
- [Base] Container name, must be placed in []
- Name container description, you can write your own
- Mirrorlist Mirror site, this can be commented out
- BaseURL the address of our Yum source server. The default is the official CentOS Yum source server, can be used, if you feel slow can be changed to your favorite Yum source address
- Enabled this container is not effective, if not written or written enable=1 are effective, written enable=0 is not effective
- Gpgcheck If 1 means that the RPM digital certificate is in effect and if 0 does not take effect
- Gpgkey the location of the shared-key file for the digital certificate. No modification
2. CD-ROM build yum source 1. Mount Disc
mkdir /mnt/cdrom# set mount point Mount /dev/cdrom/mnt/cdrom# mount Disc
2. Invalidating the network Yum source
cd/etc/Yumrepos.d/# Enter the Yum source directory mv Centos-base.repo centos-base.repo.bak# Modify the Yum source file suffix name, Make it ineffective
3. Make the CD Yum source effective
Vim centos-Media.repo[c6-Media]name=centos-$releasever-Mediabaseurl=file:///Mnt/cdrom # Address for your own CD mount address#file:///media/cdrom/#file:///Media/cdrecorder # Note These two nonexistent addressesgpgcheck=1enabled=1# change Enabled=0 to Enabled=1, let this yum source configuration file take effect Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
3.yum commands 1. Common Yum Commands
(1) Enquiry
Yum list# Querying the list of all available packages Yum Search Keyword # searches all and keyword-related packages on the server
(2) Installation
Yum Install Package Name options: Install Install --y Auto Answer Yes for example:yuminstallgcc
(3) Upgrade
Yum -y update package name options:- update Upgrade ---y Auto Answer Yes
(4) Uninstall
Yum -y Remove package name option:- Remove Uninstall ---------y Auto Answer Yes
Server uses minimal installation, what software installs what, try not to uninstall
2.yum Software Group Management commands
Yum grouplist# List of all available software groups Yum groupinstall Software Group name # Install the specified software group, the group name can be queried by Grouplist Yum groupremove Software Group name # Uninstalling the specified software group
4. Source package Management 1. The difference between the source package and the RPM package
Differences before installation: conceptual differences
The difference after installation: different installation locations
RPM Package Installation Location
Is installed in the default location
RPM installation can specify the installation location, but it is not recommended to specify the installation location
grep prefix --prefix=<dir> relocate the package to <dirif
Source Package Installation Location
Installed in the specified location, the general is:/usr/local/software name/
Source package does not have uninstall command
Impact of different mounting positions
RPM Package Installed services can be managed using the System Service Management Command (service), such as the boot method for the Apache installation of RPM packages:
- /ETC/RC.D/INIT.D/HTTPD start
- Service httpd Start (RedHat proprietary method)
The service that the source package installs cannot be managed by the Service Management command because it is not installed in the default path. Therefore, the service can only be managed with an absolute path, such as:
- /usr/local/apache2/bin/apachectl start
2. Source package installation Process 1. Installation Preparation
Installing the C language compiler
Download Source package: Use httpd-2.2.34 no error
Http://mirror.bit.edu.cn/apache/httpd
2. Precautions for installation
Source code save location:/usr/local/src/
Software Installation Location:/usr/local/
How to determine the installation process error:
The installation process stops and prompts for error, warning, or no
3. Source Package Installation Process
Download the source Package
Unzip the downloaded source package
Go to unzip Directory
- /configure software Configuration and inspection
- Define the required feature options.
- Detects if the system environment meets the installation requirements.
- The defined function options and the information of the inspection system environment are written to the makefile file for subsequent edits.
- [Email protected] httpd-2.2.34]#/configure--prefix=/usr/local/apache2
Make compiling Make Clean Make Install Compile and install /usr/local/apache2/bin/apachectl start
RPM Package Page Location/var/www/html/
Source Package Page Location/usr/local/apache2/htdocs/
4. Uninstall the source package
You do not need to uninstall the command, directly delete the installation directory. No junk files will be left behind.
5. Script Installation
Script-installed Notes will be updated later!
Linux Software Installation Management