Skip to content

Commit 961cb2c

Browse files
committed
This is a script that should work for installing on RHEL5+ based Linux distributions.
1 parent 48ec1f6 commit 961cb2c

File tree

1 file changed

+144
-0
lines changed

1 file changed

+144
-0
lines changed
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
#!/bin/bash
2+
3+
confirm() {
4+
echo "Press RETURN to continue, or ^C to cancel.";
5+
read -e ignored
6+
}
7+
8+
RHEL_VER_FILE="/etc/redhat-release"
9+
10+
if [[ ! -f $RHEL_VER_FILE ]]
11+
then
12+
echo "It looks like you're not running a Red Hat-derived distribution."
13+
echo "This script is intended to install Phabricator on RHEL-derived"
14+
echo "distributions such as RHEL, Fedora, CentOS, and Scientific Linux."
15+
echo "Proceed with caution."
16+
confirm
17+
fi
18+
19+
echo "PHABRICATOR RED HAT DERIVATIVE INSTALLATION SCRIPT";
20+
echo "This script will install Phabricator and all of its core dependencies.";
21+
echo "Run it from the directory you want to install into.";
22+
echo
23+
24+
RHEL_REGEX="release ([0-9]+)\."
25+
26+
if [[ $(cat $RHEL_VER_FILE) =~ $RHEL_REGEX ]]
27+
then
28+
RHEL_MAJOR_VER=${BASH_REMATCH[1]}
29+
else
30+
echo "Ut oh, we were unable to determine your distribution's major"
31+
echo "version number. Please make sure you're running 6.0+ before"
32+
echo "proceeding."
33+
confirm
34+
fi
35+
36+
if [[ $RHEL_MAJOR_VER < 6 ]]
37+
then
38+
echo "** WARNING **"
39+
echo "A major version less than 6 was detected. Because of this,"
40+
echo "several needed dependencies are not available via default repos."
41+
echo "Specifically, RHEL 5 does not have a PEAR package for php53-*."
42+
echo "We will attempt to install it manually, for APC. Please be careful."
43+
confirm
44+
fi
45+
46+
ROOT=`pwd`
47+
echo "Phabricator will be installed to: ${ROOT}.";
48+
confirm
49+
50+
echo "Testing sudo/root..."
51+
SUDO=""
52+
if [[ $EUID -ne 0 ]] # Check if we're root. If we are, continue.
53+
then
54+
sudo true
55+
SUDO="sudo"
56+
if [[ $? -ne 0 ]]
57+
then
58+
echo "ERROR: You must be able to sudo to run this script, or run it as root.";
59+
exit 1
60+
fi
61+
62+
fi
63+
64+
if [[ $RHEL_MAJOR_VER == 5 ]]
65+
then
66+
# RHEL 5's "php" package is actually 5.1. The "php53" package won't let us install php-pecl-apc.
67+
# (it tries to pull in php 5.1 stuff) ...
68+
echo "Adding EPEL repo, for git."
69+
$SUDO rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
70+
YUMCOMMAND="$SUDO yum install httpd git php53 php53-cli php53-mysql php53-process php53-devel php53-gd gcc wget make pcre-devel"
71+
else
72+
# RHEL 6+ defaults with php 5.3
73+
YUMCOMMAND="$SUDO yum install httpd git php php-cli php-mysql php-process php-devel php-gd php-pecl-apc php-pecl-json"
74+
fi
75+
76+
echo "Dropping to yum to install dependencies..."
77+
echo "Running: ${YUMCOMMAND}"
78+
echo "Yum will prompt you with [Y/n] to continue installing."
79+
80+
$YUMCOMMAND
81+
82+
if [[ $? -ne 0 ]]
83+
then
84+
echo "The yum command failed. Please fix the errors and re-run this script."
85+
exit 1
86+
fi
87+
88+
if [[ $RHEL_MAJOR_VER == 5 ]]
89+
then
90+
# Now that we've ensured all the devel packages required for pecl/apc are there, let's
91+
# set up PEAR, and install apc.
92+
echo "Attempting to install PEAR"
93+
wget http://pear.php.net/go-pear.phar
94+
echo "Downloading PEAR: $PEARCOMMAND"
95+
$SUDO php go-pear.phar && $SUDO pecl install apc
96+
fi
97+
98+
if [[ $? -ne 0 ]]
99+
then
100+
echo "The apc install failed. Continuing without APC, performance may be impacted."
101+
fi
102+
103+
if [[ "$(pidof httpd)" ]]
104+
then
105+
echo "If php was installed above, please run: /etc/init.d/httpd graceful"
106+
else
107+
echo "Please remember to start the httpd with: /etc/init.d/httpd start"
108+
fi
109+
110+
if [[ ! "$(pidof mysql)" ]]
111+
then
112+
echo "Please remember to start the mysql server: /etc/init.d/mysqld start"
113+
fi
114+
115+
confirm
116+
117+
if [[ ! -e libphutil ]]
118+
then
119+
git clone git://github.com/facebook/libphutil.git
120+
else
121+
(cd libphutil && git pull --rebase)
122+
fi
123+
124+
if [[ ! -e arcanist ]]
125+
then
126+
git clone git://github.com/facebook/arcanist.git
127+
else
128+
(cd arcanist && git pull --rebase)
129+
fi
130+
131+
if [[ ! -e phabricator ]]
132+
then
133+
git clone git://github.com/facebook/phabricator.git
134+
else
135+
(cd phabricator && git pull --rebase)
136+
fi
137+
138+
(cd phabricator && git submodule update --init)
139+
140+
echo
141+
echo
142+
echo "Install probably worked mostly correctly. Continue with the 'Configuration Guide':";
143+
echo
144+
echo " http://phabricator.com/docs/phabricator/article/Configuration_Guide.html";

0 commit comments

Comments
 (0)