Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5104443
Ubuntu 16.04.3 Installer Script
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
chad
Aug 18 2017, 4:42 AM
2017-08-18 04:42:51 (UTC+0)
Size
3 KB
Referenced Files
None
Subscribers
None
Ubuntu 16.04.3 Installer Script
View Options
#!/bin/bash
confirm() {
echo "Press RETURN to continue...";
read -e ignored
}
is_fqdn() {
hostname=$1
[[ $hostname == *"."* ]] || return 1
host $hostname > /dev/null 2>&1 || return 1
}
#
# Installation variables. These are the defaults used when running this
# script. You may modify as you need for your environment.
#
DEFAULT_PATH="/var/www/"
DEFAULT_REPO="/var/repo/"
DEFAULT_MYSQL_USER="root"
DEFAULT_MYSQL_HOST="localhost"
#
# Check Ubuntu Version
#
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
fi
#
# Test if using sudo
#
echo "Testing sudo..."
sudo true
if [ $? -ne 0 ]
then
echo "ERROR: You must be able to sudo to run this script.";
exit 1;
fi;
#
# Create the installation path
#
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 [${DEFAULT_PATH}]:" INSTALL_PATH
if [ -z "$INSTALL_PATH" ]
then
INSTALL_PATH="$DEFAULT_PATH"
fi
echo
echo "Phabricator will be installed to: ${INSTALL_PATH}.";
confirm
mkdir -p INSTALL_PATH
#
# Create the repository path
#
echo
read -p "Path to install Phabricator to [${DEFAULT_REPO}]:" INSTALL_REPO
if [ -z "$INSTALL_REPO" ]
then
INSTALL_REPO="$DEFAULT_REPO"
fi
echo
echo "Respositories will be hosted from: ${INSTALL_REPO}.";
confirm
mkdir -p INSTALL_REPO
#
# Set the server domain name
#
echo "Phabricator needs too be installed on it's own domain, like 'phabricator.mycompany.com'";
echo
read -p "Domain Name: " SERVER_NAME
if ! [[ $SERVER_NAME == *"."* ]]
then
echo "ERROR: You must set a valid domain name.";
exit 1;
fi;
echo
echo "Phabricator will served from: http://${SERVER_NAME}.";
confirm
#
# Install Dependencies
#
echo "Let's get cooking.";
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 -b stable https://github.com/phacility/libphutil.git
else
(cd libphutil && git pull --rebase)
fi
if [ ! -e arcanist ]
then
git clone -b stable https://github.com/phacility/arcanist.git
else
(cd arcanist && git pull --rebase)
fi
if [ ! -e phabricator ]
then
git clone -b stable 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: 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
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
752897
Default Alt Text
Ubuntu 16.04.3 Installer Script (3 KB)
Attached To
Mode
P2068 Ubuntu 16.04.3 Installer Script
Attached
Detach File
Event Timeline
Log In to Comment