1.clone Phabricator项目文件
$ cd somewhere/ # pick some install directory
somewhere/ $ git clone https://github.com/phacility/libphutil.git
somewhere/ $ git clone https://github.com/phacility/arcanist.git
somewhere/ $ git clone https://github.com/phacility/phabricator.git
https://phabricator.webfuns.net/book/phabricator/article/installation_guide/
2.安装 MySQL
2.1 设置 phabricator 连接 MySQL
phabricator/ $ /data/pha/phabricator/bin/config set mysql.host __host__
phabricator/ $ /data/pha/phabricator/bin/config set mysql.user __username__
phabricator/ $ /data/pha/phabricator/bin/config set mysql.pass __password__
./bin/storage upgrade // 升级
https://phabricator.webfuns.net/book/phabricator/article/configuration_guide/
3.安装 Nginx
设置下phabricator的url:
/data/pha/phabricator/bin/config set phabricator.base-uri 'http://phabricator.local'
https://phabricator.webfuns.net/book/phabricator/article/configuration_guide/
4.安装 PHP
5.浏览器应该可以访问Phabricator, 作为第一个访问用户,可创建管理员账号
6.配置邮件
./config set metamta.default-address 184200157@qq.com
./config set metamta.domain wwdddd.com
./config set metamta.can-send-as-user false
./config set metamta.mail-adapter PhabricatorMailImplementationPHPMailerAdapter
./config set phpmailer.mailer smtp
./config set phpmailer.smtp-host smtp.qq.com
./config set phpmailer.smtp-port 465
./config set phpmailer.smtp-user 184200157@qq.com
./config set phpmailer.smtp-password xxx
./config set phpmailer.smtp-protocol SSL
// 测试是否发送成功
./bin/mail send-test --to jianhua.wei@langlive.com --subject hello < README.md
账号管理:
https://phabricator.webfuns.net/book/phabricator/article/configuring_accounts_and_registration/
{
"phpmailer.smtp-password": "xxx",
"phpmailer.smtp-user": "sonic.guo@xxx.com",
"phpmailer.smtp-port": 465,
"phpmailer.smtp-protocol": "ssl",
"phpmailer.smtp-host": "smtp.exmail.qq.com",
"phpmailer.mailer": "smtp",
"metamta.mail-adapter": "PhabricatorMailImplementationPHPMailerAdapter",
"diffusion.ssh-port": 2222,
"diffusion.ssh-user": "git",
"phd.user": "daemon-user",
"metamta.can-send-as-user": false,
"metamta.domain": "aaabbb.com",
"metamta.default-address": "shijie@xxx.com",
"repository.default-local-path": "/data/repo",
"phabricator.base-uri": "http://phabricator.aaabbb.com/",
"mysql.pass": "",
"mysql.user": "root",
"mysql.host": "127.0.0.1",
"storage.local-disk.path": "/data/phabricator/storage"
}
7.配置和自启动守护进程
Phabricator 通过后台进程发送邮件,所以需要先启动后台进程。
如果没有启动会有警告信息。关于使用后台进程的信息, 请参阅 用 phd 管理后台进程。
http://url.../daemon // 可以查看正在跑的 daemon 程序
7.1 创建phd用户
sudo adduser phd --home /home/phd
7.2 使phd用户不可远程登录:
sudo usermod -p NP phd
7,3 创建和启动phd自启动服务
创建systemd service文件/tmp/service.file
[Unit]
Description=phabricator-phd
After=syslog.target network.target mysql.service
Before=nginx.service
[Service]
Type=oneshot
User=phd
Group=phd
Enviroment="PATH=/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin"
ExecStart=/var/www/pha/phabricator/bin/phd start
ExecStop=/var/www/pha/phabricator/bin/phd stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
将服务加入到systemd目录:
sudo cp /tmp/service.file /lib/systemd/system/phabricator-phd.service
使phabricator-phd.service可用:
sudo systemctl enable phabricator-phd.service
启动phabricator-phd.service服务:
sudo systemctl start phabricator-phd
如没有报错,访问:http://p.mydomain.com/daemon/ 可以看到Active Daemons不为空了。
将phd用户设置为phd.user:
sudo ./bin/config set phd.user phd
注:其他用户如需操作git命令,需要sudo为phd用户,上面的设置就是告诉它们需要sudo的用户名。
phd用户将守护进程跑起来后,就可以创建新用户了。通过管理员账号,选择people,添加standard用户。会收到邀请邮件,如果phd和邮箱配置都没问题的话。
用这个standard用户登录,并上传public key,后面要用到。
8.配置SSH Git托管
1.准备工作
将当前SSH服务转移到2222端口,将来运行的Git SSH服务使用22端口。这是多次配置后,觉得后续比较方便的做法。否则,Git用户都要自定义端口,给开发/部署带来不必要的麻烦。
修改文件:
sudo vim /etc/ssh/sshd_config
将Port改为2222后重启ssh服务:
sudo service ssh restart
用2222端口ssh重新登录服务器:
2.创建git用户
sudo adduser git
禁止登录:
sudo usermod -p NP git
设置git可以sudo为phd,修改/etc/sudoers,加入:
git ALL=(phd) SETENV: NOPASSWD: /usr/bin/git-upload-pack, /usr/bin/git-receive-pack
https://www.jianshu.com/p/d7630e1fe4f9
https://phabricator.webfuns.net/book/phabricator/article/configuration_guide/
https://phabricator.webfuns.net/book/phabricator/article/diffusion_hosting/
https://secure.phabricator.com/book/phabricator/article/diffusion_hosting/
https://phabricator.webfuns.net/book/phabricator/article/configuring_outbound_email/