Preconditions:
1. Red Hat Enterprise Linux Server release 5.7 (Tikanga)
STEPs:
1. install gcc, g++ if not
a) Suggest you copy rpm packages from cd-rom:
mount /mnt/cdrom /mount/media/
then, copying and installing these files by order.
2. install or upgrade python:
wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
mv /usr/bin/python /usr/bin/python_old
ln -s /usr/local/python27/bin/python /usr/bin/
3. Set remi sources for RedHat:
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpmvi /etc/yum.repos.d/epel.repoenabled=1rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-5.rpmvi /etc/yum.repos.d/remi.repo#modity enabled to 1enabled=1#remove the old yumrpm -aq|grep yum|xargs rpm -e --nodeps# download or copy yum packageswget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpmwget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpmwget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpmwget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpmthen:yum clean Allyum makecacheyum install mysql mysql-serverservice mysqld start/stop/restartmysqladmin -u root password 'new-password'create database test2 default character set utf8 collate utf8_general_ci;# install mysql-python1.2.5,documents http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/1. yum install python-devel mysql-devel zlib-devel openssl-devel2. python setup.py build #Mysql-python source code buildpython setup.py install#install zmq, zmq-python./configure, make , make check, make installeasy_install pyzmq#install pycurl, curlwget http://curl.haxx.se/download/curl-7.24.0.tar.gz./configure, make, make installpyCurl:python setup.py build, install
#install djangopython setup.py install# python manage.py runserve 0.0.0.0:8000 # developing environment############# apache & mod_wsgi ######################download apache source code: http://mirror.bit.edu.cn/apache/httpd/apr, apr-util: http://mirror.bit.edu.cn/apache/apr/pcre: http://ftp.exim.llorien.org/pcre/
install arptar -zxf apr-1.5.0.tar.gz cd apr-1.5.0 ./configure --prefix=/usr/local/apr make sudo make install
apr-utiltar –zxvf apr-util-1.5.3.tar.gz cd apr-util-1.5.3 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-configmake sudo make install
pcreunzip –o pcre-8.34.zip cd pcre-8.34./configure --prefix=/usr/local/pcremakesudo make install
Apachetar –zxvf httpd-2.4.7.tar.gz cd httpd-2.4.7./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcremakesudo make installstart Apache,/usr/local/apache2/bin/apachel start#install mod_wsgi:./configure --with-apxs=/usr/local/apache2/bin/apxs --with-python=/usr/bin/pythonmake && make installchmod 755 /usr/local/apache2/modules/mod_wsgi.so
###### config apache ####################Listening: 8000LoadModule wsgi_module modules/mod_wsgi.so
ServerName:192.168.1.23:8000
vi /usr/local/apache/conf/extra/httpd-vhosts.conf
Modify wsgi.py
Check the httpd pid