欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Centos7更換倉(cāng)庫(kù)源為阿里云鏡像的詳細(xì)步驟

 更新時(shí)間:2025年05月28日 09:59:44   作者:流煙默  
這篇文章主要為大家詳細(xì)介紹了Centos7更換倉(cāng)庫(kù)源為阿里云鏡像的詳細(xì)步驟,文中的示例代碼簡(jiǎn)潔易懂,有需要的小伙伴可以跟隨小編一起學(xué)習(xí)一下

服務(wù)器鏡像如下:/etc/yum.repos.d

[root@ecs-q97onp yum.repos.d]# ll
total 44
-rw-r--r-- 1 root root 2523 Mar 18 21:42 CentOS-Base.repo
-rw-r--r-- 1 root root 1309 Mar  2  2021 CentOS-CR.repo
-rw-r--r-- 1 root root  649 Mar  2  2021 CentOS-Debuginfo.repo
-rw-r--r-- 1 root root  326 Mar  2  2021 CentOS-fasttrack.repo
-rw-r--r-- 1 root root  630 Mar  2  2021 CentOS-Media.repo
-rw-r--r-- 1 root root 1331 Mar  2  2021 CentOS-Sources.repo
-rw-r--r-- 1 root root 7577 Mar  2  2021 CentOS-Vault.repo
-rw-r--r-- 1 root root  640 Mar  2  2021 CentOS-x86_64-kernel.repo
-rw-r--r-- 1 root root  664 Mar 18 21:25 epel.repo

這里默認(rèn)是清華源,但是在使用yum安裝的時(shí)候提示找不到鏡像,故而更換阿里源。

更換基礎(chǔ)源配置文件

# CentOS 基礎(chǔ)源---這句話很重要哦
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

修改后的阿里云EPEL源配置

sudo tee /etc/yum.repos.d/epel.repo <<'EOF'
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch - Aliyun
baseurl=https://mirrors.aliyun.com/epel/7/$basearch
#baseurl=https://mirrors.aliyun.com/epel/7/$basearch
metalink=
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug - Aliyun
baseurl=https://mirrors.aliyun.com/epel/7/$basearch/debug
#baseurl=https://mirrors.aliyun.com/epel/7/$basearch/debug
metalink=
failovermethod=priority
enabled=0
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source - Aliyun
baseurl=https://mirrors.aliyun.com/epel/7/SRPMS
#baseurl=https://mirrors.aliyun.com/epel/7/SRPMS
metalink=
failovermethod=priority
enabled=0
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7
gpgcheck=1
EOF

修改說(shuō)明

鏡像地址變更:

  • 將原地址 mirrors.tuna.tsinghua.edu.cn 改為 mirrors.aliyun.com
  • 去除了 metalink 參數(shù)(阿里云鏡像不需要該參數(shù))

GPG密鑰地址:

- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
+ gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7

倉(cāng)庫(kù)命名標(biāo)識(shí):

- name=Extra Packages for Enterprise Linux 7 - $basearch
+ name=Extra Packages for Enterprise Linux 7 - $basearch - Aliyun

操作步驟

備份原有配置:

sudo cp /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak

應(yīng)用新配置:

sudo curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

清理并重建緩存:

sudo yum clean all
sudo yum makecache

驗(yàn)證配置:

yum repolist epel

應(yīng)該看到類(lèi)似輸出:

repo id            repo name
epel/7/x86_64      Extra Packages for Enterprise Linux 7 - x86_64 - Aliyun

注意事項(xiàng)

如果遇到 GPG key retrieval failed 錯(cuò)誤,可臨時(shí)禁用 GPG 檢查:

sudo yum install --nogpgcheck [package-name]

建議保留原始清華源配置備份,以便需要時(shí)恢復(fù):

sudo mv /etc/yum.repos.d/epel.repo.bak /path/to/backup/

阿里云鏡像地址支持 HTTPS 協(xié)議訪問(wèn),如果系統(tǒng)未安裝 SSL 證書(shū),可以改用 HTTP:

baseurl=http://mirrors.aliyun.com/epel/7/$basearch

其他相關(guān)鏡像源推薦配置:

# CentOS 基礎(chǔ)源---這句話很重要哦
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

# Docker CE 源
sudo curl -o /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

配置前后對(duì)比圖

- baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch
+ baseurl=https://mirrors.aliyun.com/epel/7/$basearch

- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
+ gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7

yum安裝的時(shí)候指定使用某個(gè)鏡像

sudo yum install --disablerepo=* --enablerepo=epel[epel為倉(cāng)庫(kù)ID] 軟件包名

知識(shí)擴(kuò)展

centos7更換阿里云鏡像源步驟

在CentOS 7上更換為阿里云的鏡像源可以通過(guò)以下步驟進(jìn)行:

備份當(dāng)前的YUM源配置文件

sudo cp -a /etc/yum.repos.d /etc/yum.repos.d.backup

清理原有的YUM源配置文件

sudo rm -f /etc/yum.repos.d/*.repo

下載阿里云的CentOS 7源配置文件

sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

清除YUM緩存并生成新的緩存

sudo yum clean all
sudo yum makecache

完成以上步驟后,您的系統(tǒng)就會(huì)使用阿里云的鏡像源進(jìn)行軟件包的安裝和更新。

Centos7更換阿里云鏡像

1.安裝wget

yum -y install wget

2.建議備份原有的yum源文件,不要直接刪除

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

3.下載阿里云鏡像文件

cd /etc/yum.repos.d
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

4.清理緩存

yum clean all

5.生成緩存

yum makecache

6.更新最新源設(shè)置

yum update -y

到此這篇關(guān)于Centos7更換倉(cāng)庫(kù)源為阿里云鏡像的詳細(xì)步驟的文章就介紹到這了,更多相關(guān)Centos7更換阿里云鏡像內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論