CentOS安裝配置yum

寒武沒有紀發表於2018-11-08

準備

版本:CentOS 7

安裝配置過程

解除安裝系統自帶yum

檢視是否存在yum

[root@localhost apps]# rpm -qa | grep yum
yum-plugin-fastestmirror-1.1.31-45.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-158.el7.centos.noarch

解除安裝yum

[root@localhost apps]# rpm -e --nodeps yum-plugin-fastestmirror-1.1.31-45.el7.noarch
[root@localhost apps]# rpm -e --nodeps yum-metadata-parser-1.1.4-10.el7.x86_64
[root@localhost apps]# rpm -e --nodeps yum-3.4.3-158.el7.centos.noarch

安裝依賴包

下載下面兩個依賴包並上傳(http://mirrors.163.com/centos/7/os/x86_64/Packages/)

  • python-2.7.5-68.el7.x86_64.rpm
  • python-iniparse-0.4-9.el7.noarch.rpm

安裝

[root@localhost apps]# rpm -ivh python-2.7.5-68.el7.x86_64.rpm python-iniparse-0.4-9.el7.noarch.rpm

yum安裝

下載yum相關依賴包並上傳

  • yum-3.4.3-158.el7.centos.noarch.rpm

  • yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

  • yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm

安裝

[root@localhost apps]# rpm -ivh yum-*

更改yum源

備份原始配置

[root@localhost apps]# mv CentOS-Base.repo CentOS-Base.repo.bak

下載yum源配置並覆蓋原檔案(/etc/yum.repos.d/)

執行以下命令生成快取

[root@localhost apps]# yum clean all
[root@localhost apps]# yum makecache

異常

http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - “Could not resolve host: mirrors.aliyuncs.com; 未知的錯誤”

CentOS 7預設沒有開啟網路連線,可以設定相關配置(/etc/sysconfig/network-scripts/ifcfg-ens33)

ONBOOT=yes #啟用網路連線
BOOTPROTO=none
IPADDR=172.16.105.129
NETMASK=255.255.255.0
GATEWAY=172.16.105.2
DNS1=8.8.8.8
DNS2=8.8.4.4

重啟服務並ping測試

[root@localhost apps]# service network restart
[root@localhost apps]# ping www.baidu.com

參考

http://mirrors.163.com/.help/centos.html

相關文章