Reference:
https://github.com/h2oai/h2o-2/wiki/ Installing-python-2.7-on-centos-6.3.-follow-this-sequence-exactly-for-centos-machine-only
http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/
Background:
In the production environment is CentOS 6.3, the system default python2.6, without changing the system default, want to install additional python2.7.
All steps are reproduced in the reference article, which is used only as a note.
Installing Python2.7
Steps:
1. Configure Yum Domestic source
cd/etc/Yumrepos.dmv /etc/yum. repos.d/centos-base.repo/etc/Yum. repos.d/centos-Base.repo.backupwget http://mirrors.163.com/.help/ Centos6-base-163.repomv centos6-base-163. Repo centos6-Base.repoYum Clean allyum Makecache
2. Configure python2.7 source installation and compilation environment
Yum " Development Tools " Yum Install zlib-develyuminstallbzip2-develYum Install openssl-develyuminstall ncurses-develYum Install sqlite-devel
3. Download and compile the installation python2.7
CD/optwget --no-check-certificate https://www.python.org/ftp/python/2.7.11/ Python-2.7.11.tar.xztar XF python-2.7. one by one. Tar . XZCD Python-2.7. One . /configure--prefix=/usr/Local make make Altinstall
Note that it is make altinstall instead of make install
After the installation is complete,/usr/bin/python and/usr/local/bin/python should be as follows
[Email protected]:/opt/python-2.7. One]ls-ltr/usr/bin/python*
lrwxrwxrwx1Root root6Nov - 2002/usr/bin/python2python-rwxr-xr-x1Root root1418JulTen -/usr/bin/python2.6-Config-rwxr-xr-x2Root root4864JulTen -/usr/bin/python2.6-rwxr-xr-x2Root root4864JulTen -/usr/bin/pythonlrwxrwxrwx1Root root -Oct - the: the/usr/bin/python-config, Python2.6-Config[email protected]:/opt/python-2.7. One]ls-ltr/usr/local/bin/python*-rwxr-xr-x1Root root6214533Mar + A: $/usr/local/bin/python2.7-rwxr-xr-x1Root root1674Mar + A: $/usr/local/bin/python2.7-config
4. Check $path,/usr/local/bin's position should be before/usr/bin
Echo $PATH/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
5. Create a soft link to link the/usr/local/bin/python2.7 to the/usr/local/bin/python
Ln -s/usr/local/bin/python2. 7 /usr/local/bin/python
6. Disconnect ssh, re-ssh to the server, Python is default to 2.7.11, Yum can be used normally
Install PIP, virtualenv
1. Install Pip 8.1.2
Since all environments are configured in Virtualenv, Pip is not modified, if the default Pip is version 2.6, a soft link to/usr/local/bin/pip can be created
wget https://bootstrap.pypa.io/get-pip.pypython get-pip.py
2. Installing virtualenv
Install virtualenv
Install MySQL
1. Install the MySQL client and server
Yum Install MySQL Yum Install mysql-serveryuminstall mysql-devel
2. Configure MySQL default charset
Add Default-character-set=utf8 in/ETC/MY.CNF
3. Start the MySQL service and set the boot up
-Add Mysqldchkconfig mysqld on
4. Create a MySQL root user
123456
centos6.3 installation python2.7, pip2.7, MySQL