centos7 更換yum為阿里源或者別的源
原理:更改yum配置原檔案或新增檔案(新增檔案可以從網上直接wget或者直接複製內容)
修改檔案內容最為簡單,直接把.repo配置檔案裡的網址改成新的格式(注意變數)。
放幾個yum源取決於你。但要保證有可用的源。
檢視當前yum源:
yum repolist enabled
位置:
/etc/yum.repos.d/
採用新增檔案的方法:
新建備份目錄
mkdir /etc/yum.repos.d.bak
把全部檔案mv到另一個備份目錄
mv *.repo ../yum.repos.d.bak/
新建一個.reop檔案
vi centos-7-aliyun.repo
檔案內容可如果沒有以從真實機上下載下來(‘http://mirrors.aliyun.com/repo/Centos-7.repo’)用記事本開啟復制裡面的內容。
但是,直接把這個下載的檔案“Cnetos-7.repo”移動到配置目錄下也是可以的。
再次檢視當前yum源,字尾顯示為-aliyun或新增的源,而且最後一項狀態值不為0即為連線正常。
如果 意外 情況出現“另外一個程式鎖定了 yum;等待它退出……”可執行 rm -f /var/run/yum.pid 強行關閉yum程式。
下載的Cnetos-7.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-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
相關文章
- centos7 更換yum源為阿里雲CentOS阿里
- centos7替換yum源為阿里雲CentOS阿里
- 將Centos的yum源更換為國內的阿里雲源CentOS阿里
- Centos7 更換阿里源CentOS阿里
- CentOS7 yum源修改為阿里,配置阿里epel源CentOS阿里
- Centos7更換阿里映象源CentOS阿里
- 將Centos的yum源更換為國內的阿里雲(163)源CentOS阿里
- Linux中更換yum源為阿里的詳細步驟Linux阿里
- Centos7配置阿里epel源|yum源CentOS阿里
- 修改Centos7預設yum源為阿里雲源CentOS阿里
- Linux下更換預設yum源為網易yum源的操作記錄Linux
- 【Linux】超簡單將Centos的yum源更換為國內的阿里雲源LinuxCentOS阿里
- linux CentOS更換 ali YUM源LinuxCentOS
- Linux系統CentOS6 7 8更換阿里yum源的方法LinuxCentOS阿里
- CentOS 更改 yum 映象源為阿里雲映象源CentOS阿里
- CentOS 搭建內部Yum源同步阿里Yum源CentOS阿里
- sbt更換阿里的maven倉庫源阿里Maven
- 修改apt-get和yum為阿里源apt-get阿里
- Linux之RedHat7如何更換yum源LinuxRedhat
- 更換Ubuntu源為國內源的操作記錄Ubuntu
- centos 替換yum源CentOS
- 將Centos 的預設yum源改為阿里雲的yum源後出現的問題CentOS阿里
- readhalt7.4 系統替換 CentOS7 yum 源CentOS
- Gradle更換阿里雲映象源Gradle阿里
- Ubuntu切換為阿里映象源Ubuntu阿里
- Centos-Stream 配置本地yum源和配置阿里雲yum源CentOS阿里
- RedHat 7 yum源替換Redhat
- yum更換國內源、yum下載rpm包、 原始碼包安裝原始碼
- 【yum源】CentOS7安裝第三方源CentOS
- CentOS7系統配置國內yum源和epel源CentOS
- centos6-增加阿里yum源CentOS阿里
- CentOS7 切換阿里映象源並安裝 dockerCentOS阿里Docker
- CentOS7.9 搭建內部yum源伺服器同步阿里yum源CentOS伺服器阿里
- Linux環境更換阿里源(CentOS+Ubuntu)Linux阿里CentOSUbuntu
- Fedora怎麼設定DVD為yum源?Fedora設定DVD為yum源的方法
- pip更換映象源
- CentOS 7 配置 阿里雲 yum源CentOS阿里
- 搭建本地yum源,使用安裝光碟的rpm作為yum源的檔案