Django是一个开放源代码的Web应用框架,由Python写成,它最初是被开发来用于管理劳伦斯出版集团旗下的一些以新闻内容为主的网站的。python+django也是web开发者最受欢迎的框架.今天记录下整个搭建开发环境的过程.(说明下环境的系统为centos5.5)
一:更新yum仓库(目前这个yum源是最快的)
[root@filerserverpython]#cd/etc/yum.repos.d
[root@filerserverpython]#mvCentOS-Base.repoCentOS-Base.repo.save
[root@filerserverpython]#wgethttp://centos.ustc.edu.cn/CentOS-Base.repo.5
[root@filerserverpython]#mvCentOS-Base.repo.5CentOS-Base.repo
二:安装部分的开发包和更新
[root@filerserverpython]#yumcheck-update
[root@filerserverpython]#yumupdate
[root@filerserverpython]#yuminstallntpiptrafsysstatscreensubversionwgetbzip2nfs-utilsvim-common
[root@filerserverpython]#yuminstallmakegccgcc-c++libjpeg-devellibpng-develzlib-develtcl-develfreetype-devellibevent-developenssl-develdb4-develcurl-develpcre-develncurses-develreadline-develsqlite-devel
三:安装Python
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/python/Python-2.5.4.tar.bz2
[root@filerserverpython]#tarxjvfPython-2.5.4.tar.bz2
[root@filerserverpython]#cdPython-2.5.4/
[root@filerserverpython]#./configure--enable-unicode=ucs4
[root@filerserverpython]#make
[root@filerserverpython]#makeinstall
四:安装MySQL客户端
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/mysql-5.0.45.tar.gz
[root@filerserverpython]#tarzxvfmysql-5.0.45.tar.gz
[root@filerserverpython]#cdmysql-5.0.45
[root@filerserverpython]#CFLAGS="-O3"CXX=gccCXXFLAGS="-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@filerserverpython]#make
[root@filerserverpython]#makeinstall
[root@filerserverpython]#echo"PATH=/usr/local/mysql/bin:\$PATH">>/etc/profile
[root@filerserverpython]#echo"exportPATH">>/etc/profile
[root@filerserverpython]#echo"/usr/local/mysql/lib/mysql">/etc/ld.so.conf.d/mysql.conf
[root@filerserverpython]#ldconfig
五:安装memcached
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/python/memcached-1.2.6.tar.gz
[root@filerserverpython]#tarxzvfmemcached-1.2.6.tar.gz
[root@filerserverpython]#cdmemcached-1.2.6/
[root@filerserverpython]#./configure--prefix=/usr/local/memcached--enable-threads
[root@filerserverpython]#make
[root@filerserverpython]#makeinstall
六:安装pythonsetuptools
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/python/setuptools-0.6c9.tar.gz
[root@filerserverpython]#tarxzvfsetuptools-0.6c9.tar.gz
[root@filerserverpython]#cdsetuptools-0.6c9
[root@filerserverpython]#pythonsetup.pyinstall
七:安装django
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#svncohttp://code.djangoproject.com/svn/django/trunkdjango-trunk#直接重django的SVN拿最新稳定安装包
[root@filerserverpython]#cddjango-trunk
[root@filerserverpython]#pythonsetup.pyinstall
八:安装sqlalchemy
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#svncohttp://svn.sqlalchemy.org/sqlalchemy/branches/rel_0_4
[root@filerserverpython]#cdsqlalchemy-0.4
[root@filerserverpython]#pythonsetup.pyinstall
九:安装MySQLdb
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/python/MySQL-python-1.2.2.tar.gz
[root@filerserverpython]#tarxzvfMySQL-python-1.2.2.tar.gz
[root@filerserverpython]#cdMySQL-python-1.2.2
[root@filerserverpython]#pythonsetup.pyinstall
十:安装Twisted
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/python/Twisted-8.2.0.tar.bz2
[root@filerserverpython]#tarxjvfTwisted-8.2.0.tar.bz2
[root@filerserverpython]#cdTwisted-8.2.0/
[root@filerserverpython]#pythonsetup.pyinstall
十一:安装python-memcached
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/python/python-memcached-1.44.tar.gz
[root@filerserverpython]#tarxzvfpython-memcached-1.44.tar.gz
[root@filerserverpython]#cdpython-memcached-1.44
[root@filerserverpython]#pythonsetup.pyinstall
十二:安装PIL
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/python/Imaging-1.1.6.tar.gz
[root@filerserverpython]#tarxzvfImaging-1.1.6.tar.gz
[root@filerserverpython]#cdImaging-1.1.6
[root@filerserverpython]#pythonsetup.pyinstall
十三:安装flup
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/python/flup-1.0.1.tar.gz
[root@filerserverpython]#tarxzvfflup-1.0.1.tar.gz
[root@filerserverpython]#cdflup-1.0.1
[root@filerserverpython]#pythonsetup.pyinstall
十四:安装simplejson
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/python/simplejson-2.0.9.tar.gz
[root@filerserverpython]#tarxzvfsimplejson-2.0.9.tar.gz
[root@filerserverpython]#cdsimplejson-2.0.9
[root@filerserverpython]#pythonsetup.pyinstall
十五:安装nginx
[root@filerserverpython]#cd/usr/local/src
[root@filerserverpython]#wgethttp://www.dbasky.net/tool/python/nginx-0.7.51.tar.gz
[root@filerserverpython]#tarxzvfnginx-0.7.51.tar.gz
[root@filerserverpython]#cdnginx-0.7.51
[root@filerserverpython]#./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@filerserverpython]#make
[root@filerserverpython]#makeinstall
到此这个环境搭建完成,这边说明我们为了提高架构的稳定性,可以在中间层加入个缓存数据库.