After chopping hands, the fraud call came before the express delivery was received. How to improve the privacy and security of e-commerce>>>
this article is reproduced in https://blog.csdn.net/trokey/article/details/84908838
After installing celos7, the built-in Yum can’t be used directly. The following problems will occur when using it:
The reason is that no Yum source is configured. Modify the file/etc/yum.repos.d/cenos-base.repo as follows:
# 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
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
The edit command is as follows:
vi /etc/yum.repos.d/CentOS-Base.repo
Save command
Press ESC to jump to command mode, and then:
: W save the file without quitting VI
: W file save the modification to the file and do not exit VI
:w! Force save, do not push VI
: WQ save the file and exit VI
:wq! Force save file and exit VI
Q: quit VI without saving the file
:q! Do not save the file, forced to exit VI
:e! Discard all changes and edit from the last time you saved the file
Or delete the original file first
rm -f /etc/yum.repos.d/CentOS-Base.repo
Then download Alibaba’s
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
Clean up cache
yum clean all
PS: if the above method is not solved, try the following:
Delete all files in the yum. Repos. D directory
rm -f /etc/yum.repos.d/*
Then download Alibaba’s
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
Clean up cache
yum clean all
Test download install
yum install gcc
The following results are: