1. 程式人生 > 實用技巧 >Centos6.5部署及yum源注意事項

Centos6.5部署及yum源注意事項

因為系統檢測出漏洞,需升級SSH版本。保險起見,打算在本地搭建相同版本的系統,然後再對本地系統SSH進行升級,沒有問題,再對環境進行升級。於是就有了這篇文章,記錄了操作過程中遇到的問題。

Centos6.5的最小化安裝版本

一、作業系統安裝

  我是使用的VM安裝虛機,但是發現按照一般的安裝步驟無法正常進入系統。需要在建立新虛擬機器時,勾選稍後選擇安裝作業系統,否則系統安裝重啟起來後,可能會卡在系統啟動介面。報錯如下

  /etc/rc5.d/s99local:line 25:eject:command not found

二、配置網路

  使用NAT模式,編輯IP地址配置檔案/etc/sysconfig/network-scripts/ifcfg-eth0(最後這個eth0根據具體網路介面名修改,有些可能會是ens33等),開機自啟,修改協議為dhcp,讓系統自動獲取IP地址,具體內容如下

[root@bp ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0
HWADDR=00:0C:29:59:D8:CC
TYPE=Ethernet
UUID=49b492f8-e204-425b-af70-9a86c497cd92
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp
[root@bp ~]# 

  配置好後重啟網路生效

三、Yum源不可用

  正常來說,網路配置好,可以ping 8.8.8.8後,就可以正常使用yum源。但是我這次遇到了以下幾個問題

  (1)Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

  (2)http://download.fedoraproject.org/pub/epel/6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"Trying other mirror.

  (3)YumRepo Error: All mirror URLs are not using ftp, http[s] or file

  其實這些問題都是Yum源不可用造成的,別的網友查了下centos社群,發現是2020年11月30日開始 centos6各大開源映象站已經停止維護了 但是測試了一下發現阿里源映象repo還是可以用的 因為他的centos-vault倉庫裡放了之前版本的centos的包。所以我這次是通過配置阿里雲yum源解決的。參考連結https://blog.csdn.net/u011775882/article/details/110923820

  我是將yum原始檔內容改成以下內容解決的

[root@bp ~]# cat /etc/yum.repos.d/epel.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-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[root@bp ~]# 

  修改之後,執行yum clean all和yum makecache即可