Install Phabricator on Ubuntu

Phabricator is a free set of web tools for joint development of various software products, it has built-in chat, code verification, problem tracking, etc.

Once looking at the list of services for hosting Mercurial on the site
https://www.mercurial-scm.org/wiki/MercurialHosting
decided to use a phabricator
https://www.phacility.com/phabricator/

For example, I will install Phabricator on Ubuntu Server 18.04.

First, update the system and install the necessary components:

sudo apt update
sudo apt upgrade
sudo apt install git mercurial php php-mysql php-gd php-curl php-apcu php-cli php-zip php-json php-mbstring php libapache2-mod-php mysql-server apache2 zip
sudo a2enmod php7.2
sudo a2enmod rewrite

The following command will follow the MySQL security recommendations:

sudo mysql_secure_installation

Specify the root password for the user if it is not installed (where ixnfo is the password):

mysql -u root
use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'ixnfo';
FLUSH PRIVILEGES;
exit;

Create a directory for Phabricator, download it into it, and also download the dependencies:

sudo mkdir /var/www/phabricator
cd /var/www/phabricator
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

We point to the owner’s web files and the group on whose behalf apache2 works:

chown -R www-data:www-data /var/www/phabricator/

Open the new apache2 configuration file in a text editor:

sudo nano /etc/apache2/sites-available/phabricator.ixnfo.com.conf

I will give an example configuration:

<VirtualHost *:80>
ServerName phabricator.ixnfo.com
ServerAdmin test@ixnfo.com

DocumentRoot /var/www/phabricator/phabricator/webroot/

RewriteEngine on
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/phabricator/phabricator/webroot">
Require all granted
</Directory>
</VirtualHost>

We activate the created configuration and check its correctness:

sudo a2ensite phabricator.ixnfo.com
sudo apachectl -t

Let’s make apache2 start at system startup and reboot it to apply the changes made earlier:

sudo systemctl enable apache2
sudo systemctl restart apache2

The commands below indicate the parameters for connecting to the MySQL server (the connection must be made from the root user):

cd /var/www/phabricator/phabricator
./bin/config set mysql.host localhost
./bin/config set mysql.port 3306
./bin/config set mysql.user root
./bin/config set mysql.pass your_password

Run one of the commands below to create the necessary databases and tables:

./bin/storage upgrade
./bin/storage upgrade --force

See also my articles:
How to upgrade Phabricator
Backup Phabricator
Manual installation of Mercurial (hg)
Installing Certbot in Ubuntu
Installing and Configuring the Apache2 Web Server
Installing and configuring MySQL server on Ubuntu

Did my article help you? How about buying me a cup of coffee as an encouragement? Buy me a coffe.

Leave a comment

Leave a Reply