前提:选择的最小化安装,可能会缺少这些命令
具体操作:
yum search wget curl ##查找软件包
yum install wget.x86_64 ##安装wget
yum install curl.x86_64 ##安装curl
镜像源一般使用腾讯云、阿里云和网易163较多,具体可参考各大开源镜像网站
1、 备份(可以省略,不行从快照恢复)
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、 下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/,在shell窗口执行以下三条命令任意一条即可
腾讯云:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
阿里云:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
3、配置epel源
腾讯云:
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo
阿里云:
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
4、修改为公用域名解析(腾讯云该步可以忽略)
非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。用户也可自行修改相关配置
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-
5、运行yum clean all清理缓存
6、运行 yum makecache 生成缓存
7、运行yum update更新软件包
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。