centos6.5 upgrade Python to 2.7

Source: Internet
Author: User

Today online server All upgrade Python environment for python-2.7.6 Environment, I use the method is Ansible+shell, code as follows, friend, Python-2.7.6.tgz, setuptools-14.3.1.tar.gz, Pip-9.0.1.tar.gz, these three bags I was in advance under the/data/x5online/tools directory, of course, you can also directly in the script wget related packages, the individual likes to put the package and then unified in the/data/x5online/ Tools directory, the script is relatively simple, record, save and forget, save time. Time is money.

#!/bin/bashyum install python-devel Zlib-devel-ycd/data/x5online/toolstar XF python-2.7.6.tgzcd Python-2.7.6echo " Start compiling python "./configure--prefix=/usr/localmake if [$?-eq 0];then    echo" Make was OK "else    echo" Something is wrong "    exitfimake InstallIf [$?] -eq 0];then    echo "Make install was OK" else    echo "Something is wrong"    exitfiln-s/usr/local/python2.7/usr/bin /pythonsleep 1echo "Start installing Setuptools" Cd/data/x5online/toolstar XF setuptools-14.3.1.tar.gzcd Setuptools-14.3.1python setup.py installif [$?-eq 0];then    echo ' setup is ok ' else    echo ' Something is wrong '    exitfisleep 1echo ' start installation P IP "Cd/data/x5online/toolstar XF pip-9.0.1.tar.gzcd pip-9.0.1python setup.py installif [$?-eq 0];then    echo" All are OK "Else    echo" Something is wrong "fi

Then use ansible all-m copy "src=/data/x5online/install_python.sh Dest=/data/x5online" to distribute to all servers that need to upgrade Python

Finally ansible all-m Shell "/data/x5online/install_python.sh" executes the script.

centos6.5 upgrade Python to 2.7

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.