Build nginx + python + django + memcached + mysql + fastcgi Environment

Source: Internet
Author: User
Tags install django
Build nginx + python + django + memcached + mysql + fastcgi environment 3 Aug 2009

Author: Mike Xu published in: August 3, 2009 PM

When reprinting, be sure to mark the original source of the article in the form of a hyperlink
And author information and this copyright notice.

Link: http://www.dbasky.net/archives/2009/08/nginx-python-django-memcached-mysql-fastcgi.html

Django is an open-source Web application framework written in Python. It was initially developed to manage some websites dominated by news content under the Lawrence Publishing Group. Python + django is also the most popular framework for web developers. Today, we record the entire process of building a development environment. (The system in the environment is centos 5.2)
I. Update the yum Repository(Currently, this yum source is the fastest)

[Root @ filerserver python] # cd/etc/yum. repos. d
[Root @ filerserver python] # Music CentOS-Base.repo CentOS-Base.repo.save
[Root @ filerserver python] # wget http://centos.ustc.edu.cn/CentOS-Base.repo.5
[Root @ filerserver python] # Music CentOS-Base.repo.5 CentOS-Base.repo

Ii. install some Development kits and updates

[Root @ filerserver python] # yum check-update
[Root @ filerserver python] # yum update
[Root @ filerserver python] # yum install ntp iptraf sysstat screen subversion wget bzip2 nfs-utils vim-common
[Root @ filerserver python] # yum install make gcc-c ++ libjpeg-devel libpng-devel zlib-devel tcl-devel freetype-devel libevent-devel openssl-devel db4-devel curl- devel pcre-devel ncurses-devel readline-devel sqlite-devel

3. Install Python

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/python/Python-2.5.4.tar.bz2
[Root @ filerserver python] # tar xjvf Python-2.5.4.tar.bz2
[Root @ filerserver python] # cd Python-2.5.4/
[Root @ filerserver python] #./configure -- enable-unicode = ucs4
[Root @ filerserver python] # make
[Root @ filerserver python] # make install

4. Install the MySQL client

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/mysql-5.0.45.tar.gz
[Root @ filerserver python] # tar zxvf mysql-5.0.45.tar.gz
[Root @ filerserver python] # cd mysql-5.0.45
[Root @ filerserver python] # CFLAGS = "-O3" CXX = gcc CXXFLAGS = "-O3-felide-constructors \
-Fno-exceptions-fno-rtti "./configure \
-- Prefix =/usr/local/mysql -- enable-validator \
-- With-charset = utf8 \
-- With-extra-charsets = gbk, gb2312, latin1 \
-- Without-debug \
-- With-client-ldflags =-all-static \
-- Enable-thread-safe-client \
-- Without-server
[Root @ filerserver python] # make
[Root @ filerserver python] # make install
[Root @ filerserver python] # echo "PATH =/usr/local/mysql/bin: \ $ PATH">/etc/profile
[Root @ filerserver python] # echo "export PATH">/etc/profile
[Root @ filerserver python] # echo "/usr/local/mysql/lib/mysql">/etc/ld. so. conf. d/mysql. conf
[Root @ filerserver python] # ldconfig

5. Install memcached

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/python/memcached-1.2.6.tar.gz
[Root @ filerserver python] # tar xzvf memcached-1.2.6.tar.gz
[Root @ filerserver python] # memcached-1.2.6/cd/
[Root @ filerserver python] #./configure -- prefix =/usr/local/memcached -- enable-threads
[Root @ filerserver python] # make
[Root @ filerserver python] # make install

6. Install python setuptools

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/python/setuptools-0.6c9.tar.gz
[Root @ filerserver python] # tar xzvf setuptools-0.6c9.tar.gz
[Root @ filerserver python] # cd setuptools-0.6c9
[Root @ filerserver python] # python setup. py install

7. Install django

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # svn co http://code.djangoproject.com/svn/django/trunk django-trunk # directly re-django SVN get the latest stable installation package
[Root @ filerserver python] # cd django-trunk
[Root @ filerserver python] # python setup. py install

8. Install sqlalchemy

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # svn co http://svn.sqlalchemy.org/sqlalchemy/branches/rel_0_4

[Root @ filerserver python] # cd sqlalchemy-0.4
[Root @ filerserver python] # python setup. py install

9. Install MySQLdb

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/python/MySQL-python-1.2.2.tar.gz
[Root @ filerserver python] # tar xzvf MySQL-python-1.2.2.tar.gz
[Root @ filerserver python] # cd MySQL-python-1.2.2
[Root @ filerserver python] # python setup. py install

10. Install Twisted

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/python/Twisted-8.2.0.tar.bz2
[Root @ filerserver python] # tar xjvf Twisted-8.2.0.tar.bz2
[Root @ filerserver python] # cd Twisted-8.2.0/
[Root @ filerserver python] # python setup. py install

11. Install python-memcached

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/python/python-memcached-1.44.tar.gz
[Root @ filerserver python] # tar xzvf python-memcached-1.44.tar.gz
[Root @ filerserver python] # cd python-memcached-1.44
[Root @ filerserver python] # python setup. py install

12. Install PIL

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/python/Imaging-1.1.6.tar.gz
[Root @ filerserver python] # tar xzvf Imaging-1.1.6.tar.gz
[Root @ filerserver python] # cd image-1.1.6
[Root @ filerserver python] # python setup. py install

Thirteen: Install flup

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/python/flup-1.0.1.tar.gz
[Root @ filerserver python] # tar xzvf flup-1.0.1.tar.gz
[Root @ filerserver python] # cd flup-1.0.1
[Root @ filerserver python] # python setup. py install

14. Install simplejson

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/python/simplejson-2.0.9.tar.gz
[Root @ filerserver python] # tar xzvf simplejson-2.0.9.tar.gz
[Root @ filerserver python] # cd simplejson-2.0.9
[Root @ filerserver python] # python setup. py install

15th: Install nginx

[Root @ filerserver python] # cd/usr/local/src
[Root @ filerserver python] # wget http://www.dbasky.net/tool/python/nginx-0.7.51.tar.gz
[Root @ filerserver python] # tar xzvf nginx-0.7.51.tar.gz
[Root @ filerserver python] # cd nginx-0.7.51
[Root @ filerserver python] #./configure -- prefix =/usr/local/nginx \
-- With-md5 =/usr/lib \
-- With-sha1 =/usr/lib \
With-http_ssl_module \
With-http_stub_status_module \
Without-mail_pop3_module \
Without-mail_imap_module \
Without-mail_smtp_module \
With-http_realip_module
[Root @ filerserver python] # make
[Root @ filerserver python] # make install


This environment has been set up. To improve the stability of the architecture, we can add a cache database, TTserver, to the middle layer, for how to install and configure TTserver, refer to the previous log-"compatible with Memcached distributed persistent storage system-Tokyo
Install and configure Cabinet and Tokyo Tyrant.

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.