How to Install Phabricator on Ubuntu 16.04

how to install Phabricator on Ubuntu 16.04

In this article we will show you how to install Phabricator on Ubuntu 16.04, with Apache web server, PHP and MySQL. Phabricator is an open source set of tools which help developers to build better software. It includes tools for differential code review, repository hosting and browsing, monitoring tool,  bug tracker, wiki and much more. Phabricator is currently maintained by Phacility, it was originally developed as an internal tool at Facebook. It is available as free software under the Apache License, version 2.

Phabricator supports Git, Mercurial, and Subversion. The Phabricator server runs on Linux or Mac OS X, but can be used on any platform. It is written mostly in PHP.

Phabricator includes tools for:

  • Reviewing and auditing code
  • Hosting and Browsing repositories
  • Managing projects
  • Tracking bugs or “features”
  • Hiding stuff from coworkers
  • and also some other things like meme generators

Installing Pabricator on Ubuntu 16.04 is fairly easy and straight to the point task, and it shouldn’t take more then 10 minutes to install it. Let’s get started.

REQUIREMENTS:

It is not recommended to install Phabricator on a shared hosting account, we will be using our SSD 2 Linux VPS Hosting plan for this tutorial.

1. Update the system

As always before installing new software on your VPS  login to your server and make sure that all packages are up to date:

sudo apt-get update 
sudo apt-get upgrade

We will also install the following packages which are required for the installation process:

sudo apt-get install software-properties-common git

2. Install MySQL

To install the latest MySQL packages on your server issue the following commands:

sudo apt update
sudo apt install mysql-server

When the installation is complete, run the following command to secure your installation:

sudo mysql_secure_installation

Change the MySQL root authentication method to mysql_native_password:

sudo mysql -u root
use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_mysql_root_password';
flush privileges;  

3. Download Phabricator and dependencies

To create and switch to the directory in which we will download Phabricator and its dependencies run the following command:

sudo mkdir /var/www/html/myapp
cd /var/www/html/myapp

Next, clone the needed Git repositories from Github :

sudo git clone https://github.com/phacility/libphutil.git
sudo git clone https://github.com/phacility/arcanist.git
sudo git clone https://github.com/phacility/phabricator.git

4. Install and configure Apache and PHP

Phabricator does not support PHP 7.0 which is the default PHP version shipped with Ubuntu 16.04.

To be able to Install PHP 7.2 we will enable the ondrej PPA, this repository is generally considered safe to use.  To add the repository to your system run the following command:

sudo add-apt-repository -y ppa:ondrej/php

Update the package list and then install PHP 7.2  and the PHP extensions required by Phabricator:

sudo apt-get update
sudo apt-get install php php-mysql php-gd php-curl php-apcu php-cli php-json php-mbstring

To install Apache you need to execute the following command:

sudo apt-get install apache2

Enable the php7.2 Apache module wit hhe following command:

sudo a2enmod php7.2

Next, create a new Apache virtual host configuration file with your favorite text editor. We are using nano for this purpose:

sudo nano /etc/apache2/sites-available/phabricator.conf
<VirtualHost *:80>
ServerName phabricator.domain.com
ServerAdmin webmaster@domain.com

DocumentRoot /var/www/html/myapp/phabricator/webroot

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

ErrorLog ${APACHE_LOG_DIR}/phabricator-error.log
CustomLog ${APACHE_LOG_DIR}/phabricator-access.log combined

<Directory "/var/www/html/myapp/phabricator/webroot">
Require all granted
</Directory>
</VirtualHost>

Of course you need to replace “phabricator.domain.com” with the domain of your choice.

Enable the new virtual host configuration with:

sudo a2ensite phabricator

Restart the Apache web server for changes to take effect and enable the Apache service to start on boot with the following commands:

sudo systemctl enable apache2
sudo systemctl restart apache2

5. Configure Phabricator

Switch to the phabricator directory:

 cd /var/www/html/myapp/phabricator

To configure phabricator MySQL configuration file execute the following commands:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
./bin/config set mysql.host localhost
./bin/config set mysql.user root
./bin/config set mysql.pass your_mysql_root_password

Run the storage upgrade script and press Y when prompted. This script will load the database schema:

 ./bin/storage upgrade --user root --password your_mysql_root_password
Are you ready to continue? [y/N] y

Applying schema adjustments...
Done.
Completed applying all schema adjustments.
 ANALYZE  Analyzing tables...
Done.
 ANALYZED  Analyzed 510 table(s).

6. Install Phabricator

Open your favorite web browser and navigate to: http://phabricator.domain.com

You will be redirected to the registration page where you can setup your admin account.

Once you click on the “Create Admin Account” button you will be logged in as admin and redirected to the Phabricator home page.


Congratulations. You have successfully installed Phabricator on your Ubuntu 16.04 VPS. For the official documentation of Phabricator visit the official page, by clicking on this link.


install phabricator on ubuntu 16.04Of course you don’t have to Install Phabricator on a Ubuntu 16.04, if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Phabricator on Ubuntu 16.04 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install Phabricator on Ubuntu 16.04,  please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

4 thoughts on “How to Install Phabricator on Ubuntu 16.04”

  1. When i use “sudo ./bin/config set mysql.host localhost” command there was a error:

    “FATAL ERROR: Unable to load the “Arcanist” library. Put “arcanist/” next to “phabricator/” on disk.”

    ANY SOLUTION?

    Reply
    • Please do a proper clone from Github:
      sudo git clone https://github.com/phacility/libphutil.git
      sudo git clone https://github.com/phacility/arcanist.git
      sudo git clone https://github.com/phacility/phabricator.git

      Reply
    • You need to create a symlink to enable the virtual host:
      ln -s /etc/apache2/sites-available/phabricator.conf /etc/apache2/sites-enabled/phabricator.conf

      Reply

Leave a Comment