Install Phabricator in CentOS 7

Post date: May 27, 2018 4:30:14 PM

Phabricator is a project management web application. It includes a repository manager, issue tracker, wiki, and other features.

Prerequisites

    • Virtual Machine with root access

    • DNS subdomain. Can use a shared IP address and hosts files, for example:

    • 192.168.1.128 labvm1.home

      • 192.168.1.128 phabricator.labvm1.home

Install CentOS packages

Install git, Nginx, MariaDB, PHP, and other pre-requisite packages:

sudo yum install git nginx mariadb mariadb-server glibc-common

sudo yum install php-gd php-mysqlnd php-pecl-apcu php-fpm

Configure MariaDB

If you've already installed MariaDB or MySQL, you can skip this section.

Configure security options:

sudo /usr/bin/mysql_secure_installation

Enter the new root password.

Press Enter to accept all defaults.

Create a phabricator user in MariaDB:

mysql --user root --password

create user 'phabricator'@'localhost';

grant all privileges on *.* to 'phabricator'@'localhost';

set password for 'phabricator'@'localhost' = password('phabricator_pass);

exit;

Enable and restart MariaDB:

systemctl enable mariadb

systemctl restart mariadb

Download and Configure Phabricator

Determine the DNS subdomain and directory path for the Phabricator install:

phabricator_site=phabricator.`hostname`.local

phabricator_dir=/var/www/phabricator

phabricator_bin=${phabricator_dir}/phabricator/bin

Create the directory and download the software:

mkdir ${phabricator_dir}

cd ${phabricator_dir}

git clone https://github.com/phacility/libphutil.git

git clone https://github.com/phacility/arcanist.git

git clone https://github.com/phacility/phabricator.git

Configure the MariaDB settings for Phabricator:

${phabricator_bin}/config set mysql.host localhost

${phabricator_bin}/config set mysql.user phabricator

${phabricator_bin}/config set mysql.pass phabricator_pass

${phabricator_bin}/storage upgrade --user phabricator --password "$phabricator_pass"

Configure NGinx

Edit nginx.conf to include the "sites-enabled" folder:

vi /etc/nginx/nginx.conf

include /etc/nginx/sites-enabled/*.conf;

Create the NGinx server block for the Phabricator subdomain:

vi /etc/nginx/sites-available/${phabricator_site}.conf

server { server_name phabricator_site; root phabricator_dir/phabricator/webroot; location / { index index.php; rewrite ^/(.*)$ /index.php?__path__=/$1 last; } location /index.php { fastcgi_pass localhost:9000; fastcgi_index index.php; #required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200; #variables to make the $_SERVER populate in PHP fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; } }

Link the configuration from "sites-available" to "sites-enabled":

ln -s /etc/nginx/sites-available/${phabricator_site}.conf /etc/nginx/sites-enabled/

Enable and restart the NGinx service and PHP-FPM:

systemctl enable nginx php-fpm

systemctl restart nginx php-fpm

Phabricator first time setup

Open a web browser to http://phabricator_site

Register the administrator account.

Go to "Config", "Setup Issues", and address the configuration issues listed.