最近本机访问 163.com
的 CentOS
镜像比较不稳定,体现在 ping 很低,但是 HTTP 连接很慢,yum
的 fastestmirror
也不太理想,所以一般都禁用之。
发现阿里云的镜像服务器,立马换了,便秘立刻就通了。
yum 镜像
官方源镜像
1
2
3
4
5
6
|
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
|
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
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 clean all
yum makecache
http://mirrors.163.com/.help/centos.html