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

How to use public network yum source in centos6.8

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

Share

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

What this article shares with you is about how to use the extranet yum source in centos6.8. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

1. Set / etc/profile

Add two lines at the end:

IP of the http_proxy= agent: Port

Export http_proxy

And then save.

Source / etc/profile

2. Configuration / etc/yum.conf file

Add a sentence to it

IP of the proxy= agent: Port

And then save.

3. Download the yum source repo file of the public network

For example: download the corresponding version of the domestic NetEase repo file

Wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

Copy the file to the / etc/yum.repos.d directory

Check the repo file and modify the following two points

Enabled=1 # change the original 0 to 1

Gpgcheck=0 # change the original 1 to 0

4. Run the following command to generate cache

Yum clean all

Yum makecache

5. Then you can use it.

Of course, you can also modify the repo file directly.

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

[base]

Name=CentOS-$releasever-Base

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

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

Gpgcheck=1

Gpgkey= http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

# released updates

[updates]

Name=CentOS-$releasever-Updates

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

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

Gpgcheck=1

Gpgkey= http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

# additional packages that may be useful

[extras]

Name=CentOS-$releasever-Extras

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

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

Gpgcheck=1

Gpgkey= http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

# additional packages that extend functionality of existing packages

[centosplus]

Name=CentOS-$releasever-Plus

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

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

Gpgcheck=1

Enabled=0

Gpgkey= http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

# contrib-packages by Centos Users

[contrib]

Name=CentOS-$releasever-Contrib

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

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

Gpgcheck=1

Enabled=0

Gpgkey= http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6

[root@bastion-IDC ~] # yum clean all

[root@bastion-IDC ~] # yum makecache / / caches the software package information on the server locally to improve the speed of searching for installed software

[root@bastion-IDC ~] # yum update / / Update the system

According to the above operation, the yum source will be replaced by NetEase's, and can be used normally.

It is important to note that if you want CentOS to use yum update updates without upgrading the kernel, you can do this as follows:

[root@bastion-IDC ~] # cp / etc/yum.conf / etc/yum.confbak

Method 1) modify the configuration file of yum

[root@bastion-IDC ~] # vim / etc/yum.conf

Add exclude=kernel* at the end of [main]

Method 2) add the following parameters directly after the yum command:

[root@bastion-IDC] # yum-- exclude=kernel* update

If you want to replace it with Aliyun's yum source, simply replace the / etc/yum.repos.d/CentOS-Base.repo content with the following content, and then yum clean all, yum makecache, yum update

[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-6

# 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-6

# 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-6

# 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-6

# 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-6

[root@bastion-IDC ~] # yum clean all

[root@bastion-IDC ~] # yum makecache

If the following error occurs:

Https://mirrors.aliyun.com/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22-"The requested URL returned error: 404 Not Found"

Cause analysis:

The variable $releasever is not recognized in the CentOS-Base.repo file. You can check the correct address on aliyun's mirror official website:

That is, the correct address is https://mirrors.aliyun.com/centos/6.9/os/x86_64/repodata/repomd.xml

Solution: change $releasever to 6.9

[root@bastion-IDC ~] # sed-I's Universe release CentOS-Base.repo 6.9 Universe

The above is how to use the extranet yum source in centos6.8. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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