Linux 16th Day Package Management

Source: Internet
Author: User
Tags yum repolist

Linux 16th Day Self-study package management

Time: 20180802


Directory

Linux Package Management

RPM Package Management tool uses

Yum Online Package management tool

Source Code Compilation Installer



Linux Package Management

Most of the software on Linux is open source, so their source code is open, freely accessible and installed to their own

Linux system, but for most users, it is not easy to configure the source installation package, and also need to install the compilation

Environment, so the vendor of the release will use these open source software in their own company to set their own open-source packages on each hardware platform

Compile it to form a binary file and pack it up at this point the user simply needs to get to this installation package and perform the installation with one click.


At this point, a new problem has been created, although the installation has been resolved, but if the user wants to uninstall the software is a problem,

Linux installation software can form many files, and its configuration files and installation directory may not be in the same folder, at this time

If the user does not understand this software uninstall this software also can be very troublesome. If you have a software like windows,

That is, the program software installs the management component, so the user uninstalls or installs the software to be convenient many, this is the Linux produces the RPM,

Dpkg, for reasons such as package management components, the package management software actually has one data each time the program is installed or uninstalled

The library is used to record the location of the package installation and the generated files, etc., in case the user later uninstall and delete.


Package management is now convenient, but Linux has a problem, Linux software and Windows software installation has a very large

The difference is to resolve the dependency relationship. Linux Software Installation may require additional packages to be installed before installing this program.

RPM or dpkg can resolve setup problems, or you can prompt for installation that relies on other packages, but not the primary

To install the dependent packages. Because it is common to install locally downloaded packages If this program relies on other programs

Package, the user also needs to go online to download, the operation is more cumbersome. As a result, online software installers such as Yum, APT, etc.

Management tools. Such tools can provide the packages specified by the online installation and actively download and install the dependent packages.

RPM Package Management tool uses

Installation

RPM {-i|--install} [install-options] package_file ...

-H to # to represent the installation process

-V verbose display the installation process

-vv

-vvv

--test does not perform a real installation process, only reports dependencies and conflicting information, etc.

--nodeps ignore dependencies, side effects can be successfully installed, may not run successfully

--replacepkgs overwrite the installation, reinstall and overwrite the original file

--force Mandatory Installation


Common combination-IVH-IVVH during installation


Upgrade

RPM {-u|--upgrade} [install-options] package_file ...

-U upgrade or install

RPM {-f|--freshen} [install-options] package_file ...

-F upgrade, that is, the current program has already been installed on this machine, and is still an old version


Combined use of-UVH,-FVH

-H to # to represent the installation process

-V verbose display the installation process

-vv

-vvv

--test does not perform a real installation process, only reports dependencies and conflicting information, etc.

--nodeps ignore dependencies, side effects can be successfully installed, may not run successfully

--oldpackage downgrade to old version


Note: Be sure not to upgrade the kernel, Linux allows multi-core coexistence, so you can directly install multiple

Different versions of the kernel

If the package profile has been modified since it was installed, upgrading a newer version of the file will not overwrite the old version of the

Configuration, and rename the new version of the file, such as add suffix. rpmnew after saving


Unloading

RPM {-e|--erase} [--allmatches] [--nodeps] [--test] package_name ...

Simple usage rpm-e pkg_name

--nodeps ignores dependencies, this program may be dependent on other programs, and unloading may cause

Other programs are not working properly

--test Test Uninstall

--allmatches A package installs multiple versions at the same time, this option unloads all at once


Note: If the package profile has been modified since it was installed, this file is not usually deleted when uninstalled, but

Be named plus suffix. Rpmsave after the retention.


Inquire

Query whether a package has been installed, check all installed packages, and package details, or query for a command by which

Package generation, etc.

RPM {-q|--query} [select-options] [query-options]

[Select-options]

-qa to query all installed packages

-Q Query Package is installed

-QF query file is generated by which package is installed

-qpi query For information about packages that have not been installed

[Query-options]

-qi Query A package description information

-QL list of files generated by the installation package

-QC list the configuration files generated by the installation package

-QD lists the generated Help files for the installation package,

-Q--changelog View changelog information that changes with the version when the package is made

-Q--provides Lists the capabilities that are provided by the package

-Q--requires Lists the capabilities that the package depends on

-Q--scripts The script executed when the package is loaded and unloaded

There are four types of scripts

Preinstall scripts executed prior to installation

Postinstall scripts to execute after installation

Preuninstall scripts executed prior to uninstallation

Postuninstall scripts executed after uninstallation


Check

Whether the files generated after the query package installation have changed

RPM {-v|--verify} [select-options] [verify-options]

Common usage rpm-v pkg_name


When there is no output, the package complete OK, when there is a corresponding result output indicates that the corresponding content has been modified

Specific as follows:

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



Yum Online Package management tool

Yum [options] [command] [package ...]


Yum Warehouse Management

Yum repolist lists all available warehouses that have been configured

Yum Repolist [all|enable|disabled]


Yum Cache Management

Yum Clean Cleanup Cache

