There are three ways to manage packages under CentOS or Rhel:
One is to use RPM to install someone else's compiled packages, one to use yum, and one to use a compiled installation
1. Package Introduction
Components of the package:
Binary program:/bin,/sbin,/usr/bin,/usr/sbin,/usr/local/bin,/usr/local/sbin
library Files:/lib,/usr/lib,/usr/local/lib
configuration file:/etc
Help files: Manual (/etc/man.config), Readme,install (/usr/share/doc/)
Package Management tools: RMP,DPT
List of documents
file placement, installation path
Description of features provided
Dependent relationships
How to install the program:
Universal Binary Format: direct deployment to use
Package Manager
Package Manager front-end tools
Source Code compilation
RMP: Package, install, query, upgrade, checksum, uninstall, database management (Rebuild)
Compile and install: source code
Compiler: gcc,g++
provide a compilation environment: development environment
Binary
Library:/etc/ld.so.conf,/etc/ld.so.conf.d/*.conf
Help Manual:/etc/man.config,man-m
Files:/usr/include
Name of the source program: Name-version.tar. {GZ|BZ2|XZ} Package Name-version number
Version number Version:major.minor.release the major version number. minor version number. Issue number (fixed number)
The major version number is typically used to identify significant branches, and in general, a program can only make significant changes, and the major version number only changes the minor version number. The purpose of the release number is to fix some bugs and adjust some of the work properties
Bash-4.3.1.tar.xz
RPM Package naming: name-version-release.arch.rpm Package Name-Version number-issue number
Release number: is the RPM package of the package itself release number, with the program is not related; The release number of the RPM package that is used in the identification of the producer of the RPM package or the first several times of revision; The release number used to identify the RPM package itself, which can also contain the operating system used: EL6:RHEL6;CENTOS6;EL5;SUSE11
Arch: Host Platform
i686, x86_64, AMD64, PPC, Noarch
bash-4.3.2-5.el6.x86_64.rpm
RPM Sub-Package:
Main Package: Core package
Sub-Package: Support Package
Bind
Bind-devel
Bind-chroot
OS: Installation program
Redhat Series official Public key:
/etc/pki/rpm-gpg/
rpm-gpg-key-centos-6
2. Install the package using RMP
2.1. RPM option
Rpm-i/path/to/rpm_file
-I: Installing the Software
-V,-VV,-VVV: Show more information
-H: Displays the installation progress in #, a # Indicates the progress of%2
-ivh
-V Package Name: Verify installed Packages
-K (or--checksig) : Validation legitimacy
Rpm-k zsh-4.3.10-7.el6.x86_64.rpm
--nodeps: Ignoring dependencies
--test: Test Installation
--replacepkgs: Reinstall
-E Package Name: Uninstall
-q|--query Package Name: Query
Rpm-q zsh
-QA: Query all installed packages
Rpm-qa | grep "pattern"
-QI Package Name: Query Package summary information
-QL Package Name: List of files generated by query package installation
-QC Package Name: Query package Installation generated configuration file
-QD Package Name: Query package installation generated Help documentation
-qf/path/to/some_file: Query which rpm installation of a file was generated by
-Q--scripts Package Name: Query package installation Run related scripts
Preinstall: Pre-installation script
Postinstall: Post-installation script
Preuninstall: Pre-uninstall script
Postuninstall: Post-uninstallation script
-qpi/path/to/rpm_file: Querying for information about packages that have not been installed
-qpi
-qpl
-qpc
-qpd
-QP--scripts
-U: Upgrade + Install
-F: Upgrade
-uvh
-fvh
--force: Forced escalation
Note: The kernel should not be upgraded and should be installed as much as possible, allowing multiple versions to coexist
RPM Package Database:
/var/lib/rpm
Rebuild RPM Package Database:
--INITDB: New (does not overwrite the original file)
--REBUILDDB: Rebuild (overwrites the original file)
2.2. RPM Installation Example
RPM-IVH package_name.rpm
such as: Local installation (to have a package pair can)
# RPM-IVH tree-1.6.0-10.el7.x86_64.rpm
can also be installed from the network
RPM-IVH http://mirrors.aliyun.com/centos/6.6/os/x86_64/Packages/tree-1.5.32.el6.x86_64.rpm
Disadvantages cannot solve package dependencies by themselves
3. Install the package using Yum
3.1. About Yum
Source-Format RPM package:
Packaging: RPM Package making process is done according to spec file
Rpmbuild
YUM:RPM Front End Tools
To use Yum, first configure the Yum repository and
Yum Repository Yum Warehouse
Ftb,http,file
Path: Storage of RPM packages
Createrepo:
. Repo
Client:
Yum Install|reinstall|remove
/etc/yum.conf
/etc/yum.repos.d/*.repo
section:
[main] [] used as a warehouse definition
[REPOSITORY_ID]
name=
baseurl=
Enableed={1|0}
Gpgcheck={1|0}
gpgkey=
GPG: Check RPM signature
[Base]
Name=centos 6.4 x86_64
baseurl=http://192.168.1.20/cobbler/ks_mirror/centos-6.4-x86_64/
enabled=1
gpgcheck=1
Yum Client:
Yum subcommand:
list {all|installed|available}
repolist [all|enabled|disabled]
Info Package Name: View summary information for a package
Yum Info zsh
grouplist: See how many package groups are in the current Yum source
groupinfo Package group name: View related installation packages for package groups
Yum GroupInfo "Development tools"
Clean [Packages | metadata | expire-cache | rpmdb | plugins | all]
Makecache: Creating a Manual Build Cache
Yum Install package_name installation package
-y: Auto Answer Yes
Reinstall Package_name Reinstall package
Update package name upgrade
Update-to Package Name Version number
Remove Package name unload
Provides whatprovides queries which rpm installation of a file is generated by
Groupinstall Group Installation
Development Group:
RHEL6: "Development tools", "Server Platform Development", "Desktop Platform development"
RHEL5: "Development tools", "Development Libraries"
Groupupdate Upgrade
groupremove Removal
Localinstall command: RHEL5 for installing RPM packages locally instead of installing RPM packages via Yum source
HEL6 can be used for either local installation or Yum source installation
--nogpgcheck: Avoid checking the legitimacy of source packages
History: View previous operational histories such as loading and unloading
Version
Creation of the Yum repository:
LFTP:
Get: Single File download
mget: Multi-File download
Mirror: Mirroring a directory to a local
Bye: Exit
CD: Toggle
pwd: see where you are currently
3.2. Installation Example
Configuring the network Yum Source
CD/ETC/YUM.REPOS.D/MV Centos-base.repo centos-base.repo.bk #防止base. Repo [Base] conflict vim Base.repo [base] Name=base Baseurl=http://mirrors.sohu.com/centos/6.6/os/x86_64/gpgcheck=1 enabled=1 Gpgkey=file:///etc/pki/rpm-gpg/rpm-g Pg-key-centos-6
Configuring the ISO disc yum source
# mkdir/mnt/cdrom# Vim/etc/fstab/root/centos-6.6-x86_64-bin-dvd1.iso/mnt/cdrom iso9660 Loop 0 0 #
# Vim Base.repo[base]name=basebaseurl=http://mirrors.sohu.com/centos/6.6/os/x86_64/gpgcheck=1enabled=1gpgkey= file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6cost=1000[cdrom]name=cdrombaseurl=file:///mnt/cdromgpgcheck= 1enabled=1gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6cost=100# Yum Clean all #清缓存 # yum Makecache #建缓 Save
Installation
# yum grouplist# yum Groupinstall "Development tools" # Yum Install package
3. Use the Compile and install package
Autoconf--Configure script + makefile.in = Makefile
Automake-Makefile.in
Make install
To compile the installation steps:
# CD Source_code
#./configure
Check that the compilation environment is complete
Let the user customize the build configuration (through scripting options)
--help
--prefix=/usr/local/apache Specifying a default installation path
--sysconfdir Specifying where the configuration file is stored
# Make
# Make install
Library file search Path:/etc/ld.so.conf,/etc/ld.so.conf.d/*.conf
/usr/local/apache/lib
# ldconfig-v: Re-search the library file under the path searched by all library files on the current system and generate the cache/etc/ld.so.cache
/usr/local/apache/conf
/etc/man.config,
Manpath/usr/local/apache/share/man
Header file:
Ln-s
# TAR-XVF axel-2.4.tar.gz# cd axel-2.4#./configure--prefix=/usr/local/axel# make# make install #安装 # echo ' path=/ Usr/local/axel/bin: $PATH ' >/etc/profile.d/axel.sh #axel执行路径 #. /etc/profile #使配置文件生效 # vim/etc/man.config# Manpath/usr/local/axel/share/man #添加axel的man查找命令
This article is from the "three elder brother" blog, please be sure to keep this source http://523958392.blog.51cto.com/9871195/1617609
Three ways to install software under Linux