Phabricator is a free and open source suite of web applications for software development. It is built using PHP and uses MySQL to store its data. Phabricator help teams to develop different software applications. It is based on Facebook's internal tools. Phabricator is made up of mainly four components. Differential, a code review tool. Diffusion, a repository browser. Maniphest, a bug tracker and Phriction, a wiki. Apart from this it also contains a number of small tools. Phabricator integrates with Git, Mercurial and SVN. It is a very popular application and used by major companies such as Facebook, Fedora, Dropbox, Uber, Quora, Disqus etc.
Phabricator can be installed on systems with a small amount of RAM. You can also install it on your personal computer. To follow this tutorial you will need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run
sudo -i to switch to root user. You will also need a domain name pointed towards your system.
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y update
Once you have your system updated, you can proceed to install the LAMP stack. Start the LAMP installation by installing Apache web server and MariaDB, which is a fork of MySQL using the following command.
yum -y install httpd mariadb-server mariadb mod_ssl
Although Phabricator can be installed on earlier versions of PHP but we will be installing it on the latest version of PHP which is PHP 7.1. The default YUM repository contains PHP version 5.4 only, hence we will need to use the Webtatic repository to install a version of PHP greater than 5.4. Run the following commands for installing EPEL repository as EPEL repository is required before we install Webtatic repository.
yum -y install epel-release
yum -y update
yum clean all
Now install Webtatic repository using the following commands.
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y update
To install PHP 7.1 and all the required PHP modules, run the following command.
yum -y install php71w php71w-cli php71w-mysqli php71w-gd php71w-mbstring php71w-curl php71w-iconv php71w-pcntl php71w-opcache
Once PHP is installed, you will need to configure few thing in php.ini configuration. Open
/etc/php.ini using your favorite editor.
If you do not have nano installed, you can install it using
yum -y install nano. Scroll down to find the following lines.
; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit memory_limit = 128M
You can increase the
memory_limit to a higher amount so that the processing of PHP can also be done faster. Next, find the following line,
[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone ;date.timezone =
Change the timezone according to your country.
Next, find the following lines and set their values according to instructions provided.
post_max_size = 8M #Change it to at least 32M upload_max_filesize = 2M #Change it to at least 32M
Save the file and exit from the editor.
Once the PHP settings are configured, start Apache web server and enable it to start at boot time, run the following command.
systemctl start httpd
systemctl enable httpd
Start MariaDB and enable it to start at boot time using the following commands.
systemctl start mariadb
systemctl enable mariadb
Now run the following command to secure your MariaDB installation.
It will run a small script which asks you to provide the root password for MariaDB. As we have just installed MariaDB, the root password is not set, just press enter to proceed further. It will ask you if you want to set a root password for your MariaDB installation, choose
y and set a strong password for the installation. It will also ask you about removing test databases and anonymous users. Most of the questions are self-explanatory and you should answer
y to all the questions.
You can proceed further to install Git as it is required to clone the Phabricator repository. Install Git using following command.
yum -y install git
Now clone the required Phabricator files using following commands.
git clone https://github.com/phacility/libphutil.git
git clone https://github.com/phacility/arcanist.git
git clone https://github.com/phacility/phabricator.git
Once the above files are cloned. Setup the database credentials using the following commands.
./bin/config set mysql.host localhost
./bin/config set mysql.port 3306
./bin/config set mysql.user root
./bin/config set mysql.pass <MySQL-root-password>
Now populate the database using the following command.
You will be asked the following question when you run above command.
Before running storage upgrades, you should take down the Phabricator web interface and stop any running Phabricator daemons (you can disable this warning with --force).
Are you ready to continue? [y/N] y
Y to continue, the database will now be populated.
You can proceed further to provide the ownership of the files to the Apache web server process using the following command.
chown -R apache:apache /var/www/phabricator
You will also need to disable your SELinux otherwise, Phabricator won't be able to connect to the database. To temporary disable SELinux without restarting the server, run the following command.
To completely disable the SELinux you will need to edit
If you don't have nano installed, you can install it using yum -y install nano Find the following line:
Change it to:
Now you will need to reboot your server so that the new configuration can take effect.
It is recommended to use SSL for accessing Phabricator application through the web interface. Now we will need to generate SSL certificates from Let's Encrypt client. If you can want to use commercial SSL certificates instead, you can purchase SSL certificates from HostPresto.
To install Let's Encrypt client also called Certbot. Now install Certbot using the following command.
yum -y install python-certbot-apache
Once the installation finishes, run the following command to obtain the SSL certificates from Let's Encrypt. Make sure that your domain is pointed to the server, the Let's Encrypt will check the domain authority before providing the certificates.
certbot certonly --standalone -d yourdomain.com
This command will run Let's Encrypt client to obtain the certificates only but not to install it.
--standalone tells the client to use in-built web server for authentication of domain authority.
-d yourdomain.com tells the domain name for which the certificates needs to be obtained. It may ask you which SSL configuration to use during authentication, choose
ssl.conf. All the changes made to the file will be automatically restored. Finally, provide your email address and accept the terms and condition. Once the certificates are generated, they are likely to be stored in the following directory.
yourdomain.com is your actual domain or subdomain. In the directory, you will find
cert.pem which is your domains certificate and
privkey.pem which is your certificate's private key.
Let's Encrypt SSL expires in 90 days, so it is recommended to set an automatic renewal for your certificates. Run the following command to open your crontab file.
Enter the following line into the crontab file.
30 1 * * 1 /usr/bin/certbot renew >> /var/log/le-renew.log
The above cron job will automatically run every Monday at 1:30 AM and if your certificates are due for expiry, it will automatically renew them.
As the SSL certificates are now generated, we can proceed further to configure httpd configuration file. Create a new virtual host file for Phabricator using the following command.
yourdomain.com with your actual domain. Now copy and paste the following lines into the file.
<VirtualHost *:80> ServerName yourdomain.com Redirect permanent / https://yourdomain.com/ TransferLog /var/log/httpd/yourdomain.com_access.log ErrorLog /var/log/httpd/yourdomain.com_error.log </VirtualHost>
<VirtualHost *:443> ServerName yourdomain.com DocumentRoot /var/www/phabricator/phabricator/webroot ServerAdmin email@example.com SSLEngine On SSLCertificateFile /etc/letsencrypt/live/yourdomain.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/yourdomain.com/privkey.pem RewriteEngine on RewriteRule ^/rsrc/(.*) - [L,QSA] RewriteRule ^/favicon.ico - [L,QSA] RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
<Directory /var/www/phabricator/phabricator/webroot> AllowOverride All Require all granted </Directory>
TransferLog /var/log/httpd/yourdomain.com_ssl_access.log ErrorLog /var/log/httpd/yourdomain.com_ssl_error.log </VirtualHost>
In the above configuration change
yourdomain.com to your actual domain. Also, make sure that the path to your SSL certificate and private key are correct. Once done, you will have to restart your Apache server so that the changes made can take effect.
systemctl restart httpd
You can now access the web interface of your Phabricator installation by going to the following URL.
If you have followed the tutorial correctly, you will see the following screen to setup administrator account else you will see a page with errors in installation.
Provide the administrators details asked, and click Create Admin Account button. You will be now taken to your administrative dashboard.
Finally, you will need to configure few things before using the application for the production environment.
Start Phabricator daemon using the following command so that Phabricator can do the required background tasks.
Next, configure the Base URI using the following command. It is important to configure the Base URI as most of the features in the application will be unavailable unless Base URI is configured. Run the following command for same.
./bin/config set phabricator.base-uri 'https://yourdomain.com'
Replace your domain with the exact domain name you use to access the application.
Set the local repository path using following commands.
chown -R apache:apache /var/repo
Your application is now ready to use.
In this tutorial, we have learned how to install Phabricator on CentOS 7. You can now easily deploy the application on your server and use it for software development.