"My Linux, I am the boss!" "RPM Package Manager/yum Front end Tools/compilation installation from Getting started to mastering

Source: Internet
Author: User
Tags fpm gpg install php pack asymmetric encryption yum repolist

the--rpm of Linux package management
Network operating system is the architecture on the underlying hardware, the current kernel has a Linux series, UNIX class, Windows series, and so on, and then up to the library call, the implementation of the program in different operating systems to implement the same way. The interface that the operating system outputs to the user is called the API (application programming Interface) and outputs a unified calling interface to the user, so that when a file uses the calling interface, it can enter and output in a uniform format in different operating systems. such as
ABI (Application binary Interface) is the application of the binary interface, we know that Windows and Linux systems are incompatible, but if we want to implement the same application of different systems, we need to use library-level virtualization, In the Linux operating system, there is a wine system, in the Windows operating system, there are cywin systems, can be implemented in their respective operating systems to run non-operating system native applications, so as to achieve the expansion of operating system applications.
System-level development languages are C, C + +, and application-level development languages include Java, Python, PHP, Perl, and Ruby. The components of the binary application include: (1) binary (2) library file (3) configuration file (4) Help file.
In the Package Manager, the existing Debian release version of the Deb, DPT Manager, Redhat release version of the RPM manager.

RPM is an abbreviation for RPM Package Manager (RPM Packages Manager), although the file format name is Redhat, but its original design concept is open and now includes OpenLinux, SUSE, and Turbo Linux distributions such as Linux are used, and can be regarded as industry standards. RPM is a package and installation tool for the Internet download package, which is included in some Linux distributions. It generates a. RPM file extension.
rpm Main Features:
* Install, uninstall, upgrade and manage software
* Component Query function
* Verification function
* Package GPG (source legitimacy) and MD5 digital signature (integrity) pour, validate and publish
* Package Dependency Processing
* Select Install
* Network Remote Installation function
What is Package Manager:
Package files are packaged as one or several packages, making it easier to manage the installation, upgrade, uninstallation, and querying of packages. Mainly consists of two parts, the first is the package of the composition of the list, which is unique to each package, including the file list, install or uninstall the script to run, followed by the public database, mainly the name and version of the package, dependencies, function description and installation of the files generated by the file path and check code information.
Because dependencies exist between packages (for example, three files: x, Y, z), the package Manager requires a front-end management tool to resolve dependencies between associated files.
?? Yum: is the RPM Package manager's front-end management tool
?? Apt-get:deb Package Manager's front-end management tools
?? RPM front-end management tools on Zypper:suse
?? Dnf:fedora 22+rpm Package Manager Front End management tool
software source code naming format:
Source code: NAME-VERSION.TAR.GZ
? VERSION:major.minor.release
? Major: Major Version number
? Minor: Minor version number
? Release: Release number
the name format of the RPM package:
RPM package naming format is dependent on and continuation of the software source code naming format, the format is as follows
RPM Package: name-version-arch.rpm
? VERSION:major.minor.release
? ARCH:release.os.arch
Example:
zlib-1.2.7-13.el7.i686.rpm
RPM Package File organization structure:
Because an application may contain dozens of different functions, this time if all the features of the RPM package of the unified format of the production, for most users is not appropriate, this time need to classify the application functions, made to be user-free customization of the unpacking mode for software installation, as shown below.
TestApp: Unpacking
?? TESTAPP-VERSION-ARCH.RPM: Main Package
?? TESTAPP-DEVEL-VERSION-ARCH.RPM: Support Pack 1
?? TESTAPP-TESTING-VERSION-ARCH.RPM: Support Pack 2
Example:
YUM-LANGPACKS-0.4.2-3.EL.NOARCH.RPM: Main Package
YUM-PLUGIN-ALIASES-1.1.31-29.EL7.NOARCH.RPM: Support Package
ways to get packages:
(1) The System release CD or the official server:
??? CentOS Image:
???? Http://mirrors.aliyun.com
???? Http://mirrors.sohu.com
???? Http://mirrors.163.com
(2) Official site of the project
(3) Third party organizations:
??? Fedora-epel Community
??? Professional Search Engine:
???? http://pkgs.org
???? Http://rpmfind.net
???? Http://rpm.pbone.net
the RPM command management package on the CentOS system:
Install, uninstall, upgrade, query, verify, database maintenance.
(1) Installation:
RPM {-i|--install} [install-options] Package_file
?-v:verbose
?-VV: Show more detailed installation information
-H: Show package Management execution progress with "#", each "#" represents 2% Progress
RPM-IVH Package_file
?--Test: Tests the installation, but does not actually perform the installation process, belonging to the dry run mode
?--nodeps: Ignore dependencies
?--replacepkgs: Re-install
?--nosignature: Do not check the legitimacy of the source
?--Nodigest: Package integrity is not checked
?--noscipts: Do not execute Package script fragment
?? %pre: Pre-installation script:--nopre
?? %post: Post-installation script:--nopost
?? %preun: Pre-Uninstall script:--nopreun
?? %postun: Post-uninstallation script:--nopostun

