Installation phabricator on Ubuntu 12.04


About Phabricator, just like what said in Phabricator.org: Phabricator is a collection of open source web applications that help software companies build better software.

My task here is setup Phabricator on a brand new PC.

Target OS: Ubuntu 12.04 32 bit
Target PC: Dell Opmix 380

Here we go.

First install Ubunto 12.04 (skipped).
After with Ubuntu 12.04 installed, we install a bunch of stuffs to make later installations easier.

1. Change source. Under my networking environment, USTC source is much more faster than others.

[code]
sudo cp /etc/apt/source.list /opt/config/source.list.bak
sudo gedit /etc/apt/source.list
[/code]

deb http://debian.ustc.edu.cn/ubuntu/ precise main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ precise-backports restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb http://debian.ustc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ precise main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-security main restricted universe multiverse
deb-src http://debian.ustc.edu.cn/ubuntu/ precise-updates main restricted universe multiverse

2. Some tools

[code]
sudo apt-get install ssh git subversion
—-sudo apt-get install apache2 mysql-server php5
[/code]

3. Using install script provided by Phabricator

[code]
wget http://www.phabricator.com/rsrc/install/install_ubuntu.sh
chmod +x install_ubuntu.sh
./install_ubuntu.sh
[/code]

Wait a few minutes…

4. Installing APC (Optional)

[code]
sudo apt-get install libpcre3-dev php-pear
sudo pecl install apc
[/code]

Once APC is installed, test that it is available by running:

[code]
php -i | grep apc
[/code]

If it doesn’t show up, add:

[code]
extension=apc.so
[/code]

..to “/etc/php.d/apc.ini” or the “php.ini” file indicated by “php -i”.

5. Installing XHProf (Optional)

[code]
sudo pecl install xhprof
[/code]

When I ran to this step, I got a fail:
sudo: unable to resolve host proto.kdvrd.com
Failed to download pecl/xhprof within preferred state “stable”, latest release is version 0.9.3, stability “beta”, use “channel://pecl.php.net/xhprof-0.9.3” to install install failed

For now, I choose ignore it, because you know, it’s optional, XDXD.

6. Updating Phabricator
If you want to update your Phabricator, you can use this script.

[code]
wget http://www.phabricator.com/rsrc/install/update_phabricator.sh
chmod +x update_phabricator.sh
./update_phabricator.sh
[/code]

7. Configuration Guide

7.1. Apache

Get Apache running and verify it’s serving a test page. Consult the Apache documentation for help. Make sure mod_php and mod_rewrite are enabled, and mod_ssl if you intend to set up SSL.

Create a VirtualHost entry (to put Phabricator on a subdomain) or edit the Directory entry for the DocumentRoot

[code]
sudo vi /etc/apache2/httpd.conf

<VirtualHost *>
# Change this to the domain which points to your host.
ServerName phabricator.rg4.net

# 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 /opt/phabiractor/phabricator/webroot

RewriteEngine on
RewriteRule ^/rsrc/(.*)     –                       [L,QSA]
RewriteRule ^/favicon.ico   –                       [L,QSA]
RewriteRule ^(.*)$          /index.php?__path__=$1  [B,L,QSA]
</VirtualHost>
[/code]

If Apache isn’t currently configured to serve documents out of the directory where you put Phabricator, you may also need to add a section like this:

[code]
<Directory "/opt/phabiractor/phabricator/webroot">
Order allow,deny
Allow from all
</Directory>
[/code]

After making your edits, restart Apache, then continue to “Setup” below.
sudo /etc/init.d/apache2 restart

If you wannt, you can visit your newly setup apache virtualhost on a PC by navigating to the server name http://phabricator.rg4.net, which is the server name you specified in httpd.conf.

7.2 Setup

Go to your phabricator dir, and run the command you see in your client PC.
cd /opt/phabiractor/phabricator
./bin/storage upgrade

NOTE: When you update Phabricator, run storage upgrade again to apply any new updates.

7.3 Create Accounts

There are two ways to manually create new accounts: via the web UI using the “People” application (this is easiest), or via the CLI using the accountadmin binary (this has a few more options).

To use the CLI script, run:

./bin/accountadmin

Some options (like setting passwords and changing certain account flags) are only available from the CLI. You can also use this script to make a user an administrator (if you accidentally remove your admin flag) or create an administrative account.

7.4 Create Repositories

Login Phabricator from your PC with your admin account to Create Repositories, and setup repository browser, Diffusion.

Diffusion is a repository browser which allows you to explore source code in a Git or SVN repository, similar to software like Trac and GitWeb.

Diffusion provides a very high-performance SVN browser, a moderately high-performance Git browser and relatively slow Mercurial browser. It achieves performance by denormalizing large amounts of data about repository history into a database and using this information like a cache so it can avoid querying the repository directly. This data is generated by daemons which track repositories, discover new commits, and parse and import them.

Diffusion is integrated with the other tools in the Phabricator suite. For instance:

when you commit Differential revisions to a tracked repository, they are automatically updated and linked to the corresponding commits;
you can add Herald rules to notify you about commits that match certain rules;
the Owners tool uses Diffusion to map repositories; and
in all the tools, commit names are automatically linked.

To start it, run this command under Phabricator/bin

[code]
./bin/phd start
[/code]

7.5 Setup Issues

./bin/config set phabricator.base-uri ‘http://proto.kdvrd.com/’

7.6 Mail configurations

I choose sendmail, so let’s install it first:
sudo apt-get install sendmail

Then goto SITE CONFIGURATION –> Config –> Mail –> metamta.mail-adapter

Change the Global setting to: PhabricatorMailImplementationPHPMailerLiteAdapter

You can refer to the url for more details about Mail configurations: http://www.phabricator.com/docs/phabricator/article/Configuring_Outbound_Email.html

记的把 send-immediately改成false,这样表示使用daemon进行异步发送。其他的domain 和address之类的自己随便写无所谓。

7.7 Force audit

Create a Herald Rule, use Commit + Global option,
Conditions: When all of these conditions are met: Differential revision does not exist
Action: Trigger an audit by …

Leave a comment

Your email address will not be published. Required fields are marked *