博客园  :: 首页  :: 联系 :: 订阅 订阅  :: 管理

ReviewBoard安装记录(CentOS5)

Posted on 2013-04-27 18:00  Bruce Zhang  阅读(2760)  评论(0编辑  收藏  举报

官方文档参照:http://www.reviewboard.org/docs/manual/1.7/admin/installation/linux/

Before You Begin

Review Board is provided as downloadable packages through Python setuptools. The easy part is installing Review Board itself. The harder part is installing some of the dependencies, which we have less control over. This guide will help with some of these dependencies.

大致是讲:ReviewBoard本身安装很容易,但是安装依赖模块比较麻烦。

It’s assumed that you know which database and web server you want to use, and have already installed these on your server. It’s also assumed that you have Python v2.x (2.5 or newer) installed.

CentOS默认是安装的是 Python2.4.3:

$ python -V
Python 2.4.3

所以需要在安装一个更高版本的Python,我选择的Python2.7:$ yum install gcc

$ cd /usr/local/src
$ wget http://python.org/ftp/python/2.7.4/Python-2.7.4.tgz
$ tar -zxvf Python-2.7.4.tgz
$ cd Python-2.7.4
$ ./configure --with-threads --enable-shared --enable-universalsdk --with-ssl
$ make && make install
备注:“--enable-shared”,必须加。保证python会创建共享库(shared library),否则只会创建静态库(static library)
备注:“--enable-universalsdk”,必须加,以保证python会被编译成64位,因为后面将要安装的mod_python和mod_wsgi需要python的64位共享库。
备注: “--with-ssl”,必须加。后面使用“
easy_install ReviewBoard”安装review board是需要从https下载资源。
$ echo '/usr/local/lib' > /etc/ld.so.conf.d/python2.7.conf (解决libpython2.7.so.1.0动态库加载失败问题
$ ldconfig
$ /usr/local/bin/python -V
Python 2.7.4
$ ls -lst /usr/local/bin/python*
4 lrwxrwxrwx 1 root root    7 Apr 27 23:34 /usr/local/bin/python -> python2
4 lrwxrwxrwx 1 root root 9 Apr 27 23:34 /usr/local/bin/python2 -> python2.7
4 lrwxrwxrwx 1 root root 16 Apr 27 23:34 /usr/local/bin/python2-config -> python2.7-config
4 lrwxrwxrwx 1 root root 14 Apr 27 23:34 /usr/local/bin/python-config -> python2-config
8 -rwxr-xr-x 1 root root 1674 Apr 27 23:34 /usr/local/bin/python2.7-config
16 -rwxr-xr-x 1 root root 10166 Apr 27 23:30 /usr/local/bin/python2.7
$
mv /usr/bin/python /usr/bin/python.bak (备份一下)
$ ln -s /usr/local/bin/python /usr/bin/python
$ cd ~
$ python -V
Python 2.7.4
$ vi /usr/bin/yum (将第一行由“#!/usr/bin/python”修改成“#!/usr/bin/python2.4”)
--------------------------------至此,Python 2.7.4 安装完毕-----------------------------------------------           

相关问题我在安装Submin2的时候也遇到过,参照:http://www.cnblogs.com/zhangqingsh/archive/2012/12/14/2818535.html

Review Board supports the following database servers:

我用的是Mysql:

yum install mysql mysql-server mysql-devel

And the following web servers:

  • Apache + mod_wsgi, fastcgi, or mod_python (这里的or是什么意思?fastcgi和mod_python二选一?)
  • lighttpd + fastcgi
我选择的是 Apache + mod_wsgi + mod_python
$ yum install httpd httpd-devel
备注:httpd-devel必须要安装,后面的mod_pyghon,mod_wsgi都需要基于apxs
--------------------------------------至此,apache安装完毕--------------------------------------------------
$ cd /usr/local/src $ wget http://archive.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz $ tar -zxvf mod_python-3.3.1.tgz $ cd mod_python-3.3.1 $ ./configure $ make && make install 备注:mod_python.so的详细路径是:/usr/local/src/mod_python-3.3.1/src/.libs/mod_python.so,该文件会被自动拷贝到/usr/lib64/httpd/modules下,即/etc/httpd/modules -------------------------------------至此,mod_python 3.3.1 安装完毕---------------------------------------- $ cd /usr/local/src $ wget http://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz $ tar -zxvf mod_wsgi-3.4.tar.gz $ cd mod_wsgi-3.4 $ ./configure $ make && make install 备注:mod_wsgi.so会被拷贝到/usr/lib64/httpd/modules/,即/etc/httpd/modules。 -----------------------------------至此,mod_wsgi 3.4 安装完毕-----------------------------------------------

 

If you’re running Fedora, you may need to add the Fedora Extras repository to your yum configuration.

The instructions below are assuming you’re logged in as root or are using sudo.

Installing Python Setuptools

Before you begin, you’ll need Python setuptools version 0.6c9 or higher. Most Linux distributions have this packaged and available for installation.

To install on DebianUbuntu, or another Debian-based distribution, type:

$ apt-get install python-setuptools

To install on Fedora 8 and above, type:

$ yum install -y python-setuptools-devel.noarch

To install on a RedHat EnterpriseCentOSFedora 7 and earlier, or another RedHat-based distribution, type:

$ yum install python-setuptools
备注:CentosOS中python-setuptools的默认版本低于0.6c9,所以需要升级。
针对Python2.7,安装对应python-setuptools,参照:https://pypi.python.org/pypi/setuptools
$ yum install zlib zlib-devel
重新源码编译/安装python
不过,./configure xxxx后,需要vi Modules/Setup,取消如下代码的注释:
  #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz 
否则setuptools执行时,会报如下错误:
  Traceback (most recent call last):  
    File "<string>", line 1, in <module> 
    zipimport.ZipImportError: can't decompress data; zlib not available  
$ wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea
$ chomod +x
setuptools-0.6c11-py2.7.egg
$ ./setuptools-0.6c11-py2.7.egg
$ ldconfig

Users of other distributions should check with their distribution for native packages, or follow the setuptools installation instructions.

If the version of setuptools available for your distribution is older than 0.6c9, you’ll need to install it first, and then upgrade it to the latest version by running:

$ easy_install -U setuptools

Installing Python Development Headers

You will need to install the Python development headers for your distribution.

To install on DebianUbuntu, or another Debian-based distribution, type:

$ apt-get install python-dev

To install on a RedHat EnterpriseFedoraCentOS, or another RedHat-based distribution, type:

$ yum install python-devel
备注:使用源码安装Python的话,不需要安装python-devel。而且,python27-devel的RPM很难找,就像python27本身一样。

Installing memcached

Memcached

Memcached is a high-performance caching server used by Review Board. While optional, it’s strongly recommended in order to have a fast, responsive server. Along with memcached, we need the python-memcached Python bindings.

To install on Debian or Ubuntu, type:

$ apt-get install memcached

To install on RedHat EnterpriseFedora or CentOS, type:

$ yum install memcached
备注:我使用的是CentOS,所以就用这个了。

python-memcached

You’ll need to install python-memcached. You can install this by typing:

$ easy_install python-memcached

Installing patch

patch is required for Review Board’s diff viewer to work. All distributions should provide this.

To install on Debian or Ubuntu, type:

$ apt-get install patch

To install on RedHat EnterpriseFedora or CentOS, type:

$ yum install patch
备注:我使用的是CentOS,所以就用这个了。

Installing Review Board

To install Review Board and its required dependencies (Djblets, Django-EvolutionDjangoflupparamiko and Python Imaging Library) in one go, type:

$ easy_install ReviewBoard
easy_install ReviewBoard运行日志
$ easy_install ReviewBoard
Searching for ReviewBoard
Best match: ReviewBoard 1.7.7.1
Processing ReviewBoard-1.7.7.1-py2.7.egg
ReviewBoard 1.7.7.1 is already the active version in easy-install.pth
Installing rb-site script to /usr/local/bin
Installing rbssh script to /usr/local/bin

Using /usr/local/lib/python2.7/site-packages/ReviewBoard-1.7.7.1-py2.7.egg
Processing dependencies for ReviewBoard
Searching for Django>=1.4.5,<1.5
Reading http://downloads.reviewboard.org/mirror/
Reading http://downloads.reviewboard.org/releases/ReviewBoard/1.7/
Reading http://pypi.python.org/simple/Django/
Reading http://www.djangoproject.com/
Reading http://www.djangoproject.com/m/bad-installer.txt
Best match: Django 1.4.5
Downloading https://www.djangoproject.com/m/releases/1.4/Django-1.4.5.tar.gz
Processing Django-1.4.5.tar.gz
Running Django-1.4.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-kfe8eJ/Django-1.4.5/egg-dist-tmp-wDcA93
zip_safe flag not set; analyzing archive contents...
django.template.loaders.app_directories: module references __file__
django.test._doctest: module references __file__
django.test._doctest: module MAY be using inspect.getsourcefile
django.db.utils: module references __file__
django.db.models.loading: module references __file__
django.contrib.formtools.tests.__init__: module references __file__
django.contrib.formtools.tests.wizard.namedwizardtests.tests: module references __file__
django.contrib.formtools.tests.wizard.wizardtests.tests: module references __file__
django.contrib.admindocs.views: module references __file__
django.contrib.auth.tests.context_processors: module references __file__
django.contrib.auth.tests.views: module references __file__
django.contrib.auth.tests.forms: module references __file__
django.contrib.gis.geometry.test_data: module references __file__
django.contrib.gis.tests.geo3d.tests: module references __file__
django.contrib.gis.tests.layermap.tests: module references __file__
django.contrib.gis.tests.geogapp.tests: module references __file__
django.contrib.flatpages.tests.middleware: module references __file__
django.contrib.flatpages.tests.csrf: module references __file__
django.contrib.flatpages.tests.templatetags: module references __file__
django.contrib.flatpages.tests.views: module references __file__
django.contrib.staticfiles.storage: module references __file__
django.contrib.sitemaps.tests.base: module references __file__
django.utils.autoreload: module references __file__
django.utils.version: module references __path__
django.utils.module_loading: module references __path__
django.utils.unittest.loader: module references __file__
django.utils.unittest.collector: module references __file__
django.utils.translation.__init__: module references __file__
django.utils.translation.trans_real: module references __file__
django.core.servers.basehttp: module references __path__
django.core.management.__init__: module references __file__
django.core.management.__init__: module references __path__
django.core.management.templates: module references __path__
django.core.management.sql: module references __file__
django.core.management.commands.makemessages: module references __file__
django.core.management.commands.loaddata: module references __file__
django.core.management.commands.loaddata: module references __path__
django.views.i18n: module references __file__
Adding Django 1.4.5 to easy-install.pth file
Installing django-admin.py script to /usr/local/bin

Installed /usr/local/lib/python2.7/site-packages/Django-1.4.5-py2.7.egg
Searching for pycrypto>=2.1,!=2.4
Reading http://pypi.python.org/simple/pycrypto/
Reading http://pycrypto.sourceforge.net
Download error: [Errno 110] Connection timed out -- Some packages may not be found!
Reading http://www.pycrypto.org/
Reading http://www.amk.ca/python/code/crypto
Best match: pycrypto 2.6
Downloading http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.tar.gz
Processing pycrypto-2.6.tar.gz
Running pycrypto-2.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ABqPHC/pycrypto-2.6/egg-dist-tmp-KXArbz
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
zip_safe flag not set; analyzing archive contents...
Adding pycrypto 2.6 to easy-install.pth file

Installed /usr/local/lib/python2.7/site-packages/pycrypto-2.6-py2.7-linux-x86_64.egg
Searching for PIL
Reading http://pypi.python.org/simple/PIL/
Reading http://www.pythonware.com/products/pil
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://effbot.org/downloads/#Imaging
Best match: PIL 1.1.7
Downloading http://effbot.org/media/downloads/PIL-1.1.7.tar.gz
Processing PIL-1.1.7.tar.gz
Running PIL-1.1.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-0snMMO/PIL-1.1.7/egg-dist-tmp-rD8tsn
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
_imaging.c:3017: warning: initialization from incompatible pointer type
_imaging.c:3077: warning: initialization from incompatible pointer type
libImaging/Quant.c: In function 鈥榬ehash_collide鈥?
libImaging/Quant.c:154: warning: cast to pointer from integer of different size
/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.7.4 (default, Apr 28 2013, 19:29:45)
              [GCC 4.1.2 20080704 (Red Hat 4.1.2-54)]
--------------------------------------------------------------------
*** TKINTER support not available
*** JPEG support not available
--- ZLIB (PNG/ZIP) support available
*** FREETYPE2 support not available
*** LITTLECMS support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

To check the build, run the selftest.py script.
zip_safe flag not set; analyzing archive contents...
Image: module references __file__
Adding PIL 1.1.7 to easy-install.pth file
Installing pilfile.py script to /usr/local/bin
Installing pilprint.py script to /usr/local/bin
Installing pilconvert.py script to /usr/local/bin
Installing pilfont.py script to /usr/local/bin
Installing pildriver.py script to /usr/local/bin

Installed /usr/local/lib/python2.7/site-packages/PIL-1.1.7-py2.7-linux-x86_64.egg
Searching for feedparser>=5.1.2
Reading http://pypi.python.org/simple/feedparser/
Reading https://code.google.com/p/feedparser/
Reading http://code.google.com/p/feedparser/
Best match: feedparser 5.1.3
Downloading http://feedparser.googlecode.com/files/feedparser-5.1.3.zip
Processing feedparser-5.1.3.zip
Running feedparser-5.1.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-sjcR5G/feedparser-5.1.3/egg-dist-tmp-6swO8d
zip_safe flag not set; analyzing archive contents...
Adding feedparser 5.1.3 to easy-install.pth file

Installed /usr/local/lib/python2.7/site-packages/feedparser-5.1.3-py2.7.egg
Finished processing dependencies for ReviewBoard

 

This will automatically download and install the latest stable release of Review Board and the required versions of its core dependencies.

If you want to install an in-development release, see Installing Development Releases.


Installing Database Bindings


Depending on the database you plan to use, you will probably need additional bindings.

MySQL

To install, type:

$ easy_install mysql-python

Distributions may provide native packages.

To install on Debian or Ubuntu, type:

$ apt-get install python-mysqldb

PostgreSQL

To install, type:

$ easy_install psycopg2

Installing Source Control Components

Depending on which source control systems you plan to use, you will need some additional components.

CVS

To use Review Board with CVS, you’ll need the cvs package installed. This is available on almost every distribution.

To install on Debian or Ubuntu, type:

$ apt-get install cvs

To install on RedHat EnterpriseFedora or CentOS, type:

$ yum install cvs

Git

To install on Debian or Ubuntu, type:

$ apt-get install git-core

To install on Fedora, type:

$ yum install git-core

If your distribution doesn’t provide Git, you’ll need to install it manually from http://www.git-scm.com/.

Mercurial

To install support for Mercurial, type:

$ easy_install mercurial

You can also check your distribution for a native package, or use one of the binary packages provided.

Perforce

To use Review Board with Perforce, you’ll first need to install p4 some place in your web server’s path (usually /usr/bin). You can download this from the Perforce downloads page.

You’ll then need to install the Python bindings by typing the following:

$ easy_install P4PythonInstaller

This should fetch the appropriate versions of the p4api library and compile it. This will require that you have standard build tools (gccmake, etc.) installed on your system.

Subversion

To use Review Board with Subversion, you’ll need both subversion and PySVN installed.

To install on Debian or Ubuntu, type:

$ apt-get install subversion python-svn

To install on Fedora, type:

$ yum install subversion pysvn

RedHat Enterprise and CentOS provide subversion, but you may have to install PySVN from scratch. To install Subversion, type:

$ rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
$ yum install subversion subverison-devel apr apr-devel apr-util apr-util-dev pysvn

If your distribution doesn’t provide PySVN, you can install it by downloading the latest release and following the instructions in the provided INSTALL.html.