国内常用yum源
国内yum源列表如下:
1、企业贡献
网易:http://mirrors.163.com
阿里:http://mirrors.aliyun.com
搜狐:http://mirrors.sohu.com
2、大学教学
北京理工大学:
http://mirror.bit.edu.cn (IPv4 only)
http://mirror.bit6.edu.cn (IPv6 only)
北京交通大学:
http://mirror.bjtu.edu.cn (IPv4 only)
http://mirror6.bjtu.edu.cn (IPv6 only)
http://debian.bjtu.edu.cn (IPv4+IPv6)
兰州大学:http://mirror.lzu.edu.cn/
厦门大学:http://mirrors.xmu.edu.cn/
清华大学:
http://mirrors.tuna.tsinghua.edu.cn/ (IPv4+IPv6)
http://mirrors.6.tuna.tsinghua.edu.cn/ (IPv6 only)
http://mirrors.4.tuna.tsinghua.edu.cn/ (IPv4 only)
天津大学:http://mirror.tju.edu.cn/
中国科学技术大学:
http://mirrors.ustc.edu.cn/ (IPv4+IPv6)
http://mirrors4.ustc.edu.cn/
http://mirrors6.ustc.edu.cn/
东北大学:
http://mirror.neu.edu.cn/ (IPv4 only)
http://mirror.neu6.edu.cn/ (IPv6 only)
电子科技大学:http://ubuntu.uestc.edu.cn/
centos各版本停止维护时间
CentoS 6 停止维护更新日期 2020 年 11 月 30 日
CentOS 7 停止维护更新日期 2024 年 6 月 30 日
CentOS 8 停止维护更新日期 2029 年 5 月 31 日
本地yum源配置
基于centos7演示如下:
for i in /etc/yum.repos.d/*.repo;do cp $i ${i%.repo}.bak;done
rm -rf /etc/yum.repos.d/*.repo
mkdir -p /mnt/cdrom && mount -o loop -t iso9660 /root/CentOS-7-x86_64-Everything-1611.iso /mnt/cdrom/
cat << EOF > /etc/yum.repos.d/localyum.repo
[InstallMedia]
name=Centos 7.3
baseurl=file:///mnt/cdrom/
enabled=1
gpgcheck=0
EOF
yum clean all && yum makecache
yum repolist
centos6 yum源配置
脚本如下:
for i in /etc/yum.repos.d/*.repo;do cp $i ${i%.repo}_bak;done
rm -rf /etc/yum.repos.d/*.repo
cat > /etc/yum.repos.d/aliyun.repo <<EOF
# 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
EOF
yum clean all && yum makecache
centos7 yum源配置
脚本如下:
#!/bin/bash
#################################
# copyright by hwb
# DATE:2020-11-03
#################################
#调用函数库
[ -f /etc/init.d/functions ] && source /etc/init.d/functions
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
source /etc/profile
#Require root to run this script.
[ $(id -u) -gt 0 ] && echo "请用root用户执行此脚本!" && exit 1
#Config Yum CentOS-Bases.repo and save Yum file
configAliyunYum(){
echo ""
echo -e "\033[33m***************************************************更新为阿里源******************************************************\033[0m"
for i in /etc/yum.repos.d/*.repo;do cp $i ${i%.repo}_bak;done
rm -rf /etc/yum.repos.d/*.repo
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/Centos-7.repo >/dev/null 2>&1
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo >/dev/null 2>&1
echo "================配置YUM源文件===================="
sed -i 's#keepcache=0#keepcache=1#g' /etc/yum.conf
grep keepcache /etc/yum.conf
yum clean all >/dev/null 2>&1
yum makecache >/dev/null 2>&1
yum repolist
echo -e "\033[33m***************************************************完成阿里源配置****************************************************\033[0m"
echo ""
sleep 5
}
#Config Yum lianyou.repo and save Yum file
configlyYum(){
echo ""
echo -e "\033[33m***************************************************配置联友本地yum***************************************************\033[0m"
for i in /etc/yum.repos.d/*.repo;do cp $i ${i%.repo}.bak;done
rm -rf /etc/yum.repos.d/*.repo
mkdir -p /mnt/cdrom && mount -o loop -t iso9660 /root/CentOS-7-x86_64-Everything-1611.iso /mnt/cdrom/
echo "================配置YUM源文件===================="
cat << EOF > /etc/yum.repos.d/localyum.repo
[InstallMedia]
name=Centos 7.3
baseurl=file:///mnt/cdrom/
enabled=1
gpgcheck=0
EOF
yum clean all && yum makecache >/dev/null 2>&1
yum repolist
echo -e "\033[33m***********************************************完成联友本地yum配置***************************************************\033[0m"
echo ""
sleep 5
}
configDfwlgYum(){
echo ""
echo -e "\033[33m***********************************************更新为集团私有源******************************************************\033[0m"
for i in /etc/yum.repos.d/*.repo;do cp $i ${i%.repo}_bak;done
rm -rf /etc/yum.repos.d/*.repo
cat > /etc/yum.repos.d/mirrors-dfwlg.repo <<EOF
[base]
name=CentOS-$releasever - Base - mirror.dfwlg.com
baseurl=http://xx.88/base/
path=/
enabled=1
gpgcheck=0
[updates]
name=CentOS-$releasever - Updates - mirror.dfwlg.com
baseurl=http://xx.88/updates/
path=/
enabled=1
gpgcheck=0
[extras]
name=CentOS-$releasever - Extras - mirrors.dfwlg.com
baseurl=http://xx.88/extras/
path=/
enabled=1
gpgcheck=0
[epel]
name=CentOS-$releasever - epel - mirrors.dfwlg.com
baseurl=http://xx.88/epel/
failovermethod=priority
enabled=1
gpgcheck=0
EOF
echo "================配置YUM源文件===================="
sed -i 's#keepcache=0#keepcache=1#g' /etc/yum.conf
grep keepcache /etc/yum.conf
yum clean all >/dev/null 2>&1
yum makecache >/dev/null 2>&1
yum repolist
echo -e "\033[33m*************************************************完成集团私有源配置**************************************************\033[0m"
echo ""
sleep 3
}
# install_yum(){
# echo ""
# echo -e "\033[33m***************************************************开始配置yum源*****************************************************\033[0m"
# ping -c 4 mirrors.aliyun.com >/dev/null
# if [ $? -eq 0 ];then
# configAliyunYum
# else
# if [ -f /root/CentOS-7-x86_64-Everything-1611.iso ];then
# configlyYum
# else
# echo -e "\033[33m*********************************网络不通且联友云本地没有yum源,请手动配置yum*****************************************\033[0m"
# echo "网络不通且联友云本地没有yum源,请手动配置yum" >> /tmp/install_error.log
# fi
# fi
# }
configAliyunYum
centos8 yum源配置
yum源配置脚本如下
for i in /etc/yum.repos.d/*.repo;do cp $i ${i%.repo}_bak;done
rm -rf /etc/yum.repos.d/*.repo
cat > /etc/yum.repos.d/CentOS-AppStream.repo <<EOF
[aliyun-AppStream]
name=CentOS-$releasever - AppStream
baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
cat > /etc/yum.repos.d/CentOS-BaseOS.repo <<EOF
[aliyun-BaseOS]
name=CentOS-$releasever - Base
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
cat > /etc/yum.repos.d/CentOS-Extras.repo <<EOF
[aliyun-extras]
name=CentOS-$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF
dnf -y install epel-release
dnf clean all
dnf makecache
dnf repolist