#!/bin/bash
confirm() {
echo "Press RETURN to continue, or ^C to cancel.";
read -e ignored
}
RHEL_VER_FILE="/etc/redhat-release"
if [[ ! -f $RHEL_VER_FILE ]]
then
echo "It looks like you're not running a Red Hat-derived distribution."
echo "This script is intended to install Phabricator on RHEL-derived"
echo "distributions such as RHEL, Fedora, CentOS, and Scientific Linux."
echo "Proceed with caution."
confirm
fi
echo "Phabricator will be installed to: $(pwd).";
confirm
echo "Testing sudo/root..."
if [[ $EUID -ne 0 ]] # Check if we're root. If we are, continue.
then
sudo true
SUDO="sudo"
if [[ $? -ne 0 ]]
then
echo "ERROR: You must be able to sudo to run this script, or run it as root.";
exit 1
fi
fi
echo
echo "Installing Apache...";
echo
sudo dnf install -7 httpd
sudo systemctl enable httpd.service
sudo systemctl start httpd.service
echo
echo "Installing MariaDB...";
echo
sudo dnf install -y mariadb-server
sudo mysql_secure_installation
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
echo
echo "Installing PHP...";
echo
sudo dnf install -y php php-common php-mysqlnd php-gd php-imap php-xml \
php-cli php-opcache php-mbstring php-posix php-curl php-json
sudo systemctl restart httpd
echo
echo "Installing Git, Subversion, Mercurial...";
echo
sudo dnf install -y git subversion mercurial
echo
echo "Installing Accessories...";
echo
sudo dnf install -y npm python-pygments
confirm
if [[ ! -e libphutil ]]
then
git clone https://github.com/phacility/libphutil.git
else
(cd libphutil && git pull --rebase)
fi
if [[ ! -e arcanist ]]
then
git clone https://github.com/phacility/arcanist.git
else
(cd arcanist && git pull --rebase)
fi
if [[ ! -e phabricator ]]
then
git clone https://github.com/phacility/phabricator.git
else
(cd phabricator && git pull --rebase)
fi
cd phabricator
echo "Setting up database connection...";
echo
read -p "Enter MySQL username: " username
bin/config set mysql.user $username
echo
read -p "Enter MySQL password: " password
bin/config set mysql.pass $password
echo
read -p "Enter MySQL hostname: " hostname
bin/config set mysql.host $hostname
echo
bin/storage upgrade --force
echo "Starting phd daemons...";
bin/phd start
echo
echo
echo
echo "Install probably worked mostly correctly. Continue with the 'Configuration Guide':";
echo
echo " https://secure.phabricator.com/book/phabricator/article/configuration_guide/";