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源文件內容改成以下內容解決的。如果還有報錯,可以嘗試把該目錄下其他repo文件刪掉

[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即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM