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

Introduction of commands related to yum Source configuration and yum tools under Linux

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces "yum source configuration and yum tool-related commands under Linux". In daily operation, I believe many people have doubts about yum source configuration and yum tool-related commands under Linux. Xiaobian consulted all kinds of information and sorted out simple and easy to use operation methods. I hope to answer the doubts of "yum source configuration and yum tool-related commands under Linux"! Next, please follow the small series to learn together!

How much does Yum know?

1. Yum is how to install software

The yum repository (also known as yum source) is used to store packages for various rpm and dependencies between packages (repodata directory).

The computer on which the software is installed connects to the specified yum repository to install the package.

2. yum source action

Package manager, similar to Windows software manager.

3. Yum source advantage

Resolve dependencies between software packages and improve the efficiency of O & M personnel.

4. yum source classification

① Local yum source

The so-called local yum source means that the yum repository is local, usually a local system CD or mirror file.

② Network yum source

The so-called network yum source means that the yum repository is remote (not local) and requires networking to install.

Domestic well-known network sources (aliyun source, 163 source, sohu source, well-known university open source mirror, etc.)

Foreign well-known network sources (centos source, redhat source, red hat extended epel source, etc.)

Specific software-related network sources (Nginx, MySQL, Zabbix, etc.)

II. Yum source configuration

Note: The following operating system is Centos 6.5 as an example, and other Linux systems are similar.

1. Local yum source configuration

① Mount image to local operating system

Manually mount the disc to the specified directory

[root@Heima ~]# mount -o ro /dev/sr0 /mnt

Boot auto mount

[root@Heima ~]# echo "mount -o ro /dev/sr0 /mnt" >> /etc/rc.local

or

[root@Heima ~]# echo "/dev/sr0 /mnt iso9660 defaults,ro 0 0" >> /etc/fstab

Description:

1. The/etc/rc.local file is the last file read by the operating system when it boots. The file needs to have executable permissions. The system will automatically mount it for you when booting. It is recommended to use this method.

2. The/etc/fstab file is fine, but if you modify it incorrectly it may cause the system to fail.

② Specify yum repository through configuration file

Go to the specified directory and clear the operating system default Centos source

[root@Heima ~]# cd /etc/yum.repos.d/

[root@Heima yum.repos.d]# rm -f ./*

Create files ending in.repo in this directory

[root@Heima yum.repos.d]# vim local.repo

[local] Name of the repository, no special symbols (custom)

name=local yum repository description, optional

baseurl=file:///mnt Specifies the path to the yum repository (important), file://indicates the local repository

enabled=1 to enable the repository, 1 to enable;0 to disable

gpgcheck=0 Do not verify the signature of the software package in the repository, 0 means do not verify;1 means verify

2. Network yum configuration

Method 1:

You can specify the yum repository directly by modifying the configuration file.

Network sources for specific software:

[root@Heima yum.repos.d]# cat nginx.repo

[nginx]

name=nginx repo

baseurl=http://nginx.org/packages/centos/6/$basearch/

gpgcheck=0

enabled=1

Web sources for basic software:

[root@Heima yum.repos.d]# cat 163.repo

[163]

name=163 network yum

baseurl=http://mirrors.163.com/centos/6/os/x86_64/

enabled=1

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6

[root@Heima yum.repos.d]# cat aliyun.repo

[aliyun]

name=aliyun

baseurl=http://mirrors.aliyun.com/centos/6/os/x86_64/

enabled=1

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6

Method 2:

By installing the package, the.repo file is automatically created (autoconfiguration).

Example of configuring epel source:

1) Download the epel source package

[root@Heima ~]# wget -P /tmp https://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm --no-check-certificate

--2019-02-20 09:42:41-- https://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm

Resolving mirrors.aliyun.com... 119.96.206.232, 116.211.153.230, 116.211.153.236, ...

Connecting to mirrors.aliyun.com|119.96.206.232|:443... connected.

WARNING: certificate common name "img.ucdl.pp.uc.cn" doesn't match requested host name "mirrors.aliyun.com".

HTTP request sent, awaiting response... 200 OK

Length: 14540 (14K) [application/x-redhat-package-manager]

Saving to: "/tmp/epel-release-6-8.noarch.rpm"

100%[================================================================================>] 14,540 --.- K/s in 0.03s

2019-02-20 09:42:41 (538 KB/s) - "/tmp/epel-release-6-8.noarch.rpm" saved [14540/14540]

2) Install the software package

[root@Heima ~]# rpm -ivh /tmp/epel-release-6-8.noarch.rpm

warning: /tmp/epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY

Preparing... ########################################### [100%]

1:epel-release ########################################### [100%]

3) Check configuration file

[root@Heima ~]# ls /etc/yum.repos.d/epel*

/etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel-testing.repo

3. Yum tool-related commands

# yum install package -y

The default is to install software from the repository and specify the software name. Multiple packets separated by spaces;-y (cancel interaction)

# yum install ./ xxx.rpm

or

# yum localinstall ./ xxx.rpm

Installs rpm packages from locally specified paths, not from repositories

# yum remove or erase package

uninstall packages

# yum update

Update all software in the repository that is more important than the software already installed on this machine

# yum update package

Specify upgraded software

# yum search mysql

Search for all software with the keyword "mysql"

# yum provides "libaudiofile.so.0"

Find out which packages provide modules

# yum clean all

Empty previous yum list cache

# yum makecache

create a new cache

# yum list

List all packages in the repository

# yum repolist

List configured software repositories

# yum list |Grep Keyword

@ means it has been installed successfully

# yum list installed

View installed packages

# yum grouplist

View package groups

# yum groupinstall "package group"

Installation package group

# yum groupremove "package group"

IV. Summary

1. yum is a tool for installing rpm packages under Linux. To install packages using it, you must configure the yum source in advance.

2. Yum sources are divided into local yum sources and network yum sources. Local yum source refers to software repository locally; network yum source refers to software repository remotely.

3. Software repositories contain both packages and repodata directories, which store dependencies between software

4. The biggest advantage of yum tool installation rpm package is to solve the dependency relationship of software package and improve work efficiency.

At this point, on the "Linux yum source configuration and yum tool-related commands" on the end of the study, I hope to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

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

Servers

Wechat

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

12
Report