Skip to content

Instantly share code, notes, and snippets.

@wenjianhn
Last active August 29, 2015 14:00
Show Gist options
  • Save wenjianhn/11131584 to your computer and use it in GitHub Desktop.
Save wenjianhn/11131584 to your computer and use it in GitHub Desktop.
Set centos repos and pip mirror for openstack developers who live in China mainland.
function setup_mirror() {
cd /etc/yum.repos.d/
rm -f CentOS-Base.repo
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
wget http://ftp.sjtu.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
rm -f epel-release-6-8.noarch.rpm
mv epel.repo epel.repo.bak
wget -O epel.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/epel?codeblock=0
# using curl instead of wget to avoid wget BZ bug #674186
curl https://fedoraproject.org/static/0608B895.txt > /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
yum makecache
cd -
}
function setup_pypi() {
mkdir ~/.pip
cat >~/.pip/pip.conf <<EOF
[global]
index-url = http://pypi.douban.com/simple/
download_cache = ~/.cache/pip
EOF
}
setup_mirror
setup_pypi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment