How to Install Phabricator on Debian 9

How to Install Phabricator on Debian 9

Spread the love

Phabricator is free and open source set of tools that ease the process of building software and allows developers and companies to build better software. It includes tools for differential code review, repository hosting and browsing, monitoring tool, bug tracker, wiki and much more. Phabricator originally was developed as an internal tool at Facebook, but now it is under active development by hundreds of unique developers. In this tutorial we will install Phabricator on a Debian 9 VPS with Apache, PHP and MySQL server.

Phabricator has some very useful features, such as:
– Pre-Commit Code Review
– Git, Mercurial, and SVN Support
– Customizable Task Management
– Workboards and Sprints
– Chat Channels
– Business Rules
– Command Line Tools
– Conduit API
and much more…

Prerequisites

Phabricator requires the following software to be installed in order to properly run:
– Debian 9 VPS with SSH root privileges
– Domain or subdomain. Phabricator cannot be installed in a subdirectory. We will use phabricator.yourdomain.com
– Web server – Apache, Nginx, LiteSpeed, …
– PHP version 5.2 or newer, with the mbstring, iconv, mysql (or mysqli), curl and pcntl PHP extensions
– MySQL server version 5.5 or newer

In this tutorial we will install all necessary prerequisites. We will use Debian 9 VPS running on our SSD 2 VPS hosting plan.

Step 1: Login via SSH and upgrade the system

As usual, login to your Debian 9 VPS via SSH as user root

ssh root@IP_Address -p Port_Number

and make sure that all installed packages are updated to the latest available version

apt update && apt upgrade

Step 2: Install Apache web server and PHP

As mentioned in the Prerequisites section, we have to install a web server in order to run Phabricator. In this tutorial we will install Apache web server.

apt install apache2

Once installed, enable Apache to start upon server restart

systemctl enable apache2

Next, we will install PHP and all PHP extensions required by Phabricator

apt install php php-common php-mbstring php-mysql php-curl

Step 3: Install MySQL server

Database server is also requires, so run the following command to install MySQL database server

apt install mysql-server

Once the database server is installed, run the mysql_secure_installation post-installation script to secure the server and set your MySQL root password.

Step 4: Create Apache Virtual host

In order to access Phabricator with a domain or subdomain, we have to create a new Apache virtual host. In this tutorial we will use phabricator.yourdomain.com to access Phabricator. Create a new file with the following content

nano /etc/apache2/sites-available/phabricator.yourdomain.com.conf

ServerName phabricator.yourdomain.com
ServerAdmin [email protected]

DocumentRoot /var/www/html/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}/pphabricator.yourdomain.com-error.log
CustomLog ${APACHE_LOG_DIR}/phabricator.yourdomain.com-access.log combined

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

Save the file, and enable the virtual host configuration

a2ensite phabricator.yourdomain.com
Enabling site phabricator.yourdomain.com.
To activate the new configuration, you need to run:
  systemctl reload apache2

and restart the web server for the changes to take effect

systemctl restart apache2

Step 5: Download and configure Phabricator

We will clone Phabricator and its dependencies from their official git repositories, so make sure that git is isntalled on your server:

apt install git
Now, run the following command to clone the repositories:
cd /var/www/html
git clone https://github.com/phacility/libphutil.git
git clone https://github.com/phacility/arcanist.git
git clone https://github.com/phacility/phabricator.git

Next, change the current working directory to Phabricator’s directory

cd /var/www/html/phabricator

and run the following commands to configure MySQL configuration file for Phabricator

./bin/config set mysql.host localhost
./bin/config set mysql.user root
./bin/config set mysql.pass MySQL_root_password

and load the Phabricator schemata by executing the following command

./bin/storage upgrade

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).

Note that, you have to run this script every time you update Phabricator in order to apply the new updates.

Finally, open your favorite web browser and navigate to http://phabricator.yourdomain.com and follow the on-screen insctructions to complete the installation and create your initial administrator account. For more information on how to configure and use Phabricator, please check their official documentation.


Install Phabricator on Debian 9 Of course you don’t have to Install Phabricator on a Debian 9 VPS, if you use one of our Linux Server Management services, in which case you can simply ask our expert Linux admins to install Phabricator 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.

One thought on “How to Install Phabricator on Debian 9

  1. Nice guide, thanks.

    In Step 4 i also had to run “a2enmod rewrite” before executing command “systemctl restart apache2”!

Leave a Reply

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