Yum Clean [Packages|metadata|expire-cache|rpmdb|plugins|all]

The Yum Makecache cache is created, automatically connected to every available warehouse, downloads its metadata, and creates

Built as a cache


Package View

Yum list [all|glob_exp1|glob_exp2][...]

Yum list {available|updates|installed|extras|obsoletes} [GLOB_EXP1].

Yum grouplist [Hidden] [Groupwildcard] [...]


Package Installation

Yum Install Package1 pkg2 ...

Note: you only need to provide the package name

If a package has several different versions in a different warehouse, the latest version is installed by default

If you are installing the specified version of install Pkag-version


Reinstall (Overwrite installation)

Yum Reinstall Package1 Pkg ...


Package upgrade

Yum Update [Package1] pkgs ...


Package demotion

Yum downgrade Pkag1 ...


Check which upgrades are available

Yum Check-update


Package uninstallation

Yum remov|erase package1 ...

Note: All packages that depend on the package being uninstalled will be uninstalled together


Inquire

Package Brief Info Yum Info pkge ...

Search Package Yum Search Pkge ...

Query which package the specified file is installed on build: Provides|whatprovides/path/file


Install or upgrade a local package file

Yum Localinstall rpmfile1 ...

Yum localupdate rpmfile1 ...

This type of installation solves the local RPM dependency of the package that does not need to be manually installed


Package Group Management

List all package groups Yum Grouplist

Install package group Yum Groupinstall group1 ...

Uninstall Yum groupremove group1 ...

Upgrade Yum groupupdate group1 ...

View packages in Group Yum Group Info grou1 ...

You can also use install, remove, or update to manage package groups by adding the @ symbol before the group name.

Like yum install @ "Server Platform Development"


Available options for the Yum command

-Y Auto Answer Yes

--disablerepo= temporarily disables a repository that is configured and enabled in the configuration file

--enablerepo temporarily enables a specified repository

--nogpgcheck Prohibit Package verification


Some of the built-in variables for Yum

$releaseever the major version number of the current OS release

such as the CentOS 6.6 x86_64 major version number is 6

$arch Platform i386 i486

$basearch Base Platform


Create a local Yum source repository

Need to use the CREATEREPO program no longer detailed here



Source Code Compilation Installer

Source-compiled installation relies on environmental support, which is the development component that compiles the development tools and the individual packages that are dependent on them

It also needs to be compiled and installed by custom compilation parameters.


1. Install the compilation development tool (package Group)

Development tools

Server Platform Development

Desktop Platform Development

Debug Tools

2. Development components of a dependent package

1) Compile and install dependent programs

2) The name of the installation related program contains the Devel child package


In the source code program will be stored separately in multiple folders, there may be dependencies between files, so the compilation

May need to be compiled in a specific order, the Project management tool (also known as GNU make) is typically used

) to manage it: the build tool invokes the appropriate compiler, and according to the makefile defined in the configuration file

Sequence to compile the source code files. It is important to note that:

1) After the developer of each project has completed a certain version, it will use autoconf to generate one for the program code

Script file Configure, which functions: This script collects the dependencies on the current system in the development environment

Each component's version, characteristics, etc., and check whether the dependent environment is satisfied, and finally according to the makefile

The. In file generates a makefile file

2) After the developer of each project has completed a certain version, it will use Automake to generate one for the program code

A makefile template file, or makefile.in


The compiler installation process for compilers is as follows

1) Run the Configure script

Options for Configure scripts

--help Viewing Help information

--prefix specifying the default installation path

--sysconfdir specifying the configuration file installation path

--with-capability-dependent Packages

--without-capability

--enable-feature enabling an attribute

--disable-feature Disabling an attribute

2) Run make to complete the project build

3) Run make install to complete the installation


3. The environment in which the program runs

Configure environment variables so that they do not need to enter a long path to execute the program

Export Path=extra_path: $PATH saved in/etc/profile.d/*.sh


The configuration library file allows the system to find the library file for this program

1) can edit/etc/ld.so.conf.d/*.conf file, add new library file search path to

In this file, each line is a

2) Execute the ldconfig command to regenerate the library map cache ld.so.conf

The Ldconfig command is used to generate/etc/ld.so.cache

-P Prints All library file directories that are already cached in the current program Ld.so.cache and

Library file mapping list

-V displays detailed information about the command execution process


Configure header File information methods

1) Copy all newly generated header files to the/usr/include directory

2) Create a soft link (take Apache as an example)

Ln-sv/usr/local/apache/include/usr/include/httpd

ln-sv/usr/local/apache/include/*/usr/include/


Configure the man manual file so that man can read its configuration file

Modify the man's configuration file/etc/man.config/etc/man_db.conf

Use the MANPATH manpath_map directive to point to a path to identify new help information


Attention

If the installed program is a service class program, the service script file compilation installation will not have

Try to install the compilation package to a dedicated path, remove this directory when uninstalling

Other programming language development of the source package, the compilation and installation methods may be different

You can see the installation information in the package, such as install, Readme and other files

To get installation help information such as Perl Python Ruby Java


Linux 16th Day Package Management

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.