linux+nginx+python+django环境配置
Django是一个开放源代码的Web应用框架,由Python写成,它最初是被开发来用于管理劳伦斯出版集团旗下的一些以新闻内容为主的网站的。python+django也是web开发者最受欢迎的框架.今天记录下整个搭建开发环境的过程.(说明下环境的系统为 centos 5.2)
一:更新yum仓库(目前这个yum源是最快的)
[root@filerserver python]#cd /etc/yum.repos.d
[root@filerserver python]#mv CentOS-Base.repo CentOS-Base.repo.save
[root@filerserver python]#wget http://centos.ustc.edu.cn/CentOS-Base.repo.5
[root@filerserver python]#mv CentOS-Base.repo.5 CentOS-Base.repo
二:安装部分的开发包和更新
[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 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
三:安装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
四:安装MySQL客户端
[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-assembler \
--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
五:安装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]#cd memcached-1.2.6/
[root@filerserver python]#./configure --prefix=/usr/local/memcached --enable-threads
[root@filerserver python]#make
[root@filerserver python]#make 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
七:安装django
[root@filerserver python]#cd /usr/local/src
[root@filerserver python]#svn co http://code.djangoproject.com/svn/django/trunk django-trunk #直接重django的SVN拿最新稳定安装包
[root@filerserver python]#cd django-trunk
[root@filerserver python]#python setup.py 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
九:安装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
十:安装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
十一:安装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
十二:安装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 Imaging-1.1.6
[root@filerserver python]#python setup.py 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
十四:安装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
十五:安装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