Phabricator是一个LAMP应用套件,需要安装Git,Linux,Apache,MYSQL,PHP,Sendmail等众多组件。如果在Linux环境上手动安装,折腾一个星期都不一定能将将系统运行起来。幸好现在Phabricator提供了自动化安装脚本,支持Ubuntu环境和redhat环境,此次我们就针对Ubuntu环境进行自动化安装,后续的一些环境配置工作还需要手动完成。
通过一次完整的安装实践,如果有网络环境良好,安装过程还是比较顺利的,但是后面配置过程还是有点复杂,需要逐个解决,本章先讲一下提供完整的安装配置过程。1.下载脚本
经过实践pha的安装地址在这里,https://secure.phabricator.com/diffusion/P/browse/master/scripts/install/install_ubuntu.sh
网上有些文章说在这里,发现没有shell脚本了 http://www.phabricator.com/rsrc/install/install_Ubuntu.sh
#!/bin/bash
confirm() {
echo "Press RETURN to continue, or ^C to cancel.";
read -e ignored
}
GIT='git'
LTS="Ubuntu 10.04"
ISSUE=`cat /etc/issue`
if [[ $ISSUE != Ubuntu* ]]
then
echo "This script is intended for use on Ubuntu, but this system appears";
echo "to be something else. Your results may vary.";
echo
confirm
elif [[ `expr match "$ISSUE" "$LTS"` -eq ${#LTS} ]]
then
GIT='git-core'
fi
echo "PHABRICATOR UBUNTU INSTALL SCRIPT";
echo "This script will install Phabricator and all of its core dependencies.";
echo "Run it from the directory you want to install into.";
echo
ROOT=`pwd`
echo "Phabricator will be installed to: ${ROOT}.";
confirm
echo "Testing sudo..."
sudo true
if [ $? -ne 0 ]
then
echo "ERROR: You must be able to sudo to run this script.";
exit 1;
fi;
echo "Installing dependencies: git, apache, mysql, php...";
echo
set +x
sudo apt-get -qq update
sudo apt-get install \
$GIT mysql-server apache2 dpkg-dev \
php5 php5-mysql php5-gd php5-dev php5-curl php-apc php5-cli php5-json
# Enable mod_rewrite
sudo a2enmod rewrite
HAVEPCNTL=`php -r "echo extension_loaded('pcntl');"`
if [ $HAVEPCNTL != "1" ]
then
echo "Installing pcntl...";
echo
apt-get source php5
PHP5=`ls -1F | grep '^php5-.*/$'`
(cd $PHP5/ext/pcntl && phpize && ./configure && make && sudo make install)
else
echo "pcntl already installed";
fi
if [ ! -e libphutil ]
then
git clone https://github.com/phacility/libphutil.git
else
(cd libphutil && git pull --rebase)
fi
if [ ! -e arcanist ]
then
git clone https://github.com/phacility/arcanist.git
else
(cd arcanist && git pull --rebase)
fi
if [ ! -e phabricator ]
then
git clone https://github.com/phacility/phabricator.git
else
(cd phabricator && git pull --rebase)
fi
echo
echo
echo "Install probably worked mostly correctly. Continue with the 'Configuration Guide':";
echo
echo " https://secure.phabricator.com/book/phabricator/article/configuration_guide/";
echo
echo "You can delete any php5-* stuff that's left over in this directory if you want.";
将shell脚本另存,
sudo mkdir /usr/phabricator
cd /usr/phabricator
sudo vim install_ubuntu.sh
2. 一键安装
sudo chmod 755 install_ubuntu.sh
sudo ./install_ubuntu.sh
安装过程中,会遇到一些确认,直接输入密码,或者回车即可。
3. 配置Apache
sudo vim /etc/apache2/sites-enabled/000-default.conf
修改DocumentRoot 后面的路径
/usr/phabricator/phabricator/webroot
增加重写规则Rewrite
<Directory "/usr/phabricator/phabricator/webroot">
Require all granted
</Directory>
修改后配置文件如下
<VirtualHost *:80>
# Change this to the domain which points to your host.
# 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!
ServerName webmaster@localhost
DocumentRoot /usr/phabricator/<span style="font-family: Arial;">phabricator</span><span style="font-family: Arial;">/webroot</span>
RewriteEngine on
RewriteRule ^/rsrc/(.*) - [L,QSA]
RewriteRule ^/favicon.ico - [L,QSA]
RewriteRule ^(.*)$ /index.PHP?__path__=$1 [B,L,QSA]
<Directory "<span style="font-family: Arial;">/usr/phabricator/</span><span style="font-family: Arial;">phabricator</span><span style="font-family: Arial;">/webroot</span><span style="font-family: Arial;">"></span>
Require all granted
</Directory>
</VirtualHost>
重启apache
sudo /etc/init.d/apache2 restart
4、配置mysql
先配置在mysql时输入的用户名和密码,
sudo ./bin/config set mysql.host 127.0.0.1
sudo ./bin/config set mysql.user root
sudo ./bin/config set mysql.pass pass
更新配置
sudo ./bin/storage upgrade
5. 安装sendmail
sudo apt-get install sendmail
邮件设置可以参考sendmail的配置,如果不需要发送邮件功能,此步骤也可以省略。
6、验证http配置
Firefox浏览器中输入http://127.0.0.1 ,出现如下界面,说明安装环境已经搞定了。