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
- Wget -- no-check-certificatehttps: // bootstrap. pypa. io/ez_setup.py
- 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
- Wget -- no-check-certificatehttp: // pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz
- Tarzxfpip-1.0.2.tar.gz
- Cdpip-1.0.2
- Pythonsetup. pyinstall
3. Install virtualenv
[Plain] view plaincopy
- Pipinstallvirtualenv
4. Create a virtual environment and activate
[Plain] view plaincopy
- Virtualenvpydj14
- Sourcepydj14/bin/activate
5. Install mysql
[Plain] view plaincopy
- Wgethttp: // dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-5.5.17-1.linux2.6.x86_64.tar
- Tar-xfMySQL-5.5.17-1.linux2.6.x86_64.tar
- Yumerasemysql-libs
- Rpm-ivhMySQL-server-5.5.17-1.linux2.6.x86_64.rpm
- 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)
- Rpm-ivhMySQL-client-5.5.17-1.linux2.6.x86_64.rpm (optional)
- Chown-Rmysql: mysql/var/lib/mysql
- /Etc/init. d/mysqlstart start
- Mysqladmin-urootpassword 'ppp'
- /Usr/bin/mysqladmin-uroot-pshutdown disabled
Boot start options:
[Plain] view plaincopy
- /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
- Pipinstallsouth
- Pipinstall -- downloadMySQL-python unzip the package and modify setup_posix.py to change the mysql_config path to/usr/bin/mysql_config
- Pipinstallpython-memcached
- Pipinstalldjango = 1.4.5
- Pipinstalluwsgi
7. Install libevent
[Plain] view plaincopy
- Yuminstallgcc
- Yuminstallgcc-c ++ libstdc ++-devel
- Yuminstallzlib-devel
- Wgethttp: // monkey.org /~ Provos/libevent-1.4.14b-stable.tar.gz
- Tarzxvflibevent-1.4.14b-stable.tar.gz
- Cdlibevent-1.4.14b-stable
- ./Configure -- prefix =/usr/local/libevent/
- Make & makeinstall
- Either of the following
- Ln-s/usr/local/libevent/lib/libevent-1.4.so.2/lib/libevent-1.4.so.232 bit System
- 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
- Wgethttp: // www.danga.com/memcached/dist/memcached-1.2.5.tar.gz
- Tarzxvfmemcached-1.2.5.tar.gz
- Cdmemcached-1.2.5
- ./Configure -- prefix =/usr/local/memcached/-- with-libevent =/usr/local/libevent/
- Make & makeinstall
- // Usr/local/memcached/bin/memcached-d-m64-uroot-l127.0.0.1-p11211-c128-P/tmp/memcached. pid
9. Install nginx
[Plain] view plaincopy
- Wgethttp: // response
- Rpm-ivhnginx-release-centos-6-0.el6.ngx.noarch.rpm
- Yuminstallnginx
- Modify Firewall
- Vi/etc/sysconfig/iptables
- -AINPUT-mstate -- stateNEW-mtcp-ptcp -- dport80-jACCEPT
- 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-t10. Install git
[Plain] view plaincopy
- Yum-yinstallzlib-developenssl-develperlcpioexpat-develgettext-devel
- Yuminstallautoconf
- Yuminstallgit
11. Install BeyondCompare
Http://www.scootersoftware.com/download.php download rpmpackage Installation12. Configure bc3 in git
[Plain] view plaincopy
- [Color]
- Ui = true
- [Core]
- Editor = vim
- [Diff]
- Tool = bc3
- [Difftool "bc3"]
- Cmd = bcompare $ LOCAL $ REMOTE
- [Difftool]
- 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
- Vim/usr/share/applications/eclipse. desktop
- Enter the following
- [Define topentry]
- Encoding = UTF-8
- Name = Eclipse
- Comment = EclipseIDE
- Exec =/usr/local/eclipse
- Icon =/usr/local/eclipse/icon. xpm
- Terminal = false
- Type = Application
- Categories = GNOME; Application; Development;
- 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.