简单教你在Ubuntu 20.04上快速安装Review Board

Review Board是一个基于web的开源工具,它允许你在开发项目时快速审查代码。它对个人和商业使用都是免费的,被包括LinkedIn、Mozilla、Yelp和Apache软件基金会在内的数千家公司所信任。Review Board可以节省时间,因为它允许你在开发周期中审查几乎所有内容,包括文档、网站设计、美术、用户界面模型、发布公告和功能规格。Review Board具有丰富的功能,如300多种语言的语法高亮显示、更智能的缩进和移动代码检测,非常适合跟踪项目和修复bug。

更新包信息索引,升级包。

$ sudo apt update && sudo apt dist-upgrade

安装mod_wsgi库,这是一个Web服务器网关接口模块,它将用Python编写的应用程序链接到Apache Web服务器,并提供比mod_python或CGI更好的性能。

$ sudo apt install -y libapache2-mod-wsgi

安装Review Board依赖项。

$ sudo apt install -y build-essential python-dev libffi-dev libssl-dev patch python-setuptools libjpeg-dev memcached libmysqlclient-dev

创建一个Review Board数据库

MySQL为Review Board应用程序提供了出色的性能。与SQLite这样的数据库相比,它可以处理大负载和并发用户,而SQLite只能在测试环境中工作。

要创建一个稍后将链接到Review Board应用程序的数据库,请以root身份登录MySQL服务器。

$ sudo mysql -u root -p

出现提示时,输入MySQL服务器的根密码并按enter继续。

通过运行下面的命令,创建一个review_board数据库,并将UTF-8设置为文本的默认编码。

mysql> CREATE DATABASE review_board CHARACTER SET utf8;

为review_board数据库创建一个专用的review_board_user用户。在创建您的第一个Review Board站点时,您将提供该用户的凭证。出于安全目的,请使用强值替换EXAMPLE_PASSWORD。

如果你使用MySQL:

mysql> CREATE USER 'review_board_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'EXAMPLE_PASSWORD';       GRANT ALL PRIVILEGES ON review_board.* TO 'review_board_user'@'localhost';       FLUSH PRIVILEGES;

如果你使用MariaDB:

MariaDB> GRANT ALL PRIVILEGES on review_board.* TO 'review_board_user'@'localhost' identified by 'EXAMPLE_PASSWORD';

退出MySQL命令行界面。

mysql> EXIT;

安装Python Package Installer和Setuptools

pip工具管理Python包和模块。您将使用它下载和安装其他模块和Review Board应用程序。

使用Linux curl命令下载pip。

$ sudo curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py

运行刚才下载的get-pip.py文件以完成安装。

$ sudo python2 get-pip.py

升级pip应用程序。

$ sudo pip install -U pip

安装setuptools,它是支持轻松构建和分发Python包的增强集合。

$ sudo pip install -U setuptools

安装ReviewBoard

安装Review Board web应用程序。

$ sudo pip install -U ReviewBoard

要让Review Board应用程序连接到前面创建的MySQL数据库,请安装mysqlclient包。

$ sudo pip install mysqlclient

创建一个新的Board web网站

rb-site工具与ReviewBoard包捆绑在一起。使用它来安装和管理服务器上的站点。要创建您的第一个站点,运行下面的命令并将example.com替换为您的域名。

$ sudo rb-site install /var/www/example.com

出现提示时,输入域名,例如example.com。

* What's the host name for this site?     This should be the fully-qualified host name without the http://,    port or path. Domain Name: example.com

对于根路径,按ENTER保持默认值/。

Root Path [/]: ENTER

按1选择MySQL作为数据库类型。

* What database type will you be using?     You can type either the name or the number from the list below.     (1) mysql    (2) sqlite3 (not supported for production use) Database Type: 1

输入review_board作为数据库的名称并按Enter。

* What database name should Review Board use?     NOTE: You need to create this database and grant user modification    rights before continuing. See your database documentation for more    information.     The default is reviewboard Database Name [reviewboard]: review_board

按ENTER键,让localhost作为默认的MySQL服务器。

* What is the database server's address?     This should be specified in hostname:port form. The port is    optional if you're using a standard port for the database type.     The default is localhost Database Server [localhost]: ENTER

对于数据库用户名,输入review_board_user。

* What is the login and password for this database?     This must be a user that has table creation and modification    rights on the database you already specified. Database Username: review_board_user

输入在创建数据库用户时提供的密码来代替EXAMPLE_PASSWORD。

Database Password: EXAMPLE_PASSWORD

确认数据库密码。

Confirm Database Password:  EXAMPLE_PASSWORD

按ENTER键,将localhost:11211作为Memcached服务器的默认主机和端口。

* What memcached host should be used?     This is in the format of hostname:port     The default is localhost:11211 Memcache Server [localhost:11211]: ENTER

创建Review Board管理员帐户,例如:admin。

* Create an administrator account     To configure Review Board, you'll need an administrator account.    It is advised to have one administrator and then use that account    to grant administrator permissions to your personal user account.     If you plan to use NIS or LDAP, use an account name other than    your NIS/LDAP account so as to prevent conflicts.     The default is admin Username [admin]: admin

输入您刚刚创建的管理员帐户的密码。选择一个强密码来替换EXAMPLE_PASSWORD。

Password: EXAMPLE_PASSWORD

确认管理员帐号密码。

Confirm Password: EXAMPLE_PASSWORD

输入管理员的邮箱地址,如info@example.com。

E-Mail Address: info@example.com

输入您的公司名称,例如EXAMPLE company。

Company/Organization Name (optional): EXAMPLE COMPANY

选择允许Review Board收集数据,以更好地支持输入Y或N

Allow us to collect support data? [Y/n]: Y

在回答了以上所有问题后,您的Review Board网站应该安装在几秒钟之内。

安装后配置

Review Board需要访问一些目录,因此将/var/www/example.com目录及其下所有子目录的所有权分配给Apache的www-data用户。

$ sudo chown -R www-data:www-data /var/www/example.com

将配置文件/var/www/example.com/conf/apache-wsgi.conf拷贝到Apache的/etc/apache2/sites-available/目录下。

$ sudo cp /var/www/example.com/conf/apache-wsgi.conf /etc/apache2/sites-available/example.com.conf

要启用站点,请将其配置文件复制到Apache的/etc/apache2/sites-enabled目录。

$ sudo ln -s /etc/apache2/sites-available/example.com.conf /etc/apache2/sites-enabled/example.com.conf

重新启动Apache web服务器使更改生效。

$ sudo systemctl restart apache2

测试Review Board网站

在你的网络浏览器中,访问你的服务器的域名。例如:http://example.com

现在您应该看到Review Board站点的前端。

你已经在Ubuntu 20.04服务器上成功安装了Review Board。在进行下一个开发项目时,使用这个直观的代码审查工具来跟踪和修复bug。官方文件可在Review Board的主网站上找到。

未经允许不得转载:便宜VPS网 » 简单教你在Ubuntu 20.04上快速安装Review Board