Solve the problem that CentOS cannot be updated after replacing AliCloud yum source

Source: Internet
Author: User
Tags centos ssh server aliyun alicloud
Today, when I helped a friend mount a data disk to an Alibaba Cloud ECS server and install the LNMP environment, screen is not installed by default, so I started to install yum directly and found that there is no data source, therefore, no source is found when you prepare all update updates. This problem also exists, so the old Left is ready to re-update the yum source.

 

1. Back up original image files

 

The code is as follows: Copy code

Mv/etc/yum. repos. d/CentOS-Base.repo/etc/yum. repos. d/CentOS-Base.repo.backup

 

Here, we will back up the original image first, otherwise we can recover it if we make a mistake.

 

2. Update the source directory for download

 

A-CentOS 5

 

The code is as follows: Copy code

Wget-O/etc/yum. repos. d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

 

B-CentOS 6

 

The code is as follows: Copy code

Wget-O/etc/yum. repos. d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

 

Log on to the SSH server and download the Alibaba Cloud image source.

 

Third, update generation

 

The code is as follows: Copy code

Yum clean all
Yum makecache

 

Execute the command and install it.

 

 

Then, when we run the yum update-y command, there is no problem. I have shared this before updating the yum source for debian mitigation.
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.