幾種常用linux系統的軟件鏡像源配置
1、centos6系統的軟件鏡像源配置
CentOS 6操作系統版本結束了生命周期(EOL),Linux社區已不再維護該操作系統版本。
2020年11月30日CentOS 6 EOL 按照社區規則,CentOS 6的源地址http://mirror.centos.org/centos-6/內容已移除,目前第三方的鏡像站中均已移除CentOS 6的源。
不過目前測試可以繼續使用騰訊云軟件鏡像站中CentOS6的軟件鏡像源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos6_base.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-6.repo
(圖片可放大查看)
(圖片可放大查看)
(圖片可放大查看)
(圖片可放大查看)
如果要用aliyun鏡像站,可以參考如下文檔 https://help.aliyun.com/document_detail/193569.html
阿里云的源http://mirrors.cloud.aliyuncs.com和http://mirrors.aliyun.com也無法同步到CentOS 6的源。當在阿里云上繼續使用默認配置的CentOS 6的源會發生報錯。
建議升級操作系統至CentOS 7及以上,如果業務過渡期仍需要使用CentOS 6系統中的一些安裝包,可以通過以下步驟,在CentOS 6操作系統中將源配置按照網絡環境不同進行切換。
1)專有網絡VPC類型實例需切換為http://mirrors.cloud.aliyuncs.com/centos-vault/6.10/源。
2)經典網絡類型實例需切換為http://mirrors.aliyuncs.com/centos-vault/6.10/源
3)EPEL源可以切換到http://mirrors.aliyun.com/epel-archive/6/
2、CentOS7系統的軟件鏡像源配置
CentOS7為目前主流的服務器操作系統
可以使用騰訊云軟件鏡像站中CentOS7的軟件鏡像源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo
(圖片可放大查看)
(圖片可放大查看)
(圖片可放大查看)
當然你也可以使用阿里云鏡像站中CentOS7的軟件鏡像源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
3、Debian10系統的軟件鏡像源配置
Debian源的使用需要以root權限修改/etc/apt/sources.list配置文件,修改之前,請做好備份
debian10.x(buster)為例
vi /etc/apt/sources.list
其它行都注釋掉,最下行新增如下行
deb https://mirrors.cloud.tencent.com/debian/ buster main contrib non-free
deb https://mirrors.cloud.tencent.com/debian/ buster-updates main contrib non-free
deb https://mirrors.cloud.tencent.com/debian/ buster-backports main contrib non-free
deb https://mirrors.cloud.tencent.com/debian-security buster/updates main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ buster main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ buster-updates main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian/ buster-backports main contrib non-free
deb-src https://mirrors.cloud.tencent.com/debian-security buster/updates main contrib non-free
(圖片可放大查看)
apt-get clean all
apt-get update
(圖片可放大查看)
(圖片可放大查看)
(圖片可放大查看)
4、Fedora33系統的軟件鏡像源配置
Fedora 33
cd /etc/yum.repos.d/
mkdir /etc/yum_repo_default_bak
mv *.repo /etc/yum_repo_default_bak/
(圖片可放大查看)
#Fedora 倉庫
cat > /etc/yum.repos.d/fedora.repo << EOF
[fedora]
name=Fedora $releasever - $basearch
failovermethod=priority
baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Everything/$basearch/os/
metadata_expire=28d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
#updates 倉庫
cat > /etc/yum.repos.d/fedora-updates.repo << EOF
[updates]
name=Fedora $releasever - $basearch - Updates
failovermethod=priority
baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/updates/$releasever/Everything/$basearch/
enabled=1
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
#fedora-modular 倉庫
cat > /etc/yum.repos.d/fedora-modular.repo<< EOF
[fedora-modular]
name=Fedora Modular $releasever - $basearch
failovermethod=priority
baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/$releasever/Modular/$basearch/os/
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
#updates-modular 倉庫
cat > /etc/yum.repos.d/fedora-updates-modular.repo << EOF
[updates-modular]
name=Fedora Modular $releasever - $basearch - Updates
failovermethod=priority
baseurl=https://mirrors.tuna.tsinghua.edu.cn/fedora/updates/$releasever/Modular/$basearch/
enabled=1
gpgcheck=1
metadata_expire=6h
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=False
EOF
(圖片可放大查看)
dnf clean all
dnf makecache
(圖片可放大查看)
(圖片可放大查看)
(圖片可放大查看)