Skip to content

Instantly share code, notes, and snippets.

@sfoolish
Created August 26, 2016 09:46
Show Gist options
  • Save sfoolish/cb665795921817fac44aefe1b9d43093 to your computer and use it in GitHub Desktop.
Save sfoolish/cb665795921817fac44aefe1b9d43093 to your computer and use it in GitHub Desktop.

国内 centos rpm python 源配置

rpm 原配置

163 centos 源帮助链接

http://mirrors.163.com/.help/centos.html

备份原始 CentOS-Base.repo 文件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

修改 repo 文件,将以下内容下入 /etc/yum.repos.d/CentOS-Base.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 - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

重新制作 rpm 源的 cache

yum clean all
yum makecache

Python 源配置

配置 python 国内镜像源

mkdir -p /root/.pip

cat << EOF > /root/.pip/pip.conf
[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
EOF

cat << EOF > .pydistutils.cfg
[easy_install]
index-url=http://pypi.douban.com/simple
find-links=
    http://pypi.douban.com/simple
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment