Centos6
運(yùn)行以下命令編輯CentOS-Base.repo?
文件。
vim /etc/yum.repos.d/CentOS-Base.repo
按i進(jìn)入編輯模式,修改以下內(nèi)容切換源。
請根據(jù)實(shí)例不同的網(wǎng)絡(luò)類型進(jìn)行修改,具體內(nèi)容如下:
-
[base] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 [updates] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6 [extras] name=CentOS-6.10 enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.cloud.aliyuncs.com/centos-vault/RPM-GPG-KEY-CentOS-6
編輯完成后,按Esc鍵,并輸入:wq
保存退出文件。
運(yùn)行以下命令編輯epel.repo?
文件。
vim /etc/yum.repos.d/epel.repo
按i進(jìn)入編輯模式,修改以下內(nèi)容切換源。
請根據(jù)實(shí)例不同的網(wǎng)絡(luò)類型進(jìn)行修改,具體內(nèi)容如下:
-
[epel] name=Extra Packages for Enterprise Linux 6 - $basearch enabled=1 failovermethod=priority baseurl=http://mirrors.cloud.aliyuncs.com/epel-archive/6/$basearch gpgcheck=0 gpgkey=http://mirrors.cloud.aliyuncs.com/epel-archive/RPM-GPG-KEY-EPEL-6
編輯完成后,按Esc鍵,并輸入:wq
保存退出文件。
Centos7?
運(yùn)行以下命令,將Centos7 系統(tǒng)軟件包升級到最新版本
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sudo wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
運(yùn)行以下命令,更新系統(tǒng)軟件包并重啟系統(tǒng)。
sudo yum -y update
sudo reboot
?運(yùn)行以下命令,從Red Hat官方網(wǎng)站下載并安裝convert2rhel工具。
sudo curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release https://www.redhat.com/security/data/fd431d51.txt
sudo curl --create-dirs -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem
sudo curl -o /etc/yum.repos.d/convert2rhel.repo https://ftp.redhat.com/redhat/convert2rhel/7/convert2rhel.repo
sudo yum -y install convert2rhel
Centos 8
操作步驟
-
登錄CentOS 8系統(tǒng)的ECS實(shí)例。
具體操作,請參見連接方式概述。
-
運(yùn)行以下命令備份之前的repo文件。
rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo
-
運(yùn)行以下命令下載最新的repo文件。
wget http://mirrors.cloud.aliyuncs.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo wget http://mirrors.cloud.aliyuncs.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo
重要
如果您的服務(wù)器不是ECS實(shí)例,請將命令中的源地址
http://mirrors.cloud.aliyuncs.com
替換為http://mirrors.aliyun.com
。您也可以直接參考CentOS 鏡像社區(qū)說明進(jìn)行下載。 -
運(yùn)行以下命令替換repo文件中的鏈接。
sed -i 's/http:\/\/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/http:\/\/mirrors.aliyun.com/http:\/\/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/url_tmp/http:\/\/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo sed -i 's/http:\/\/mirrors.aliyun.com/http:\/\/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/epel-archive-8.repo
-
運(yùn)行以下命令重新創(chuàng)建緩存。
yum clean all && yum makecache
后續(xù)步驟
yum源和epel源切換完成后,即可使用yum install命令在實(shí)例上安裝您所需要的軟件包。文章來源:http://www.zghlxwxcb.cn/news/detail-805907.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-805907.html
到了這里,關(guān)于阿里云Centos6/7/8 轉(zhuǎn)換為Red Hat Enterprise Linux(RHEL)6/7/8的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!