Page MenuHomePhabricator

Ubuntu 16.04.3 Installer Script

Authored By
chad
Aug 14 2017, 4:40 AM
Size
3 KB
Referenced Files
None
Subscribers
None

Ubuntu 16.04.3 Installer Script

#!/bin/bash
confirm() {
echo "Press RETURN to continue, or ^C to cancel.";
read -e ignored
}
GIT='git'
LTS="Ubuntu 16.04.3"
ISSUE=`cat /etc/issue`
if [[ $ISSUE != Ubuntu* ]]
then
echo "This script is intended for use on Ubuntu, but this system appears";
echo "to be something else. Your results may vary.";
echo
confirm
elif [[ `expr match "$ISSUE" "$LTS"` -eq ${#LTS} ]]
then
GIT='git-core'
fi
echo "Testing sudo..."
sudo true
if [ $? -ne 0 ]
then
echo "ERROR: You must be able to sudo to run this script.";
exit 1;
fi;
echo "PHABRICATOR UBUNTU INSTALL SCRIPT";
echo "This script will install Phabricator and all of its core dependencies.";
echo
read -p "Path to install Phabricator to [/var/www/]:" INSTALL_PATH
echo
if [ -z "$INSTALL_PATH" ]
then
INSTALL_PATH="/var/www/"
fi
# TODO: Check install path and create if needed
#
echo
echo "Phabricator will be installed to: ${INSTALL_PATH}.";
echo
confirm
echo "Phabricator needs too be installed on it's own domain, like 'phabricator.mycompany.com'";
echo
read -p "Domain Name: " SERVER_NAME
echo
echo
echo "Phabricator will served from: http://${SERVER_NAME}.";
echo
confirm
# TODO: Check domain name
#
echo "Let's get cooking.";
echo
echo "Adding apt-repository for PHP 7.1...";
echo
sudo add-apt-repository -y ppa:ondrej/php
echo "Installing dependencies: git, svn, hg, apache, mysql, php...";
echo
set +x
# TODO: APCu for 7.1?
#
sudo apt-get -qq update
sudo apt-get install \
$GIT mysql-server apache2 dpkg-dev \
php7.1 php7.1-cli php7.1-common php7.1-curl php7.1-gd php7.1-json \
php7.1-mbstring php7.1-mysql php7.1-opcache php7.1-xml php7.1-apcu \
npm subversion mercurial python-pygments sendmail
# Enable mod_rewrite
#
sudo a2enmod rewrite
sudo systemctl restart apache2
# Download from GitHub (maybe use stable?)
#
cd $INSTALL_PATH
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
# Set local config variables for Phabricator
#
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
bin/config set phabricator.base-uri 'http://${SERVER_NAME}'
# Launch the daemons
#
echo "Starting phd daemons...";
bin/phd start
echo
# TODO: Write the Apache sites-available file
#
# <VirtualHost *>
# ServerName {$SERVER_NAME}
# DocumentRoot /var/www/phabricator/webroot
# RewriteEngine on
# RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
# </VirtualHost>
#
# <Directory "/var/www/phabricator/webroot">
# Require all granted
# </Directory>
# TODO: Restart Apache
#
# TODO: Allow this to be configured above
#
mkdir -p '/var/repo/'
# TODO: Set the server timezone to php.ini
#
TIMEZONE = `cat /etc/timezone`
# Peace out.
#
echo
echo
echo "Install probably worked ok. Continue at your local install:";
echo
echo " http://{$SERVER_NAME}";
echo

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
748303
Default Alt Text
Ubuntu 16.04.3 Installer Script (3 KB)

Event Timeline