Install Phabricator on a CentOS 7 VPS
In today’s article we will cover the steps on how to install Phabricator on a CentOS 7 VPS with Apache web server, PHP and MariaDB the enhanced, drop-in replacement for MySQL.
Phabricator is an open source collection of web applications which help software companies build better software. It includes the Differential code review tool, the Diffusion repository browser, the Herald change monitoring tool, the Maniphest bug tracker and the Phriction wiki. 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 applications for:
- reviewing and auditing code;
- hosting Git/Hg/SVN repositories;
- browsing repositories;
- tracking bugs or “features”;
- hiding stuff from coworkers;
- and also some other things like meme generators
We will be using our SSD 1 Linux VPS Hosting plan for this tutorial.
UPDATE THE SYSTEM
Log in to your server as user root and first of all make sure that all packages are up to date:
# yum -y update
# yum install mariadb-server mariadb -y
Start MariaDB and add it to automatically start on system start-up:
# systemctl start mariadb.service # systemctl enable mariadb.service
Now we need to run the post-installation script ‘mysql_secure_installation’ in order to set a root password:
# mysql_secure_installation - Set root password? [Y/n] y - Remove anonymous users? [Y/n] y - Disallow root login remotely? [Y/n] y - Remove test database and access to it? [Y/n] y - Reload privilege tables now? [Y/n] y
INSTALL APACHE AND PHP
To install Apache you need to execute the following command:
# yum install httpd -y
Start the web server and enable it to start at boot:
# systemctl enable httpd.service # systemctl start httpd.service
Install PHP and a few PHP extensions required by Phabricator:
# yum install php php-mysql php-gd php-curl php-apc php-cli -y
We will also need to install Git and the command below does exactly that:
# yum install git
Let’s create and enter the directory in which we will download Phabricator. Issue the following:
# mkdir /var/www/html/myapp # cd /var/www/html/myapp
Then, clone the needed Git repositories from Phacility:
# git clone https://github.com/phacility/libphutil.git # git clone https://github.com/phacility/arcanist.git # git clone https://github.com/phacility/phabricator.git
Your next step is to create a virtual host directive in Apache. So open the Apache configuration file with your favorite text editor. We are using vim for this purpose:
# vim /etc/httpd/conf/httpd.conf
At the bottom of the file, paste the following:
<VirtualHost *:80> ServerAdmin [email protected]_domain ServerName your_domain 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] <Directory "/var/www/html/myapp/phabricator/webroot"> Order allow,deny Allow from all </Directory> </VirtualHost>
Of course you need to replace your_domain with the domain of your choice.
Restart Apache for the changes to take effect:
# systemctl restart httpd
Enter the phabricator directory:
# cd phabricator
Now, it’s time to configure MariaDB. Execute the following commands
# ./bin/config set mysql.host localhost # ./bin/config set mysql.user root # ./bin/config set mysql.pass your_mariadb_root_password
Run the storage upgrade script and press Y when prompted. This procedure will load the database schema:
# ./bin/storage upgrade --user root --password your_mariadb_root_password
Restart MariaDB for the changes to take effect:
# systemctl restart mariadb
Now open your favorite web browser and navigate to: httpd://your_domain. As you can see from the image below, our current installation cannot proceed because the server is lacking the mbstring PHP extension.
Therefore, let’s install it:
# yum install php-mbstring
And, of course we must restart Apache:
# systemctl restart httpd
Refresh your web browser and continue with the installation. Setup your admin account in the following window and click Create Admin Account. After you are logged in you should check if have some unresolved setup issues to take care of. Click the link in the yellow banner at the top of the screen to see them, or find them in the Config application under Setup Issues.
Congratulations. You have successfully installed Phabricator on your CentOS 7 VPS.
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting 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 please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.