參考:http://www.reibang.com/p/850d08a4bd57
概述
phabricator是軟件開發(fā)的一整套工具枉圃。包括一系列應(yīng)用程序來(lái)幫助你管理任務(wù)和迭代,審查在Git,SVN或者mercurial庫(kù)上的代碼舰始,建立持續(xù)集成闸衫,審查設(shè)計(jì)屹蚊,內(nèi)部聊天探討頻道悟民,以及更多坝辫。它是快速的、可擴(kuò)展的逾雄、完全開放的源代碼阀溶。源代碼的github路徑為:https://github.com/phacility/phabricator
官網(wǎng)地址是:https://www.phacility.com
可以在官網(wǎng)上查看相應(yīng)的安裝腻脏、配置等幫助文檔鸦泳。
安裝
概覽
Phabricator is a LAMP (Linux, Apache, MySQL, PHP) 應(yīng)用. 要安裝 Phabricator, 需要以下準(zhǔn)備:
- 一臺(tái)操作系統(tǒng)是linux或者類似系統(tǒng)的電腦用于安裝
- 一個(gè)域名(例如phabricator.mycompany.com)
- 基本的系統(tǒng)管理員技能
- Apache, nginx, 或者另外一個(gè)web服務(wù)器
- PHP, MySQL和Git.
安裝要求
安裝Phabricator服務(wù)端軟件的電腦操作系統(tǒng)不能是windows。命令行接口在windows上不能使用永品,不過(guò)可以在任何操作系統(tǒng)上可以通過(guò)瀏覽器使用Phabricator做鹰。可以在Linux鼎姐、mac钾麸、FreeBSD、Solaris操作系統(tǒng)上安裝使用Phabricator服務(wù)端軟件炕桨。
除了操作系統(tǒng)饭尝,還需要一個(gè)web服務(wù)器∠坠可以選擇Apache钥平、nginx、lighttpd以及其他可以運(yùn)行PHP的web服務(wù)器器姊途。我這里使用nginx涉瘾。
還需要安裝:
- MySQL: MySQL 5.5及以上
- PHP: PHP 5.2 及以上
還需要一個(gè)域名:
NOTE: Phabricator必須安裝在一個(gè)完整的域名商. 不能將其安裝到現(xiàn)有域上的路徑,
例如 example.com/phabricator/. 將它安裝在一個(gè)完整的域名或者子域名上,
像 phabricator.example.com.
環(huán)境搭建
mac下采用 homebrew 安裝相關(guān)環(huán)境,所以首先保證電腦中已經(jīng)安裝了homebrew捷兰。安裝命令如下:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
PHP環(huán)境搭建
最新版的php包中都自帶php-fpm立叛,所以只需要安裝帶有php-fpm的php包即可,命令如下:
brew tap homebrew/dupes
brew tap homebrew/php
brew install --without-apache --with-fpm --with-mysql php56
安裝完成,將php-fpm 添加入環(huán)境變量中贡茅,方便通過(guò)終端直接進(jìn)行啟動(dòng)
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
創(chuàng)建文件夾,并啟動(dòng)服務(wù),輸入以下命令
mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/opt/php56/homebrew.mxcl.php56.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
如果沒(méi)有報(bào)出什么bug的話 在終端中鍵入
lsof -Pni4 | grep LISTEN | grep php
應(yīng)該會(huì)有下圖的顯示
php-fpm 69659 frdmn 6u IPv4 0x8d8ebe505a1ae01 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 69660 frdmn 0u IPv4 0x8d8ebe505a1ae01 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 69661 frdmn 0u IPv4 0x8d8ebe505a1ae01 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 69662 frdmn 0u IPv4 0x8d8ebe505a1ae01 0t0 TCP 127.0.0.1:9000 (LISTEN) `
mysql 安裝
brew install mysql
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
添加mysql到環(huán)境變量中
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
輸入權(quán)限密碼(按以上步驟安裝無(wú)密碼秘蛇,直接enter),這時(shí)你應(yīng)該能看見(jiàn)
Type \'help;\' or \'h\' for help. Type \'c\' to clear the
current input statement.
mysql> exit # 退出mysql
nginx的安裝
使用homebrew來(lái)安裝nginx
brew install nginx
我們必須確保80端口是開啟的顶考,因?yàn)閚ginx是基于80端口的
sudo cp -v /usr/local/opt/nginx/*.plist /Library/LaunchDaemons/
sudo chown root:wheel /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
第一次開始nginx
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
默認(rèn)的配置設(shè)置是將監(jiān)聽(tīng)8080端口而非http默認(rèn)的80端口
curl -IL http://127.0.0.1:8080
終端中應(yīng)該有如下顯示
HTTP/1.1 200 OK
Server: nginx/1.12.0
Date: Thu, 29 Jun 2017 10:14:35 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Wed, 12 Apr 2017 14:46:09 GMT
Connection: keep-alive
ETag: "58ee3db1-264"
Accept-Ranges: bytes
最后對(duì)PHP啟動(dòng)相關(guān)的命令 添加全局變量
// If you use Bash 打開如下路徑下的文件
~/.bash_profile
// If you use ZSH 打開如下路徑下的文件
~/.zshrc
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.restart='nginx.stop && nginx.start'
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist"
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist"
alias php-fpm.restart='php-fpm.stop && php-fpm.start'
alias mysql.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.restart='mysql.stop && mysql.start'
alias nginx.logs.error='tail -250f /usr/local/etc/nginx/logs/error.log'
alias nginx.logs.access='tail -250f /usr/local/etc/nginx/logs/access.log'
alias nginx.logs.default.access='tail -250f /usr/local/etc/nginx/logs/default.access.log'
alias nginx.logs.default-ssl.access='tail -250f /usr/local/etc/nginx/logs/default-ssl.access.log'
alias nginx.logs.phpmyadmin.error='tail -250f /usr/local/etc/nginx/logs/phpmyadmin.error.log'
alias nginx.logs.phpmyadmin.access='tail -250f /usr/local/etc/nginx/logs/phpmyadmin.access.log'
現(xiàn)在我們可以輸入以下命令更新我們的變量 讓我們的設(shè)置生效
source ~/.bash_profile
//or
source ~/.zshrc`
現(xiàn)在可以使用更加簡(jiǎn)短的命名來(lái)優(yōu)雅的開關(guān)服務(wù)
nginx.start
nginx.stop
Phabricator 安裝
首先在安裝Phabricator 之前啟動(dòng)相應(yīng)的環(huán)境.
nginx.start
php-fpm.start
mysql.start
從github上clone關(guān)鍵組件
先在本機(jī)建一個(gè)根目錄彤叉,本文為:~/phabricator ,然后
$ cd phabricator/ # pick some install directory
phabricator/ $ git clone https://github.com/phacility/libphutil.git
phabricator/ $ git clone https://github.com/phacility/arcanist.git
phabricator/ $ git clone https://github.com/phacility/phabricator.git
修改nginx配置文件
打開該路徑下的配置文件:
/usr/local/etc/nginx/nginx.conf
修改相應(yīng)的配置如下:
server {
server_name phabricator.zy.com;
root /Users/zhangyang/phabricator/phabricator/webroot; #phabricator安裝路徑下的對(duì)應(yīng)文件
location / {
index index.php;
rewrite ^/(.*)$ /index.php?__path__=/$1 last;
}
location /index.php {
fastcgi_pass localhost:9000;
fastcgi_index index.php;
#required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
#variables to make the $_SERVER populate in PHP
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
}
}
添加上面這一段村怪,注意server_name后的域名以及root根目錄要換成自己的實(shí)際參數(shù)秽浇。
phabricator 啟動(dòng)及部分配置
php-fpm及nginx啟動(dòng)成功后,瀏覽http://phabricator.zy.com (即:剛才nginx中server配置的域名甚负,本機(jī)配置時(shí)柬焕,可在hosts中增加127.0.0.1 phabricator.zy.com以方便測(cè)試)审残,我看到的界面如下:
即需要進(jìn)入phabricator子目錄下,執(zhí)行:
./bin/storage upgrade
執(zhí)行完以上的命令斑举,刷新頁(yè)面搅轿,即可看到下面的頁(yè)面,下面的頁(yè)面用于注冊(cè)管理員賬號(hào)富玷。
注冊(cè)完成之后璧坟,就可以進(jìn)入主頁(yè)面了。但配置還沒(méi)有完成赎懦,需要解決問(wèn)題雀鹃,我這里標(biāo)識(shí)有15個(gè)問(wèn)題需要解決。一個(gè)個(gè)點(diǎn)擊按照它的指導(dǎo)來(lái)解決就可以了励两。