适用于刚刚安装的系统,这个时候原本的yum是没法用的,所以现在要做的是先清空!
cd /etc/rpm/
rm -rf ./m*
下载yum 源
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-50.el7.noarch.rpm
如果要安装肯定是要一个一个去安装这些yum,那么如何批量安装当前目录下的?
rpm -ivh yum* --force --nodeps #-force --nodeps参数为忽略依赖检测的强制安装
检查下是否已经安装了
rpm -qa | grep yum
下载yum源文件,因为centos 和redhat7基本是一样的,所以下载的一致就行
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
我们可以先看下当前的yum文件修改CentOS-Base.repo文件
cd /etc/yum.repos.d/
ls
vim CentOS-Base.repo
执行:%s/$releasever/7/g快速替换
重载yum源
yum clean all
yum update