安装yum
如果yum已经存在则跳过此步骤
- 下载
wget http://yum.baseurl.org/download/3.2/yum-3.2.28.tar.gz - 解压
tar xvf yum-3.2.28.tar.gz(这样解压后的文件会在root中) - 运行安装
首先在etc中创建yum而配置文件一yum.conf
touch /etc/yum.conf
进入yum的解压目录我的就在root里面(如果不知道文件被解压到哪里了用find -name去找)
cd /root/yum-3.2.28
运行下面的语句
./yummain.py install yum
更新镜像源
-
先安装wget
执行命令 yum install -y wget -
查询国内镜像源
打开阿里镜像http://mirrors.aliyun.com/
http://mirrors.aliyun.com/centos/7.7.1908/isos/x86_64/ -
下载CentOS 7的repo文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo -
更新镜像源
#清除缓存
yum clean all
#生成缓存
yum makecache