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

CentOS 7 yum Feed

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Share several yum sources of CentOS7

Every technician will experience all kinds of rookie moments and embarrassing situations. Here's what I've learned:

The situation is as follows, I accidentally installed the minimized CentOS 7, (that is, there is no upload and download tool for CRT, no Wget), and it was remote management. I suddenly wanted to install some software remotely, all kinds of crazy, wanted to update the yum source, but there was no good way to download the yum source of Ali and NetEase. After opening it, I would face a more embarrassing problem. There was no branch and there was no way to copy and paste with CRP. So this article will give you a yum that can be entered with CRT.

First of all, let's be clear: CentOS 7 adds a new module (loaded plug-in: fastestmirror) that automatically recognizes the nearest yum source, but not as fast as the written yum source.

The steps are as follows:

1: back up your own yum source

Cp / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.BK

2: clear / etc/yum.repos.d/CentOS-Base.repo and wait for a new yum source input.

Echo "" > / etc/yum.repos.d/CentOS-Base.repo

(of course, this is just a personal habit. I can also delete it and rebuild it, or delete the command with the vi editor.

Append a space to the file and overwrite the previous file)

3: open the file / etc/yum.repos.d/CentOS-Base.repo with the vi editor

Vi / etc/yum.repos.d/CentOS-Base.repo

4: paste the following documents in (Ali yum)

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client. You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the

# remarked out baseurl= line instead.

#

#

[base]

Name=CentOS-$releasever-Base-mirrors.aliyun.com

Failovermethod=priority

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

Http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/

# mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

Gpgcheck=1

Gpgkey= http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

# released updates

[updates]

Name=CentOS-$releasever-Updates-mirrors.aliyun.com

Failovermethod=priority

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

Http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/

# mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

Gpgcheck=1

Gpgkey= http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

# additional packages that may be useful

[extras]

Name=CentOS-$releasever-Extras-mirrors.aliyun.com

Failovermethod=priority

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

Http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/

# mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

Gpgcheck=1

Gpgkey= http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

# additional packages that extend functionality of existing packages

[centosplus]

Name=CentOS-$releasever-Plus-mirrors.aliyun.com

Failovermethod=priority

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

Http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/

# mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

Gpgcheck=1

Enabled=0

Gpgkey= http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

# contrib-packages by Centos Users

[contrib]

Name=CentOS-$releasever-Contrib-mirrors.aliyun.com

Failovermethod=priority

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

Http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/

# mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

Gpgcheck=1

Enabled=0

Gpgkey= http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

5. After ": wq" exits, using yum makecache to generate cache may fail, because it is possible that when configuring the network, the DNS is 8.8.8.8 of Google. The address is not perfect for the resolution of individual domestic websites, so it will indicate that the host cannot be found.

You can edit / etc/resolv.conf to add a "nameserver 114.114.114.114", do not ask why this DNS, because it is easy to remember.

6.yum makecache, then remember yum install wget, and then if you want to change other sources, you can use wget directly. No more examples.

BUG: in CentOS 7, modifying / etc/resolv.conf cannot permanently modify the DNS, but it can be written in the network card. However, the modification of the configuration file of the network card requires a restart of the network card to take effect, and writing it in / etc/resolv.conf will take effect immediately. In the study, please see the following blog post for details.

Remarks: if you have any questions, please leave a message, if you need to reprint, please indicate the source.

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