本脚本主要针对python2.6升级至python2.7.12,并且解决了升级后不能使用yum的问题。添加了ipython功能
#########################
#!/bin/bash
path="/home/tools"
if [ ! -d $path ];then
mkdir $path
else
rm -rf $path && mkdir $path
fi
cd $path
yum -y install automake gcc gcc-c++ readline-devel zlib-devel zlib openssl-devel
wget --no-check-certificate https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
if [ $? -eq 0 ];then
tar xvf Python-2.7.12.tgz
fi
cd Python-2.7.12 && ./configure --with-zlib && make all && make install && make clean && make distclean
if [ $? -eq 0 ];then
rm -rf /usr/bin/python
ln -s /usr/local/bin/python2.7 /usr/bin/python
fi
sed -i '1s/$/&2.6/g' /usr/bin/yum
wget --no-check-certificate https://pypi.python.org/packages/source/i/ipython/ipython-3.1.0.tar.gz
if [ $? -eq 0 ];then
tar zxvf ipython-3.1.0.tar.gz
fi
cd ipython-3.1.0 && python setup.py install
#install setuptools
cd $path
wget https://pypi.python.org/packages/a9/23/720c7558ba6ad3e0f5ad01e0d6ea2288b486da32f053c73e259f7c392042/setuptools-36.0.1.zip#md5=430eb106788183eefe9f444a300007f0
unzip setuptools-36.0.1.zip
cd setuptools-36.0.1
python setup.py install
#install pip
cd $path
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9
tar -zxf pip-9.0.1.tar.gz
cd pip-9.0.1
python setup.py install
pip install supervisor
pip install uwsgi
pip install ansible==1.9.4
pip install Django==1.8.3
pip install django-users2
pip install MySQL-python
pip install rpyc