Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of yum commands for package Management

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

What is 1.yum?

Yum (Yellow dog Updater, Modified) is a Shell front-end package manager in Fedora and RedHat as well as in SUSE. Based on RPM package management, RPM packages can be downloaded and installed automatically from designated servers, dependencies can be automatically handled, and all dependent software packages can be installed at once without having to download and install them again and again. Yum provides commands to find, install, and delete one, a group, or even all of the software packages.

Configuration file for 2.yum client

Configuration file:

/ etc/yum.conf provides common configurations for all warehouses or configurations that do not belong to the warehouse

/ etc/yum.repos.d/*.repo provides configuration for the direction of the warehouse

/ etc/yum.repos.d/*.repo: define the repository

[repositoryID]

Name=Some name for this repository

Baseurl=url://server1/path/to/repository/

Enabled= [0 | 1] Warehouse is open or closed

Gpgcheck = {1 | 0} check source validity

Gpgkey=URL specifies the key file

Enablegroups = {0 | 1} use groups to manage packages in bulk

Failovermethod = {roundrobin (polling) | specified (priority)}

The failover method defaults to roundrobin and is randomly selected.

Cost (cost) = # default is 1000

The variables available in the repo configuration file of yum:

$releasever: the major version number of the current OS release

$arch: platform type

$basearch: basic platform

$YUM0-$YUM9: user-defined variable

Take http://mirrors.aliyun.com/ as an example:

~] # cd / etc/yum.repos.d/~] # vim aliyun.repo [base] name=aliyunbaseurl= http://mirrors.aliyun.com/centos/6.7/os/x86_64/gpgcheck=1

We can also set the baseurl as a variable:

Baseurl= http://mirrors.aliyun.com/centos/$releasever/os/$basearch/

3. How to use CD as a local yum repository

Take the ISO image of CentOS 6.7as an example:

(1) Mount the CD

~] # mount-r / dev/cdrom / media/cdrom

(2) create a configuration file

~] # cd / media/cdrom/~] # ls-- > check whether there is a "repodata" directory by default. If there is no ~] # createrepo-- > create a "repodata" directory, then you do not need to create ~] # vim / etc/yum.repos.d/local.repo [base] name=localbaseurl= file:///media/cdrom/gpgcheck=1~]# yum repolist-- > after the configuration is completed, you can use this command to check whether the configuration is successful.

Note: create yum warehouse createrepo [options]

4.yum common commands

Command line options for yum:

-- nogpgcheck: binary gpgcheck

-y: automatic answer is "yes"

-Q: silent mode

-- disabledrepo=repoidglob: temporarily disable the repo specified here

-- enabledrepo=repoidglob: temporarily enable the specified repo here

-- noplugins: disable all plug-ins

Common commands:

Display a list of warehouses:

Repolist [all | enabled | disabled]

Display the package:

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

Yum list {available | installed | updates} [glob_exp1] [...]

Install the package:

Install package1 [package2] [...]

Reinstall package1 [package2] [...] Reinstall

Upgrade package:

Update package1 [package2] [...]

Downgrade package1 [package2] [...] Downgrade

Check for available upgrades:

Check-update

Uninstall the package:

Remove | erase package1 [package2] [...]

View brief information about the package:

Info []

See which package the specified feature is provided by:

Provides | whatprovides feature1 [feature2] [...]

Clean up the local cache:

Clean [packages | metadata | expire-cache | rpmdb | plugins | all]

Build the cache:

Makecache

Search for:

Search string1 [string2] [...]

Search for package name and summary information with specified keywords

View the capabilities on which the specified package depends:

Deplist [package1] [package2] [...]

View the history of yum things:

History [info | list | packages-list | packages-info | summary | addon-info | redo | undo | rollback | new | sync | stats]

Common commands for package group management:

* groupinstall group1 [group2] [...]

* groupupdate group1 [group2] [...]

* grouplist [hidden] [groupwildcard] [...]

* groupremove group1 [group2] [...]

* groupinfo group1 [...]

5. Package compilation and installation

General format of source code package:

Testapp-VERSION-release.src.rpm

After installation, use the rpmbuil command to make the rpm package in binary format, and then install the

Source code-- > preprocessing-- > compilation (gcc)-- > assembly-- > link-- > execution

There are three steps to compile and install:

. / configure

1. Pass parameters through the option, specify the enabled feature, installation path, etc., and generate makefile with reference to the user's assignment and the Makefile.in file.

two。 Check the dependent external environment

Make

Build the application according to the makefile file and call the compiler to complete the compilation

Make install

Compile the C source code:

Premise: provide development tools and development environment

Development tools: make,gcc, etc.

Development environment: development libraries, header files

Glibc: standard library

Provide development components through the package group:

CentOS 6: "Development Tools", "Server Platform Development"

CentOS 7: "Development tools"

Step 1: configure script

Options: specify installation location, specify enabled features

-- help: get its supported usage options

Installation path setting:

-- prefix=/PATH/TO/SOMEWHERE: specify the default installation location, default bit is / usr/local

-- sysconfdir=/PATH/TO/SOMEWHERE: configuration file installation path

System types (system type): cross-compilation can be used

Optional Features: optional featur

-- disable-FEATURE disables a feature

-- enable-FEATURE [= ARG] enables a feature

Optional Packages: optional package

-- with-PACKAGE [= ARG] defines dependent packages

-- packages that without-PACKAGE does not need to rely on

Step 2: make

Step 3: make install

Configuration after installation:

(1) Export the binary program directory to the PATH environment variable

Edit file / etc/profile.d/NAME.sh

Export PATH=/PATH/TO/BIN:$PATH

(2) Export the path of the library file

Edit / etc/ld.so.conf.d/NAME.conf

Add the directory where the new library file is located to this file

/ usr/local/apache2/lib

Let the system regenerate the cache

Ldconfig [- v]

(3) Export the header file to / usr/include

A link-based approach to:

Ln-sv

Export directory as a symbolic link

(4) Export help manual

Edit / etc/man_db.conf file

Add a MANPATH

Here is an example of compiling and installing apache 2.2 on CentOS 6.7:

~] # cd httpd-2.2.29-- > here first change to the httpd directory ~] # / configure-- prefix=/usr/local/-- sysconfdir=/etc/httpd2.2 ~] # make ~] # make install~] # cd / usr/local~] #. / httpd--> start the http service

6. The way to obtain open source programs

Official self-built site:

Apache.org (ASF Project)

Mariadb.org

...

Code hosting:

SourceForge

Github.com

Code.google.com

...

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report