1. Install python 2.7.3
Note: Use python-V to check the version before installation. Generally, the lower version is installed.
Use
Mv/usr/bin/python/usr/bin/python24
After this modification, if the previous script uses an old version, modify /#! /Usr/bin/python #! /Usr/bin/python24
Wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
Tar zxvf Python-2.7.3.tar.bz2
Cd Python-2.7.3
Note: If you want to support other Modules, modify the./Modules/Setup. dist file and remove the # comment before the module to be added.
./Configure -- prefix =/usr/local/python27 -- enable-unicode = ucs4
Make
Make install
Ln-s/usr/local/python27/bin/python/usr/bin/python
Ln-s/usr/local/python27/bin/python2.7/usr/bin/python2.7 install the new version python2.7.3.
View python-V
2. Install easy_install to facilitate the installation of third-party extension packages
Wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
Download and install
Sh setuptools-0.6c11-py2.7.egg
After automatic installation, install it in the/usr/local/python27/bin/directory to create a soft link for ease of use.
Ln-s/usr/local/python27/bin/easy_install */usr/bin/3. Install web. py and run the easy_install command.
Easy_install web. py
[Root @ localhost Python-2.7.3] # python
Python 2.7.3 (default, Aug 31 2012, 18:37:11)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> Import web
>>>
######### If this problem occurs, you have installed web. py #################
4. Install Spawn-fcgi
Install flup before installing Spawn-fcgi.
Easy_install flupwget http://www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.bz2
Tar xvf spawn-fcgi-1.6.3.tar.bz2
Cd spawn-fcgi-1.6.3
./Configure -- prefix =/usr/local/spawn-fcgi
Make
Make install
Make a soft link
Ln-s/usr/local/spawn-fcgi/bin/spawn-fcgi/usr/bin/5wn install pcre-8.20.tar.bz2
Before installation, a problem occurs. pcre-8.30.tar.bz2is incompatible with nginx-1.2.3.tar.gz.
Tar zxvf pcre-8.20.tar.bz2
Cd pcre-8.30
./Configure
Make
Make install6. Install nginx
Yum-y pcre-devel openssl-devel install zlib-devel
Wget http://nginx.org/download/nginx-1.2.3.tar.gz
Tar zxvf nginx-1.2.3.tar.gz
Cd nginx-1.2.3
./Configure -- prefix =/usr/local/nginx -- with-pcre -- with-http_stub_status_module -- with-openssl =/usr/
Make
Make install
7. Configure nginx. confuser nobody;
Worker_processes 4; pid logs/nginx. pid;
Events {
Worker_connections 1024;
} Http {
Include mime. types;
Default_type application/octet-stream;
Sendfile on;
Keepalive_timeout 65;
Gzip on; server {
Listen 80;
Server_name localhost;
Location /{
Include fastcgi_params;
Fastcgi_param SCRIPT_FILENAME $ fastcgi_script_name;
Fastcgi_param PATH_INFO $ fastcgi_script_name;
Fastcgi_pass unix:/tmp/pyweb. sock;
Fastcgi_param SERVER_ADDR $ server_addr;
Fastcgi_param SERVER_PORT $ server_port;
Fastcgi_param SERVER_NAME $ server_name;
}
Error_page 500 502 503 x.html;
Location =/50x.html {
Root html;
}
}
}
################################# Configure nginx. conf complete ###################################### 8, test
Vi/usr/local/nginx/html/index. py
#! /Usr/bin/env python
#-*-Coding: utf8 -*-
Import web
Urls = ("/. *", "hello ")
App = web. application (urls, globals ())
Class hello:
Def GET (self ):
Return 'Hello python and web. py' if _ name _ = "_ main __":
Web. wsgi. runwsgi = lambda func, addr = None: web. wsgi. runfcgi (func, addr)
App. run ()
Log out, and grant chmod + x/usr/local/nginx/html/index. py the permission. This is the entry file to start spawn-fcgi and create a process.
Spawn-fcgi-d/usr/local/nginx/html/-f/usr/local/nginx/html/index. py-s/tmp/pyweb. sock-u nobody-g nobody (the user here should be consistent with the nginx user)
Browser access effect (:
9. Install the python mongodb driver, that is, the pymongo module.
Easy_install pymongo
Test Module
[Root @ localhost html] # python
Python 2.7.3 (default, Aug 31 2012, 18:37:11)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> Import pymongo
>>>
############### ####################### 10. Install the mongodb Database
/Usr/sbin/groupadd-g 690 mongodb
/Usr/sbin/useradd-g mongodb-u 690-s/sbin/nologin
Wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.0.tgz (my system is 64 bits)
Tar zxvf mongodb-linux-x86_64-2.0.0.tgz
Music mongodb-linux-x86_64-2.0.0/usr/local/
Ln-s/usr/local/mongodb/bin/*/bin/mkdir-p/data/db/
Chown-R mongodb. mongodb/data/db/11. Start: mongdb
Nohup mongod -- dbpath/data/db &
Mongod -- fork -- port 25000 -- auth -- dbpath/data/db/-- logpath/data/mongodb. log (it is best to place the log file in the same place as the data file. The default port is 27017, and 25000 is used here) 12. view the port
[Root @ localhost data] # netstat-ln | grep-E "25000 | 26000"
Tcp 0 0 0.0.0.0: 25000 0.0.0.0: * LISTEN
Tcp 0 0 0.0.0.0: 26000 0.0.0.0: * LISTEN
Unix 2 [ACC] stream listening 288568/tmp/mongodb-25000.sock13, login Test
[Root @ localhost data] # mongo -- host 192.168.250.109: 25000
MongoDB shell version: 2.2.0
Connecting to: 192.168.250.109: 25000/test
>
Web Management: http: // IP: 26000
Dbpath: data file storage path. Each database creates a sub-directory.
Logpath: Error Log File
Fork: run the service in the form of Daemon.
Port: the default port of the external service port is 27017. The Web Management port is + 1000 based on this port. You can use http: // IP: 26000 to manage the port.
This article from the "game technology blog" blog, please be sure to keep this source http://youzao.blog.51cto.com/3946111/987292