Phabricator 实践之安装

来源:互联网 发布:李圣杰为什么不红 知乎 编辑:程序博客网 时间:2024/06/09 10:48

Phabricator 是facebook开发的一套代码审核工具,基于PHP和Mysql开发,因此最基本的要求就是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以上版本

如果你是在Ubuntu或Redhat及其衍生版本上安装,可以使用官方提供的安装脚本:

  • RedHat衍生版本: http://www.phabricator.com/rsrc/install/install_rhel-derivs.sh
  • Ubuntu: http://www.phabricator.com/rsrc/install/install_ubuntu.sh

运行上面的脚本之后,就已经帮你安装好了LAMP环境和Phabricator,接下来只需要相应的配置即可。如果你是在一台之前没有搭建过LAMP环境的服务器上安装,推荐使用官方提供的安装脚本。如果你和我一样,之前已经在服务器上安装了LAMP环境,或者你想使用LNMP环境,那么定制安装也是件很容易的事。

总之,下面列出组件的是必需的:

  • Git
  • PHP5.2+
  • PHP扩展 php5-mysql php5-gd php5-dev php5-curl  php5-cli php5-common php-apc(可选,但建议你安装)
  • Apache 2.2.7+或Nginx,或Lighttpd
  • MySql

另外,经过我的实践,Phabricator也可以运行在HHVM上,我目前使用的环境就是Tengine+HHVM+MySql+Git+Phabricator.(搭建Tengine+HHVM环境可以参考这里)

安装好上面的环境之后,下面就开始获取Phabricator以及其依赖包。这里我遇到的一个问题是,起先我将Phabricator 克隆在我用户的主目录,配置好Tengine之后,却一直显示404 no such file or directory.nginx配置文件绝对没有问题,无赖又将Phabricator及其组件Clone到了其他目录,再次修改nginx配置文件中的root路径,就可以访问了.

cd /opt mkdir codereview && cd codereview # 切换到安装目录/opt/codereview$ git clone https://github.com/facebook/libphutil.git/opt/codereview$ git clone https://github.com/facebook/arcanist.git /opt/codereview$ git clone https://github.com/facebook/phabricator.git

接下来配置一下Webserver,就可以访问了,下面是Nginx的配置。

server {  server_name phabricator.dev;  root  /opt/codereview/phabricator/webroot;  try_files $uri $uri/ /index.php;  location / {  index   index.php;  if ( !-f $request_filename )  {    rewrite ^/(.*)$ /index.php?__path__=/$1 last;    break;  }  }  location /index.php {  fastcgi_pass   localhost:9000;  fastcgi_index   index.php;  #required if PHP was built with --enable-force-cgi-redirect  fastcgi_param  REDIRECT_STATUS200;  #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_SOFTWAREnginx/$nginx_version;  fastcgi_param  REMOTE_ADDR$remote_addr;  }}

如果你选择了Apache或Lighttpd,可以参考官方文档中的配置:https://secure.phabricator.com/book/phabricator/article/configuration_guide/ 
访问服务器IP或绑定的域名,如果不出意外,你应该会看到下面的界面。接下来我们就开始对phabricator进行配置。



编辑数据库:


phabricator/ $ ./bin/config set mysql.host valuephabricator/ $ ./bin/config set mysql.user valuephabricator/ $ ./bin/config set mysql.pass value

执行完之后再执行:

phabricator/ $ ./bin/storage upgrade

0 0
原创粉丝点击