RedHat7使用yum源安裝依賴包

  • 由於Redhat版本的linux不能免費使用yum源安裝依賴包,這導致不能愉快的安裝Oracle的相關產品,本文就介紹一下如何在Redhat7上配置yum源
  • 首先查看一下Redhat7默認安裝的yum,查詢結果如下
[wen@localhost Desktop]$ rpm -qa | grep yum
  • 在這裏插入圖片描述

  • 發現默認有安裝yum,先將其卸載

[wen@localhost Desktop]$ su - root                         //切換到root用戶 進行卸載
Password: 
Last login: Sat Nov  2 19:50:09 CST 2019 on pts/0
[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps         //忽略依賴性 卸載
[root@localhost ~]# rpm -qa | grep yum             //再次查詢是否還有yum相關的安裝包,以確保卸載完全
  • 將準備好的yum安裝包上傳到虛擬主機,我是放在/home/yum目錄下
    在這裏插入圖片描述
    在這裏插入圖片描述
  • 因爲要替換,所以一定要是完整的一套,還有一個rhel-debuginfo.repo文件要配置。部分博客配置的不對,這個文件配置不對也是不行的,所以我是測試好的一套yum包給大家包括配置文件,需要的可以找我。執行: rpm -ivh *.rpm 一次性執行依賴包,因爲包之間會相互依賴。
[root@localhost yum]# rpm -ivh *.rpm
  • 在這裏插入圖片描述
  • 新建配置文件/etc/yum.repos.d/CentOS-Base.repo,加入以下內容即可,不要改動,不要以爲你很厲害,真的!然後保存退出
[root@localhost yum]# vi /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

在這裏插入圖片描述
然後執行yum clear all,就可以用yum來安裝依賴包了

[root@node ~]# yum clear all

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章