经过好几天的折腾,终于安装上了reviewboard。安装环境ubuntu14.04。
reviewboard linux下安装帮助文档如下:
Installing on Linux
Creating a Review Board Site

备注:reviewboard上推荐使用mod_wsgi,以下是其原文摘要。

We recommend mod_wsgi and memcached

If you’re using Apache, we highly recommend using mod_wsgi. fastcgi
has been known to have several issues (including memory leaks and
problems when using the LDAP authentication backend), and mod_python
is no longer developed or shipped with Apache.

We also strongly recommend installing and using memcached. This will
greatly improve performance of your Review Board installation. If
possible, put this on a server with a lot of RAM.

具体安装可以参见Installing on Linux ,以下是简明安装摘要(请用root权限运行或者增加sudo):
1、安装mysql和Database Bindings

apt-get install -y mysql-server python-mysqldb

MySQL5.7并配置用户名密码的详解见https://blog.csdn.net/Liuqz2009/article/details/87721506

2、安装apache2和mod_wsgi

apt-get install -y apache2 libapache2-mod-wsgi

3、安装pip

apt install python-pip

Installing Pip and Setuptools

Before you begin, you’ll need up-to-date versions of pip and Python setuptools. Most Linux distributions have this available by default, but you can also install them if needed thorugh your package repository.

See the pip installation instructions for details on how to install pip.

Once installed, make sure you have the very latest versions of pip and setuptools available:

$ pip install -U pip setuptools

Installing Required Dependencies

You will need to install a handful of dependencies required by Review Board. Some of these are required to install Review Board’s dependencies, and some are required at runtime.

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

$ apt-get install build-essential python-dev libffi-dev libssl-dev patch

To install on a RedHat Enterprise, Fedora, CentOS, or another RedHat-based distribution, type:

$ yum install gcc python-devel libffi-devel openssl-devel patch

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 Enterprise, Fedora or CentOS, type:

$ yum install memcached

python-memcached

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

$ pip install python-memcached

Installing Review Board

To install Review Board and its required dependencies in one go, type:

$ pip install ReviewBoard

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

Installing Database Bindings

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

MySQL

To install, type:

$ pip install -U mysql-python

Distributions may provide native packages. You may also need to install a mysql development package first.

To install on Debian or Ubuntu, type:

$ apt-get install python-mysqldb

And install

$ apt-get install libmysqlclient-dev

PostgreSQL

To install, type:

$ pip install -U 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 Enterprise, Fedora 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 https://www.git-scm.com/.

Mercurial

To install support for Mercurial, type:

$ pip install -U 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:

$ pip install p4python

Subversion

To use Review Board with Subversion, you’ll need both subversion and PySVN installed. In the event that PySVN cannot be installed, subvertpy may be used as an alternative, but we recommend PySVN for the best compatibility.
PySVN

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 if you do not wish to add the EPEL repository. To install Subversion, type:

$ yum install subversion

To install PySVN from EPEL, add its repository, then type:

$ yum --enablerepo=epel install 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.
subvertpy

Note

subvertpy is only needed if you cannot install PySVN. We strongly recommend using PySVN for the best Subversion compatibility.

To install on Debian or Ubuntu, type:

$ apt-get install python-subvertpy

To install on Fedora, type:

$ yum install python-subvertpy

On RedHat Enterprise and CentOS, you may have to install subvertpy from scratch if you do not wish to add the EPEL repository. To install PySVN from EPEL, add its repository, then type:

$ yum --enablerepo=epel install python-subvertpy

If your distribution doesn’t provide subvertpy, you can install it by installing the development packages for Python and subversion, and then the package itself via pip, by typing:

$ pip install -U subvertpy

Installing Amazon S3 Support (optional)

This is an optional step.

Review Board can use Amazon S3 to store uploaded screenshots. To install this, you will need the django-storages module. Type:

$ pip install -U django-storages

After you’ve installed Review Board and created your site, you will need to configure this. See the File Storage Settings documentation for more information.
Installing OpenStack Swift Support (optional)

This is an optional step.

Review Board can use OpenStack Swift to store uploaded screenshots. To install this, you will need the django-storage-swift module. Type:

$ pip install -U django-storage-swift

After you’ve installed Review Board and created your site, you will need to configure this. See the File Storage Settings documentation for more information.
After Installation

Once you’ve finished getting Review Board itself installed, you’ll want to create your site. See Creating a Review Board Site for details.


3、安装Setuptools和Python Development Headers

apt-get install -y python-setuptools python-dev;

4、安装memcached和python-memcached Python bindings

apt-get install -y memcached
easy_install python-memcached

5、安装patch

apt-get install -y patch

6、安装Review Board

easy_install ReviewBoard

7、安装svn和 python-svn

apt-get install -y subversion python-svn
##(备份用,用python-svn就可以了,不要安装) apt-get install python-subvertpy

