#update yum
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/$releasever/6.8/g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's/centos/centos-vault/g' /etc/yum.repos.d/CentOS-Base.repo
yum clean all && yum makecache
yum update -y
# install some necessary tools & libs
yum -y update
yum groupinstall -y 'development tools'
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget
sleep 5
wget http://npm.taobao.org/mirrors/python/2.7.18/Python-2.7.18.tgz
tar zxvf Python-2.7.18.tgz
cd Python-2.7.18
./configure --prefix=/usr/local/python/python2.7
make
make install
#更替yum的py2.6
mv /usr/bin/python /usr/bin/python2.6
ln -s /usr/local/python/python2.7/bin/python2.7 /usr/bin/python
sed -i '1c #!/usr/bin/python2.6' /usr/bin/yum
echo "Finished. Well done!";
sed -i '1c #!/usr/bin/python2.6' /usr/bin/yum
python -V
python2.6 -V
centos6升级python2.7 保留2.6的yum一键脚本
最新推荐文章于 2024-03-13 18:12:09 发布