Example:
#rpm-IVH--nodeps php-fpm-5.4.16-23.el7_0.3.x86_64.rpm
Explanation: Ignore dependencies install software php-fpm
#rpm-IVH--replacepkgs zsh-5.0.2-7.el7.x86.64.rpm
Explanation: Reinstall software zsh
#rpm-ivh--replacepkgs--nodigest--nosignature zsh-5.0.2-7.el7.x86.64.rpm
Explanation: Digest is completeness, signature is the legitimacy of the source, indicating that the installation does not check the integrity and source legitimacy of the ZSH installation package
(2) Upgrade:
RPM {-u|--upgrade} [install-options] Package_file
RPM {-f|--freshen} [install-options] Package_file
Upgrade: Install an older version of the package, then "Upgrade" or "install" if there is no legacy package
Freshen: Install an older version of the package, upgrade, or do not perform an upgrade if there is no legacy package
RPM-UVH Package_file
RPM-FVH Package_file
?--Oldpackage: Downgrade
?--force: Forced escalation
Attention:
(1) Do not upgrade the kernel, Linux support multi-core version coexist, so directly install the new version of the kernel can be
(2) If the original package configuration file has been modified after installation, upgrade the same configuration file provided by the new version will not directly overwrite the old version of the configuration file, but instead of renaming the newer version of the file (filename.rpmnew) to retain
(3) Enquiry:
RPM {-q|--query} [select-options] [query-options]
[Select-options]
?-Q: Query package
?-A: All packages
?-F: To see which package installs the specified file for build
-p/path/to/package_file: Query Its installation file information for a package file that has not been installed
?--whatprovides CAPABILITY: Query which package is supplied by the specified CAPABILITY
?--whatrequires CAPABILITY: Query which package the specified CAPABILITY is dependent on
[Query-options]
?--changelog: Query the update log for RPM packages
?-C: Query the program's configuration file
?-D: Querying a program's documentation
?-i:information
?-L: List license information
?-L: View all files generated after the installation of the specified package
?--scripts: script fragment with package
?-r: Query the capability that the specified package depends on
?--provides: Lists the capability that are provided by the specified package
Summary of Usage:
(1)-qi PACKAGE,-QF FILE,-QC PACKAGE,-QL PACKAGE,-QD Package
(2)-qpi PACKAGE_FILE,-QPL package_file
(3)-qa
Example:
#rpm-qa | grep "PHP"
Explanation: Query all RPM packages and find the package that starts with "PHP"
#rpm-qf/etc/issue
Explanation: Query/etc/issue file is generated by which package installation
#rpm-Q--whatrequires/bin/cat
Explanation: Query/bin/cat is dependent on which packages
#rpm-Q--whatprovides/bin/cat
Explanation: Query/bin/cat is provided by which package
#rpm-Q--changelog zsh
Explanation: Query the installation update log for ZSH
#rpm-Q-C zsh
Explanation: Query zsh contains the configuration file
#rpm-Q--conflicts zsh
Explanation: List zsh packages and which files conflict
#rpm-Q-D zsh
Explanation: List all the manual documents under the ZSH package
#rpm-qi zsh
Explanation: A summary of the package is listed, including the name, version, and description information
#rpm-QL zsh
Explanation: List of all files generated after zsh installation
#rpm-Q--scripts zsh
Explanation: List all scripts included in the program
#rpm-Q-R zsh
Explanation: Lists the capability that the ZSH package relies on
#rpm-ql-p php-common-5.4.16-23.el7_0.3.x86_64.rpm
Explanation: If the program Php-common is not installed, then use-p to query information about the files that can be generated after installation
(4) Uninstall:
RPM {e|--erase} [--allmatches] [--nodeps] [--noscripts] [--notriggers] [--test] Package_name
Example:
#rpm-E zsh
Explanation: Uninstalling Zsh
(5) Check:
RPM {-v|--verify} [select-options] [verify-options]
Verify the message meaning:
S file Size differs
M Mode differs (includes permissions and file type)
5 Digest (formerly MD5 sum) differs
D Device Major/minor number mismatch
L Readlink (2) path mismatch
U User ownership differs
G Group ownership differs
T MTime differs
P capabilities differ
Example:
#rpm-V zsh
Explanation: Verify where the zsh has changed.
Validation and completeness of package source legality:
Integrity Test: SHA256
? source legitimacy: RSA
Public Key cryptography:
? Symmetric encryption: Encryption, decryption using the same key
Asymmetric encryption: The key is paired
Public key: Public Key, open owner
? secret key: Private key, cannot be exposed
Import the required public key:
Key files provided by the CentOS 7 release CD: Rpm-gpg-key-centos-7
#rpm--import rpm-gpg-key-centos-7
(6) database reconstruction:
RPM {--INITDB|--REBUILDDB}
Initdb: Initialize, create new if no database exists beforehand; otherwise, no action is taken
REBUILDDB: rebuilding, whether existing or not, to recreate the database directly
Summary:
These commands are RPM Package Manager all the basic management functions, the subsequent configuration of all services, the first need to create a user and install the package, which is the two frequently used operations, wherein the installation package part of the proportion will be larger, so this part of the knowledge must be skilled use.
--yum of Linux package management
RPM is a package name for Linux that ends in. RPM and is installed with the following syntax: rpm-ivh,rpm report installation has a big drawback is that the file is too large, sometimes installed a software to install a lot of other packages, very troublesome, so there is the emergence of Yum front-end management tools , it can completely solve this software dependency problem, very convenient, as long as the configuration of two files can be installed. Simply put, RPM can only install RPM packages that have been downloaded to the local machine, yum can download and install RPM packages online, update the system, and automatically handle dependencies between packages and packets, which is an important issue addressed by the Yum front-end management tool.
Yum is the front-end management tool for the RPM Package Manager. Yum is a shell front-end package manager in Fedora and Redhat as well as CentOS. Based on RPM package management, the ability to automatically download RPM packages from specified servers and install them automatically handles dependency relationships and installs all dependent packages at once, without the hassle of downloading and installing them over and over again.

There will be some file servers in the network, there will be a piece of storage space on the server, to hold all the RPM package files that the user needs, then this file service system will be output to the external host through a file sharing service interface, this file service we call the Yum repository. Our general users are using a Linux host, which natively supports the basic functions of the RPM Package Manager and also supports the use of the Yum tool. The local Yum uses a configuration file to determine which of the servers in the network to download which packages, the configuration file will tell us the Yum tool on the host to find the desired file server, yum after receiving the instructions of the installation program will try to find the remote server host through configuration instructions. The remote server provides a metadata description of its own data warehouse, which is used to roughly record its own information, when the Linux host will only download the smaller-capacity metadata to the local cache caches, and the Yum client will analyze the installed instructions for the package name that the user requested to install. If there is a message like the Yum repository trying to read the download of this package, but also through the configuration file to analyze the dependencies between packages, will be analyzed to obtain the required but not yet installed package name, and listed, and then go to the Yum Warehouse request connection to download the required package. After the download is completed, the package will be cached in the local cache, the local will perform a similar RPM command operation, the installation will automatically first install the dependencies of the file, the installation will automatically clear the cache files to save space, but the metadata will not be deleted, Because the installation package files are rarely installed on a system more than once, the metadata file is used to compare and analyze multiple times, so it leaves a metadata file. Sometimes our clients are not connected to the Yum Repository server on the network when they are installing the Yum command, and we need to define our own policy to determine whether to use the RPM package files that have expired or cannot be judged. So yum client needs to connect a remote yum repository, download metadata files to the repository, support Yum to complete the installation or upgrade of the package locally, and if other dependent packages are needed, Yum will also need to start a file server client to the file server to download the required files. So we say Yum is the C/s architecture, it requires a file access server, complete the provision and installation management of the package.
Yum:yellowdog Udatte Modifier
Storage of many RPM packages and related metadata files for packages (placed in a specific directory: Repodata)
File Server:
? ftp://(FTP server provides file services)
?/HTTP (server provides file service)
NFS://(NFS File system service in Linux system)
? file:///(Local computer provides file services)
Yum Client:
? configuration file:
?? /ETC/YUM.CONF: Providing public configuration for all warehouses
?? /etc/yum.repos.d/*.repo: Provides configuration for the point of the warehouse
? The definition of the warehouse point:
?? [Repositoryid]
?? Name=some name for this repository (full description of the warehouse feature)
?? baseurl=url://path/to/repository/(points to the access path of the warehouse)
?? Enabled={1|0} (whether this warehouse is enabled, default is 1, enable this warehouse)
?? GPGCHECK={1|0} (verifying its integrity and source legitimacy before package installation)
?? Gpgkey=url (indicates the access path that can access the key file)
?? Enablegroup={1|0} (whether to use group-based bulk management packages)
?? Failovermethod={roundrobin|priority} (Polling | priority)
??? The default is: Roundrobin, which means random selection
?? cost=1000
??? Default is 1000

Example:
#vim Centos-local.repo
[Base]
Name=base Repo on 172.16.0.1
baseurl=http://172.16.0.1/cobbler/ks_mirror/centos-6.6-x86_64/
Gpgcheck=0
[Epel]
Name=fedora EPEL for EL6 x86_64
Baseurl=http://172.16.0.1/frdora-epel/6/x86_64
Gpgcheck=0

usage of the yum command:Yum [options] [command] [package]
? Show Warehouse List:
?? Repolist [all|enabled|disabled]
? Show Package:
?? List
?? #yum list [All | glob_exp1] [GLOB_EXP2]
?? #yum list {available|installed|updates} [GLOB_EXP1]
? Install Package:
?? Install Package1 [Package2]
?? Reinstall Package1 [Package2] (re-installed)
? Upgrade Package:
?? Update [PACKAGE1] [Package2]
?? Downgrade Package1 [Package2] (downgrade)
? Check for available upgrades:
?? Check-update
? Uninstall the package:
?? Remove | Erase Package1 [Package2]
? To view brief information about a package: (similar to Rpm-qi)
?? Info Package
? View which package is provided by the specified attribute (which can be a file):
?? provides | Whatprovides Feature1 [Feature2]
? Clean up the local cache:
?? Clean [Package | metadata | expire-cache | rpmdb | plugins | all]
?? (Package | metadata | Expired cache |rpm Database Data | plugins | all)
? Build the cache:
?? Makecache
? Search for relevant information by keyword:
?? Search string1 [string2] (searches for package name and summary information with the specified keyword)
? View the capabilities that the specified package depends on:
?? deplist [Package1] [Package2]
? View Yum Transaction history:
?? History [Info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]
Install and upgrade the local package:
?? Localinstall Rpmfile1 [Rpmfile2]
?? (Maintained for legacy reasons Only-use install)
?? Localupdate Rpmfile1 [Rpmfile2]
?? (Maintained for legacy reasons Only-use Update)
Related commands for package group management:
?? Groupinstall group1 [group2] (Installation package group)
?? Groupupdate group1 [group2] (Upgrade package group)
?? grouplist [Hidden] [Groupwildcard] (List of package groups)
?? Groupremove group1 [group2] (remove package group)
?? GroupInfo group1 (View information about package groups)
The configuration file requirements of the Yum source indicate that the exact match is made, the point of the Yum source repository must be upgraded, not degraded, and all CentOS 6.0 can point to the source of the CentOS6.1 and vice versa.
Example:
#less Centos-base.repo
Explanation: CentOS self-provided definition for repo warehouse files
#rpm-Q Yum
Explanation: Query the installation information for Yum
#rpm-QC Yum
Explanation: Querying Yum configuration file information
#yum repolist
Explanation: List all available warehouses in the system
#yum Install Php-common
Explanation: Installing the Php-common file
#yum Remove CPP
Explanation: Remove the CPP Package
#yum provides GCC
Explanation: See which package is provided by the GCC program
#yum Search Bash
Explanation: What is the search for information containing bash
#yum deplist GCC
Explanation: View the capabilities capabilities that the GCC package relies on
#yum history
Explanation: Querying past operations history for installation, upgrade, uninstallation, and other transactions
#yum History Summary
Explanation: View summary information about the installation history
#yum grouplist
Explanation: Show Package Group information
#yum Groupinstall "Development Tools"
Explanation: The package group "development tools" of the Installer development tool
Installation Example:
#mount-R/dev/cdrom/media/cdrom
#cd/etc/yum.repos.d/
#vim Local.repo
[Base]
Name=centos 7 Release 7.1.1503
Baseurl=file:///media/cdrom
Enabled=1
Gpgcheck=0
#yum repolist
Explanation: View all the available Yum warehouses in the system
#yum List all
Explanation: View All Packages
#yum grouplist
Explanation: Viewing package group information
Yum repository for the use of the Yum command:
How to use a disc as a local yum repository:
? (1) Mount the disc to a directory such as/media/cdrom
?? #mount-R-T Iso9660/dev/cdrom/media/cdrom
? (2) Creating a configuration file
?? [CentOS7]
?? Name=centos 7 Release 7.1.1503
?? Baseurl=file:///media/cdrom
?? Gpgcheck=0
?? Enabled=1
Yum command-Line options:
?--Nogpgcheck: No GPG checks are allowed
?-y: Auto Answer "yes"
?-Q: Silent mode
?--Disablerepo=repoidglob: Temporarily disable the repo specified here
?--Enablerepo=repoidglob: Temporarily enable the repo specified here
?--noplugins: Disable all plugins
The variables available in the Yum repo configuration file:
? $releasever: Major version number of the current OS release
? $arch: Platform
? $basearch: Base Platform
? $YUM 0-$YUM 9
? http://mirrors.magedu.com/centos/$releasever/$basearch/os
To create a yum repository:
Createrepo [Options] <directory>
?-u--baseurl: Indicates optional, indicates BaseURL
?-o--outputdir: Indicates where the output data goes
?-X--excludes: Indicates which packages have been removed
?-I--pkglist: Indicates which packages are created for
?-G--groupfile: Indicates which package groups are
?--Basedir: Can get Repodata basedir, default is the current working directory
Linux Package Management--compile and install
TESTAPP-VERSION-RELEASE.SRC.RPM (Source-coded RPM package file)-after installation, use the Rpmbuild command to make the RPM package in binary format before installing:
? source code---preprocessing----compile (GCC)------Execute
Source Code organization format: (if the developer of the program is good at understanding the sequence of compiling the installer, but for the general user is not able to directly understand the specific steps of compiling the program)
? Multiple files: Between the code in the file, there is likely to be a cross-file dependency
? C,c++: There is a very well-known project management tool make, whose configuration file is makefile,makefile.in file is the build template, configure is the file Generation tool (configure-->makefile.in--> Makefile
? java:maven
Compiling the Installation trilogy:
"1"./configure
?? (1) Pass parameters through the option, specify the Enable feature, installation path, etc., refer to the user's designation when executing, and makefile.in file generation makefile
?? (2) Check the external environment on which each enabled feature is dependent
"2" Make
?? Build your application According to the makefile file
"3" Make install
?? Copy the compiled file to the corresponding directory file
Development tools:
? autoconf: Used to generate configure files
? Automake: Used to generate makefile.in files
Recommend: Check the install document before installing, if not find the Readme file

get path to source code for open source program:
Official self-built site:
?? Apache.org (ASF)
?? mariadb.org
Code Hosting site:
?? SourceForge
?? Github.com
?? Code.google.com
tool C/C++:GCC (GNU C complier)
compiling C program code:
? premise: Provide development tools and development environment
?? Development tools: MAKE,GCC, etc.
?? Development environment: Development Library, header file
?? GLIBC: Standard Library
?? To provide development components through "package groups"
??? CentOS 6: "Development Tools", "Server Platform development"
? First Step: Configure script
?? Options: Specify the installation location, specify the enabled features
?? --help: Get options for their file use
?? Option Categories:
??? Installation path settings:
???? --prefix=/path/to/somewhere: Specify the default installation location: Default is/usr/local/
???? --sysconfdir=/path/to/somewhere: Configuration File Installation Location
??? System types: Systems Type
??? Optional Features: Optional Features
???? --disable-feature: Enabled by default, we do not want to enable, you can use the Disable option
???? --ENABLE-FEATURE[=ARG]: The default is not enabled, we turn it on, then use the Enable option
??? Optioal Packages: Optional Package
???? --with-package[=arg] (dependent on a package)
???? --without-package (not dependent on a package)
? Step two: Make
? Step three: Make install
post-installation configuration:
(1) Export the binary program directory to the PATH environment variable, modify the PATH environment variable to be able to identify the binary file path of this program
?? Edit File/etc/profile.d/name.sh:
??? Export Path=/path/to/bin: $PATH
(2) Export the library file path:
?? Edit/etc/ld.so.conf.d/name.conf:
??? Add a new library file in the same directory as this file, by default the system searches the path of the file/lib,/usr/lib;
??? To add additional search paths, create a file in/etc/ld.so.conf.d/with a. conf suffix, and then write the path you want to add directly to this file
?? To have the system regenerate the cache:
??? Ldconfig [-v]
(3) Export the header file, output to the system:
?? Default:/usr/include/
?? Connection-based implementations:
??? LN-SV: Creating a soft connection and displaying the creation process
??? eg. #ln-S/usr/local/tengine/include//usr/include/tengine
(4) Export help manual:
?? Edit the/etc/man.config file and add a Manpath:
??? #vim/etc/man.config
??? Manpath/usr/local/apache2/man
Example:
#yum Install Createrepo
Explanation: You can create repodata files that are required by the system
#yum repolist
Explanation: A new Yum source is automatically acquired
#yum Install Xen
Explanation: Installing the Xen Package
#gcc--version
Explanation: Querying the version of the native GCC
create an instance of the Yum repository:
#!mkdir-p/yum/repo
Explanation: "!" Indicates that a directory is created locally/yum/repo
#lcd/yum/repo
Explanation: Go to the local yum directory
#mget *.rpm
Explanation: Get all files ending in RPM from the network's Yum repository
#createrepo./
Explanation: Creating the Repodata of the current directory
#vim Centos-local.repo
[Xen4centos]
Name=xen 4 CentOS 6
baseurl=file:///yum/repo/
Gpgcheck=0
To install the httpd service using Yum:
#yum Groupinstall "Server Platform development"-Y
Explanation: Install package Group "erver Platform Development" and automatically answer Yes when installing
#cd httpd-2.2.29
Explanation: Go to the httpd directory
#./configure--prefix=/usr/local/apache2--SYSCONFDIR=/ETC/HTTPD2
Explanation: The installation path of the program is/usr/local/apache2, and the installation path of the configuration file is/etc/httpd2
#make
Explanation: Performing a compile operation
#make Install
Explanation: Performing an install copy installation operation
#cd/usr/local/apache2/
Explanation: Go to the Apache2 directory
#ls bin
Explanation: Displaying the information in the bin directory
#bin/apachectl Start
Explanation: Starting the Apache server
#netstat-tan
Explanation: See which listening ports are open in the system, where-T is a TCP connection,-n is displayed numerically,-a (all) shows all options
#apachectl stop
Explanation: Stopping the Apache server

"My Linux, I am the boss!" "RPM Package Manager/yum Front end Tools/compilation installation from Getting started to mastering

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.