yum 镜像

使用阿里云镜像服务器

最近本机访问 163.com 的 CentOS 镜像比较不稳定,体现在 ping 很低,但是 HTTP 连接很慢,yum 的 fastestmirror 也不太理想,所以一般都禁用之。

发现阿里云的镜像服务器,立马换了,便秘立刻就通了。

yum 镜像

官方源镜像

      
      
1
2
3
4
5
6
      
      
# 禁用 fastestmirror 插件
sed -i.backup 's/^enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
# 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# 使用阿里云镜像
wget -O /etc/yum.repos.d/CentOS-Base-aliyun.repo http://mirrors.aliyun.com/repo/Centos- 6.repo

EPEL 镜像

      
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
      
      
# 安装 EPEL 源
wget http://dl.fedoraproject.org/pub/epel/ 6/x86_64/epel-release- 6- 8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release- 6.rpm
rpm -Uvh remi-release- 6*.rpm epel-release- 6*.rpm
# 使用阿里云镜像
if [[ ! -f /etc/yum.repos.d/epel.repo.backup ]]; then
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup 2>/dev/null || :
fi
if [[ ! -f /etc/yum.repos.d/epel-testing.repo.backup ]]; then
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup 2>/dev/null || :
fi
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel- 6.repo

PyPi 镜像

      
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
      
      
mkdir -p ~/.pip
touch ~/.pip/pip.conf
sed -i.backup -r \
's/^index-url\s*=\s*.+$/index-url = http:\/\/mirrors.aliyun.com\/pypi\/simple\//' \
~/.pip/pip.conf
# If file not changed, write contents back to pip.conf
diff "~/.pip/pip.conf" "~/.pip/pip.conf.backup" &> /dev/null
if [ $? -eq 0 ]; then
cat > ~/.pip/pip.conf <<EOF
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
EOF
fi

RubyGems 镜像

      
      
1
2
      
      
gem source -r https://rubygems.org/
gem source -a http://mirrors.aliyun.com/rubygems/



yum 清缓存和更新缓存
yum clean all
yum makecache
http://mirrors.163.com/.help/centos.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值