Centos Yum Configuration

Source: Internet
Author: User
Tags gpg

These days I install a centos but I can't input in Chinese. This make me upset. Then I know It's the problem of yum. Then I changed the yum source.

Step 2

wget http://mirrors.ustc.edu.cn/centos/CentOS-Base.5.mirrors.repo -O /etc/yum.repos.d/CentOS-Base.repo


Back up the yum configuration file and modify the yum configuration file.

CP/etc/yum. Repos. d/CentOS-Base.repo CentOS-Base.repo_bak
VI/etc/yum. Repo. d/CentOS-Base.repo
You can use the USTC Yum source or the SJTU Yum source. You can select either of them.
Cover the CentOS-Base.repo with the following content.

# USTC Yum source, the latest in http://centos.ustc.edu.cn/centos/5,
# Can also be set to http://centos.ustc.edu.cn/centos/5.5/

[Base]
CentOS-5-Base
Baseurl = http://centos.ustc.edu.cn/centos/5/ OS /?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# Released updates
[Update]
CentOS-5-Updates
Baseurl = http://centos.ustc.edu.cn/centos/5/updates/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# Packages used/produced in the build but not released
[Addons]
CentOS-5-Addons
Baseurl = http://centos.ustc.edu.cn/centos/5/addons/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# Additional packages that may be useful
[Extras]
Name = CentOS-5-extras
Baseurl = http://centos.ustc.edu.cn/centos/5/extras/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# Additional packages that extend functionality of existing packages
[Centosplus]
CentOS-5-plus
Baseurl = http://centos.ustc.edu.cn/centos/5/centosplus/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# Contrib-packages by centos users
[Contrib]
Name = CentOS-5-contrib
Baseurl = http://centos.ustc.edu.cn/centos/5/contrib/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

# End Part 1

#================== Split line ============== Note: select only one of the upper and lower parts

# SJTU Yum source, the latest in http://ftp.sjtu.edu.cn/centos/5,
# Can also be set to http://ftp.sjtu.edu.cn/centos/5.5/

[Base]
CentOS-5-Base
Baseurl = http://ftp.sjtu.edu.cn/centos/5/ OS /?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

# Released updates
[Update]
CentOS-5-Updates
Baseurl = http://ftp.sjtu.edu.cn/centos/5/updates/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

# Packages used/produced in the build but not released
[Addons]
CentOS-5-Addons
Baseurl = http://ftp.sjtu.edu.cn/centos/5/addons/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

# Additional packages that may be useful
[Extras]
Name = CentOS-5-extras
Baseurl = http://ftp.sjtu.edu.cn/centos/5/extras/?basearch/
Gpgcheck = 1
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

# Additional packages that extend functionality of existing packages
[Centosplus]
CentOS-5-plus
Baseurl = http://ftp.sjtu.edu.cn/centos/5/centosplus/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

# Contrib-packages by centos users
[Contrib]
Name = CentOS-5-contrib
Baseurl = http://ftp.sjtu.edu.cn/centos/5/contrib/?basearch/
Gpgcheck = 1
Enabled = 0
Gpgkey = http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

# Part 2 ends

Step 2

USTC Yum Source
32-bit: rpm -- import http://centos.ustc.edu.cn/centos/5/ OS /i386/RPM-GPG-KEY-CentOS-5
64-bit: rpm -- import http://centos.ustc.edu.cn/centos/5/ OS /x86_64/RPM-GPG-KEY-CentOS-5

Shanghai Jiao Tong University (SJTU) Yum Source
32-bit: rpm -- import http://ftp.sjtu.edu.cn/centos/5/ OS /i386/RPM-GPG-KEY-CentOS-5
64-bit: rpm -- import http://ftp.sjtu.edu.cn/centos/5/ OS /x86_64/RPM-GPG-KEY-CentOS-5

Step 2

Yum update

After that if you have a proble like that. Do like this:

The following error always occurs during each Yum install operation:

View sourceprint?
http://mirrors.ustc.edu.cn/centos/6.0/extras/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - ""
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: extras. Please verify its path and try again

At this time, I was so smart that I immediately thought that the server could not parse the domain name, And the repomd. xml could not be downloaded?

Then I pinged mirrors.ustc.edu.cn, and an error occurred: Ping: Unknown host mirrors.ustc.edu.cn. Apparently, the DNS configuration is incorrect.

Add a line to/etc/hosts.

View sourceprint?
mirrors.ustc.edu.cn  202.38.95.110

In this way, you can parse mirrors.ustc.edu.cn. Yum successful!

Note: But this is not the final solution to this problem. You need to configure the correct DNS. Open the/etc/resolv. conf file and add a nameserver IP. Replace the IP address with the DNS address provided by the IDC operator.

Related Article

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.