您好,欢迎访问一九零五行业门户网

详解CentOS7更新YUM源步骤

下面由centos教程栏目给大家介绍centos 7更新yum源步骤,希望对需要的朋友有所帮助!
centos 7更新yum源步骤国内小伙伴推荐使用阿里云的源
step1 找到需要的源阿里巴巴开源镜像站各种源应有尽有,老域名是https://mirrors.aliyun.com/
step2 编辑centos7.repo文件进入/etc/yum.repos.d,发现我的源还是7.4.1708
[base]name=centos-$releasever - base - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/rpm-gpg-key-centos-7#released updates[updates]name=centos-$releasever - updates - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7.4.1708/updates/x86_64/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/rpm-gpg-key-centos-7#additional packages that may be useful[extras]name=centos-$releasever - extras - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7.4.1708/extras/x86_64/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/rpm-gpg-key-centos-7#additional packages that extend functionality of existing packages[centosplus]name=centos-$releasever - plus - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7.4.1708/centosplus/x86_64/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirrors.aliyun.com/centos/rpm-gpg-key-centos-7#contrib - packages by centos users[contrib]name=centos-$releasever - contrib - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/7.4.1708/contrib/x86_64/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirrors.aliyun.com/centos/rpm-gpg-key-centos-7
这个版本的源已经迁移到7.5.1804了,→地址,使用vim将其替换
:%s/7.4.1708/7.7.1908/g
step3 修复冲突报错然后更新系统试试yum -y update
[root@liaogx ~]# yum -y updateplugin product-id can't be importedplugin search-disabled-repos can't be importedloaded plugins: fastestmirrorloading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.aliyun.com * updates: mirrors.aliyun.comresolving dependencies--> running transaction check---> package modemmanager.x86_64 0:1.6.0-2.el7 will be updated......此处略......---> package yum-rhn-plugin.noarch 0:2.0.1-10.el7 will be installed--> running transaction check---> package libbytesize.x86_64 0:1.2-1.el7 will be installed---> package python2-pytoml.noarch 0:0.1.18-1.el7 will be installed---> package volume_key-libs.x86_64 0:0.3.9-8.el7 will be installed--> processing conflict: initscripts-9.49.41-1.el7_5.1.x86_64 conflicts redhat-release < 7.5-0.11--> finished dependency resolutionerror: initscripts conflicts with redhat-release-server-7.4-18.el7.x86_64 you could try using --skip-broken to work around the problem** found 2 pre-existing rpmdb problem(s), 'yum check' output follows:packagekit-1.1.5-1.el7.centos.x86_64 has missing requires of packagekit-backendrhn-check-2.0.2-17.el7.noarch has missing requires of yum-rhn-plugin >= ('0', '1.6.4', '1')[root@liaogx ~]#
如果报如下错误
error: initscripts conflicts with redhat-release-server-7.4-18.el7.x86_64这是更新软件包是与原版本冲突造成的,有两种解决办法
通过关键字initscritps排除冲突:yum update --exclude=kernel* --exclude=centos-release* --exclude=initscripts*删除冲突包:rpm -e redhat-release-server-7.4-18.el7.x86_64 --nodeps这里使用第二种方法,把冲突的包干掉
[root@liaogx ~]# rpm -e redhat-release-server-7.4-18.el7.x86_64 --nodepswarning: file /etc/pki/rpm-gpg/rpm-gpg-key-redhat-release: remove failed: no such file or directorywarning: file /etc/pki/rpm-gpg/rpm-gpg-key-redhat-legacy-rhx: remove failed: no such file or directorywarning: file /etc/pki/rpm-gpg/rpm-gpg-key-redhat-legacy-release: remove failed: no such file or directorywarning: file /etc/pki/rpm-gpg/rpm-gpg-key-redhat-legacy-former: remove failed: no such file or directorywarning: file /etc/pki/rpm-gpg/rpm-gpg-key-redhat-beta: remove failed: no such file or directory[root@liaogx ~]#
step4 更新系统小白从入门到跑路必会,sudo yum -y update,老鸟都懂。
[root@liaogx ~]# yum -y update......此处省略10分钟......complete![root@liaogx ~]#
更新成功 ^_^
以上就是详解centos7更新yum源步骤的详细内容。
其它类似信息

推荐信息