8、配置mysql


如果出问题,重启数据库。
Ubuntu下service mysql restart 才有效, 
/etc/init.d/mysql restart 和 mysqladmin shutdown 没啥效果

创建数据库、数据库用户for ReviewBoard(这块要注意数据库的字符集设置,默认是UTF-8,官网上有配置utf8,我们这里配置下my.cnf这个文件)

[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8

创建和配置数据库

mysql -u root -p  /* 用root用户登录 */
mysql> create database reviewboard;
Query OK, 1 row affected (0.00 sec)
mysql> create user 'reviewboard'@'localhost' identified by 'reviewboard';  /* 前一个reviewboard是访问数据库的用户名,后一个reviewboard是密码 */
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on reviewboard.* to 'reviewboard'@'localhost';  /* 前一个reviewboard是数据库的名字,而后一个reviewboard则是访问数据库的用户名 */
Query OK, 0 rows affected (0.00 sec)
mysql> exit

9、创建你的reviewboard站点

rb-site install /var/www/reviewboard   /* 之后会有一系列类似安装向导的步骤,需要你做出选择,尽量选择默认值吧 */

Domain = localhost
Root Path = /
Database Type = mysql
Database server = localhost
Database username = ‘reviewboard’
Database password = ‘reviewboard’
Cache Type = memcache
Memcache Server = memcached://localhost:11211/
Webserver = apache

10、配置站点,启动Apache2

/* 让webserver拥有对uploaded目录的修改权限 */
chown -R www-data /var/www/reviewboard/htdocs/media/uploaded 
chown -R www-data /var/www/reviewboard/data
chown -R www-data /var/www/reviewboard/htdocs/static/ext
chown -R www-data /var/www/reviewboard/htdocs/media/ext

cd /etc/apache2/sites-available
cp /var/www/reviewboard/conf/apache-wsgi.conf reviewboard.conf
cd ../sites-enabled
ln -s ../sites-available/reviewboard.conf .

a2ensite reviewboard
/etc/init.d/apache2 restart

在你的浏览器里敲入:http://localhost:80,ReviewBoard的登录界面就会出现在你的面前。

后记:
创建rb site的时候要把Domain指定成你的dns name 或者ip,否则无法从外部访问。
如果你的apahcer server host不是固定IP,那么在ip变化之后,
需要修改/etc/apache2/sites-enabled目录下的站点文件,把ip手动更新为新的ip。
需要修改/var/www/reviewboard/conf下面的apache-wsgi.conf。
需要修改/var/www/reviewboard/conf下面的settings_local.py,替换其中的ip。rm settings_local.pyc,重新编译生成该pyc文件。
编译脚本如下:


import compileall
compileall.compile_dir(r'/var/www/reviewboard/conf')

【补充】2019-2-20
1、ip地址无法访问
(1)修改文件/var/www/review_board/conf/settings_local.py,

在ALLOWED_HOSTS中加入本机IP,否则访问时会报bad request (400)错误

ALLOWED_HOSTS = ['localhost', '192.168.127.134']

测试无需上面的编译也能生效
(2)修改/var/www/reviewboard/conf下面的apache-wsgi.conf和
/etc/apache2/sites-available/reviewboard.conf文件中ip地址:

ServerName 192.168.1.60

ServerName后面的值改成自己需要的地址

2、端口更改到8080
(1)apach2中修改ports.conf文件,在其中加入
Listen 80下添加这样一行

Listen 8080

(2)修改/var/www/reviewboard/conf下面的apache-wsgi.conf和
/etc/apache2/sites-available/reviewboard.conf文件中端口号:

<VirtualHost *:80>

改成

<VirtualHost *:8080>

【补充END】

出现问题解决手段及方法(打开调试模式):

更改/www_rb/conf/settings_local.py文件,将DEBUG = False改为DEBUG = True。这样就可以在报500错误时得到错误信息

一个配置参考:

# Site-specific configuration settings for Review Board
# Definitions of these settings can be found at
# http://docs.djangoproject.com/en/dev/ref/settings/

# Database configuration
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'reviewboard',
        'USER': 'reviewboard',
        'PASSWORD': 'reviewboard',
        'HOST': 'localhost',
        'PORT': '',
    },
}

# Unique secret key. Don't share this with anybody.
SECRET_KEY = '@8ja(9f7gqb%ik0iad(e_=6lxn30%=@5q%8who2=f@eqb@)@!!'

# Cache backend settings.
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '172.21.6.251:11211',
    },
}

# Extra site information.
SITE_ID = 1
SITE_ROOT = '/'
FORCE_SCRIPT_NAME = ''
DEBUG = True
ALLOWED_HOSTS = ['172.21.6.251']

在这里插入图片描述在这里插入图片描述在这里插入图片描述

Logo

更多推荐