加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

redhat 7.2更新yum源时踩的坑

发布时间:2020-12-14 01:42:57 所属栏目:Linux 来源:网络整理
导读:yum 1.检查是否安装yum包 查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包: [[email?protected] yum.repos.d]# rpm -qa |grep yum yum-3.4.3-118.el7.noarch yum-utils-1.1.31-24.el7.noarch yum-rhn-plugin-2.0.1-4.el7.noarch PackageKit-yum-0.8.

yum

1.检查是否安装yum包

查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:

[[email?protected] yum.repos.d]# rpm -qa |grep yum
yum-3.4.3-118.el7.noarch
yum-utils-1.1.31-24.el7.noarch
yum-rhn-plugin-2.0.1-4.el7.noarch
PackageKit-yum-0.8.9-11.el7.x86_64
yum-langpacks-0.4.2-3.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64

2 删除redhat自带的yum包

卸载上面显示的所有yum包:

[[email?protected] ~]# rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)

再用

[[email?protected] ~]# rpm -qa |grep yum

[[email?protected] ~]#

查看,无信息显示表示已经卸载完成。

3.安装yum
rpm -ivh yum-* --nodeps
rpm -Uvh rpm-4.11.3-35.el7.x86_64.rpm --nodeps
rpm -Uvh python-urlgrabber-3.10-9.el7.noarch.rpm --nodeps


4.vim /etc/yum.repos.d/CentOs-Base.repo

内容:

#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you,as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$7 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$7 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$7&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$7 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7


5.清除yum缓存
yum clean all
yum makecache
yum update -y

?

6.安装必要软件
yum install vim net-tools sshd ntp wget lrzsz -y

?

7.调整时间sudo systemctl enable ntpdsudo systemctl start ntpddate 查看时间netdate asia.pool.ntp.org 调整时间

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读