yum源
Yellow dog Updater(Yum)是RedHat所有版本的默认包管理器
yum主要功能是更方便的添加/删除/更新RPM包,自动解决包的依赖性问题,便于管理大量系统的更新问题
其理念是使用一个中心仓库(repository)管理一部分甚至一个distribution的应用程序相互关系
根据计算出来的软件依赖关系进行相关的升级、安装、删除等操作,减少了Linux用户一直头痛的dependencies的问题
可以同时配置多个资源库(Repository),简洁的配置文件(/etc/yum.conf),自动解决增加或删除rpm包时遇到的依赖性问题,保持与RPM数据库的一致性。
一、更换成阿里云yum源
查询已安装的yum
[root@localhost ~]# rpm -qa | grep yum PackageKit-yum-1.1.5-1.el7.x86_64 yum-3.4.3-154.el7.noarch yum-rhn-plugin-2.0.1-9.el7.noarch yum-utils-1.1.31-42.el7.noarch yum-metadata-parser-1.1.4-10.el7.x86_64 yum-langpacks-0.4.2-7.el7.noarch
使用root权限卸载已安装的yum源
[root@localhost ~]# rpm -qa | grep yum | xargs rpm -e --nodeps warning: /etc/yum/pluginconf.d/langpacks.conf saved as /etc/yum/pluginconf.d/langpacks.conf.rpmsave
下载并安装阿里的yum源rpm包
(浏览器打开网址:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages
然后一个一个的去搜索下载到本地(因为可能会存储版本更新的问题)
最后到Linux里面去建一个rpm文件,然后把下载好的包复制进去)
我已经把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-3.4.3-161.el7.centos.noarch.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 wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
查看rpm包
[root@localhost ~]# mkdir rpm [root@localhost ~]# cd rpm/ [root@localhost rpm]# ls python-urlgrabber-3.10-10.el7.noarch.rpm yum-3.4.3-168.el7.centos.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm yum-utils-1.1.31-54.el7_8.noarch.rpm
安装(必须要强制安装)
[root@localhost rpm]# rpm -ivh *.rpm --force --nodeps warning: python-urlgrabber-3.10-10.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 20%] 2:python-urlgrabber-3.10-10.el7 ################################# [ 40%] 3:yum-plugin-fastestmirror-1.1.31-5################################# [ 60%] 4:yum-3.4.3-168.el7.centos ################################# [ 80%] 5:yum-utils-1.1.31-54.el7_8 ################################# [100%]
下载阿里镜像到/etc/yum.repos.d/目录下
[root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo --2020-12-21 14:36:48-- http://mirrors.aliyun.com/repo/Centos-7.repo Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 112.19.3.184, 112.19.3.182, 112.19.3.183, ... Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|112.19.3.184|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2523 (2.5K) [application/octet-stream] Saving to: ‘/etc/yum.repos.d/CentOS-Base.repo’ 100%[======================================>] 2,523 --.-K/s in 0s 2020-12-21 14:36:48 (140 MB/s) - ‘/etc/yum.repos.d/CentOS-Base.repo’ saved [2523/2523]
修改Centos-7.repo文件将所有$releasever替换为7
[root@localhost yum.repos.d]# vim CentOS-Base.repo 按Ctrl+: 输入:%s/$releasever/7/g
清除缓存并重新生成
[root@localhost yum.repos.d]# yum clean all [root@localhost yum.repos.d]# yum makecache
更新yum包
[root@localhost yum.repos.d]# yum update