CentOS6.4 install Python web development + production environment

Source: Internet
Author: User

CentOS6.4 install Python web development + production environment

1. Overview

Centos6.4 install Python, setuptool, pip, virtualenv, mysql, django, libevent, memcache, nginx, git, beyond compare, jdk, eclipse, pydev

2. Refer to the command

Centos6.4 comes with Python2.6, which is slightly different from 2.x.

1. Install setuptool

[Plain] view plaincopy
  1. Wget -- no-check-certificatehttps: // bootstrap. pypa. io/ez_setup.py
  2. Pythonez_setup.py
Of course, you can also download the setuptool source code, decompress it, compile and install it.

2. Install pip

[Plain] view plaincopy
  1. Wget -- no-check-certificatehttp: // pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz
  2. Tarzxfpip-1.0.2.tar.gz
  3. Cdpip-1.0.2
  4. Pythonsetup. pyinstall
3. Install virtualenv
[Plain] view plaincopy
  1. Pipinstallvirtualenv

4. Create a virtual environment and activate
[Plain] view plaincopy
  1. Virtualenvpydj14
  2. Sourcepydj14/bin/activate
5. Install mysql
[Plain] view plaincopy
  1. Wgethttp: // dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-5.5.17-1.linux2.6.x86_64.tar
  2. Tar-xfMySQL-5.5.17-1.linux2.6.x86_64.tar
  3. Yumerasemysql-libs
  4. Rpm-ivhMySQL-server-5.5.17-1.linux2.6.x86_64.rpm
  5. Rpm-ivhMySQL-devel-5.5.17-1.linux2.6.x86_64.rpm (install devel to have mysql_config file, otherwise MySQL-python error cannot find this file)
  6. Rpm-ivhMySQL-client-5.5.17-1.linux2.6.x86_64.rpm (optional)
  7. Chown-Rmysql: mysql/var/lib/mysql
  8. /Etc/init. d/mysqlstart start
  9. Mysqladmin-urootpassword 'ppp'
  10. /Usr/bin/mysqladmin-uroot-pshutdown disabled

Boot start options:
[Plain] view plaincopy
  1. /Sbin/chkconfig -- addmysql
Database directory/var/lib/mysql/
Configuration File/usr/share/mysql
Related commands/usr/bin (mysqladmin mysqldump and other commands)

Start script/etc/rc. d/init. d/

6. Install the django Development Environment

[Plain] view plaincopy
  1. Pipinstallsouth
  2. Pipinstall -- downloadMySQL-python unzip the package and modify setup_posix.py to change the mysql_config path to/usr/bin/mysql_config
  3. Pipinstallpython-memcached
  4. Pipinstalldjango = 1.4.5
  5. Pipinstalluwsgi
7. Install libevent
[Plain] view plaincopy
  1. Yuminstallgcc
  2. Yuminstallgcc-c ++ libstdc ++-devel
  3. Yuminstallzlib-devel
  4. Wgethttp: // monkey.org /~ Provos/libevent-1.4.14b-stable.tar.gz
  5. Tarzxvflibevent-1.4.14b-stable.tar.gz
  6. Cdlibevent-1.4.14b-stable
  7. ./Configure -- prefix =/usr/local/libevent/
  8. Make & makeinstall
  9. Either of the following
  10. Ln-s/usr/local/libevent/lib/libevent-1.4.so.2/lib/libevent-1.4.so.232 bit System
  11. Ln-s/usr/local/libevent/lib/libevent-1.4.so.2/lib64/libevent-1.4.so.264 bit System
8. Install memcache
[Plain] view plaincopy
  1. Wgethttp: // www.danga.com/memcached/dist/memcached-1.2.5.tar.gz
  2. Tarzxvfmemcached-1.2.5.tar.gz
  3. Cdmemcached-1.2.5
  4. ./Configure -- prefix =/usr/local/memcached/-- with-libevent =/usr/local/libevent/
  5. Make & makeinstall
  6. // Usr/local/memcached/bin/memcached-d-m64-uroot-l127.0.0.1-p11211-c128-P/tmp/memcached. pid
9. Install nginx
[Plain] view plaincopy
  1. Wgethttp: // response
  2. Rpm-ivhnginx-release-centos-6-0.el6.ngx.noarch.rpm
  3. Yuminstallnginx
  4. Modify Firewall
  5. Vi/etc/sysconfig/iptables
  6. -AINPUT-mstate -- stateNEW-mtcp-ptcp -- dport80-jACCEPT
  7. Serviceiptablesrestart
Configuration Directory:/etc/nginx/
PID Directory:/var/run/nginx. pid
Error log:/var/log/nginx/error. log
Access log:/var/log/nginx/access. log
Default Site Directory:/usr/share/nginx/html
Start nginx: nginx
Restart nginx: killall-HUP nginx
Test nginx configuration: nginx-t

10. Install git

[Plain] view plaincopy
  1. Yum-yinstallzlib-developenssl-develperlcpioexpat-develgettext-devel
  2. Yuminstallautoconf
  3. Yuminstallgit
11. Install BeyondCompare
Http://www.scootersoftware.com/download.php download rpmpackage Installation

12. Configure bc3 in git

[Plain] view plaincopy
  1. [Color]
  2. Ui = true
  3. [Core]
  4. Editor = vim
  5. [Diff]
  6. Tool = bc3
  7. [Difftool "bc3"]
  8. Cmd = bcompare $ LOCAL $ REMOTE
  9. [Difftool]
  10. Prompt = false
13. Python web development environment
Download JDK 7rpm and install the rpm command

Download eclipse and decompress the video to the/usr/local directory. Configure the desktop startup icon as follows:

Note that jdk and eclipse versions, eclipse4.3, and jdk1.6 can be used in the past (jdk 1.6 is recommended to install eclipse 3.3 -- 3.7). jdk and later are required from eclipse4.4.

Note that jdk and eclipse have the same number of digits. It is best to use 64-bit and 32-bit as the operating system. The installation command above shows that this article is centos6.4 64-bit

Add the eclipse startup icon to the desktop (this icon does not appear on the desktop after centos6.4 is added, but is only placed in the desktop backup option. Manually click the upper left corner to apply it, find eclipse, right-click it, and add it to the desktop)

[Plain] view plaincopy
  1. Vim/usr/share/applications/eclipse. desktop
  2. Enter the following
  3. [Define topentry]
  4. Encoding = UTF-8
  5. Name = Eclipse
  6. Comment = EclipseIDE
  7. Exec =/usr/local/eclipse
  8. Icon =/usr/local/eclipse/icon. xpm
  9. Terminal = false
  10. Type = Application
  11. Categories = GNOME; Application; Development;
  12. StartupNotify = true

Install pydev

Download the source code package and decompress it to the eclipse dropins directory or install it online (eclipse online installation may fail in versions earlier than 3.7). skip this step.

You only need to pay attention to pydev2.X jdk1.6 or above, but 1.8 is a small problem. Pydev3 must be later than jdk1.7.

For mysql configuration, nginx configuration, and memcache configuration, Baidu Google.

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.