Phabricator安装(Ubuntu20)
Phabricator 是一个开源的源码扫描程序。它还包括了基于 Web 的轻量级代码审查、规划、测试、bug 发现等功能。
官网:https://www.phacility.com/
项目地址:https://github.com/phacility/phabricator
一,安装
Phabricator 是一个LAMP应用套件, 因此最基本的要求就是LAMP环境:
- Linux:Linux的不同发行版及变种是必需的。Mac OS X是一个可接受的Linux变种,Windows不是。Phabricator不能安装在Windows系统上。在Mac OS X,Amazon Linux,Ubuntu,RHEL和CentOS上运行的 Phabricator 有活跃的贡献者。
- Apache(或nginx,或lighttpd):需要Apache 2.2.7以上版本。
- MySQL:MySQL必需
- PHP:需要PHP5.2以上版本
- 域名(例如:phabricator.my.com)
LAMP: Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台。
Phabricator安装必须的组件包括
git
Apache (or nginx)
MySQL Server
PHP
1.创建目录
sudo mkdir /var/www
cd /var/www
2.创建或拷贝官方安装脚本install_ubuntu.sh
wget https://secure.phabricator.com/source/phabricator/browse/legacy-2019/scripts/install/install_ubuntu.sh
3.执行脚本
sudo chmod a+x ./install_ubuntu.sh sudo ./install_ubuntu.sh
二.配置Apache
1.设置一个指向你主机的域名
sudo vi /etc/hosts
127.0.0.1 phabricator.my.com
2.创建一个VirtualHost条目(放置Phabricator到一个二级域名上)进入站点配置目录
$cd /etc/apache2/sites-available/
3.该目录用于存放虚拟机的配置文件。创建一个虚拟机的配置文件
$ sudo vi phabricator.conf

<VirtualHost *:80> # Change this to the domain which points to your host. ServerName phabricator.my.com # Change this to the path where you put 'phabricator' when you checked it # out from GitHub when following the Installation Guide. # # Make sure you include "/webroot" at the end! DocumentRoot /var/www/phabricator/webroot RewriteEngine on RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA] RewriteRule ^/rsrc/(.*) - [L,QSA] RewriteRule ^/favicon.ico - [L,QSA] # If Apache isn't currently configured to serve documents out of the # directory where you put Phabricator, you may also need to add # <Directory /> section. <Directory /var/www/phabricator/webroot> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride None Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
a.<Directory部分也可以添加到/etc/apache2/apache2.conf中。
b.这里用的是默认端口80,要想通过其他端口(8080)访问,首先我们得让apache2监听端口该端口: 修改/etc/apache2/ports.conf,增加: Listen 8080 保存编辑的配置文件后, 需要启用该配置。
$ sudo a2ensite phabricator.conf
完成后他会提示你需要重新加载一些东西, 这里按照提示执行一下。
$ sudo service apache2 reload
4.重启Apache服务
$sudo /etc/init.d/apache2 restart
三.配置MYSQL
1.创建mysql用户
CREATE USER 'ubuntu'@'localhost' IDENTIFIED BY '123456';
2.授予账户权限:
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON *.* TO 'ubuntu'@'localhost';
授予所有权限:
GRANT ALL PRIVILEGES ON *.* TO 'liujing'@'localhost';
查看用户权限:
show grants for 'liujing'@'localhost';
3.设置到phabricator
./bin/config set mysql.host localhost ./bin/config set mysql.post 3306 ./bin/config set mysql.user ubuntu ./bin/config set mysql.pass 123456
4.加载Phabricator
./bin/storage upgrade
注意:每当Phabricator进行了更新,都需要运行storage upgrade。
每当server关闭后再次开启,需要重新启动phabricator。页面信息会提示你该怎么做。
5.设置邮件
vim conf/local/local.json
{
"cluster.mailers": [
{
"key": "my-mailer",
"type": "smtp",
"options": {
"host": "smtp.qq.com",
"port": 465,
"user": "123456789@qq.com",
"password": "123456789",
"protocol": "ssl"
}
}
],
"metamta.can-send-as-user": false,
"metamta.default-address": "123456789@qq.com",
"phabricator.base-uri": "http://phabricator.my.com/",
"mysql.pass": "123456",
"mysql.user": "ubuntu",
"mysql.port": "3306",
"mysql.host": "localhost"
}
6.测试发送邮件
sudo ./bin/mail send-test --to 123456789@qq.com --subject hi <1.txt
四.phabricator
浏览器进入http://phabricator.my.com/ 设置一个管理员账户,可以登录了
五.添加中文支持
执行下面命令,然后在客户端设置里,选择语言中文即可.
$cd /var/www/phabricator/src/extensions/ $git clone https://github.com/wanthings/phabricator-zh_CN.git ./
六.问题解决
1.AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message。
$ sudo vim /etc/apache2/apache2.conf
最后加一句:
ServerName localhost:80
参考文献:
https://www.cnblogs.com/szkzyw/p/13080348.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】