When a user submits "isEditing" inlines and chooses to publish them, publish their...
[phabricator/blender.git] / scripts / install / install_rhel-derivs.sh
blob8c856ba40f2f76fd20fbf101a1c15bad4683bea1
1 #!/bin/bash
3 confirm() {
4 echo "Press RETURN to continue, or ^C to cancel.";
5 read -e ignored
8 RHEL_VER_FILE="/etc/redhat-release"
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
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
24 RHEL_REGEX="release ([0-9]+)\."
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
36 if [[ $RHEL_MAJOR_VER < 6 && $RHEL_MAJOR_VER > 0 ]]
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
46 echo "Phabricator will be installed to: $(pwd).";
47 confirm
49 echo "Testing sudo/root..."
50 if [[ $EUID -ne 0 ]] # Check if we're root. If we are, continue.
51 then
52 sudo true
53 SUDO="sudo"
54 if [[ $? -ne 0 ]]
55 then
56 echo "ERROR: You must be able to sudo to run this script, or run it as root.";
57 exit 1
62 if [[ $RHEL_MAJOR_VER == 5 ]]
63 then
64 # RHEL 5's "php" package is actually 5.1. The "php53" package won't let us install php-pecl-apc.
65 # (it tries to pull in php 5.1 stuff) ...
66 yum repolist | grep -i epel
67 if [ $? -ne 0 ]; then
68 echo "It doesn't look like you have the EPEL repo enabled. We are to add it"
69 echo "for you, so that we can install git."
70 $SUDO rpm -Uvh https://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
72 YUMCOMMAND="$SUDO yum install httpd git php53 php53-cli php53-mysql php53-process php53-devel php53-gd gcc wget make pcre-devel mysql-server"
73 else
74 # RHEL 6+ defaults with php 5.3
75 YUMCOMMAND="$SUDO yum install httpd git php php-cli php-mysql php-process php-devel php-gd php-pecl-apc php-pecl-json php-mbstring mysql-server"
78 echo "Dropping to yum to install dependencies..."
79 echo "Running: ${YUMCOMMAND}"
80 echo "Yum will prompt you with [Y/n] to continue installing."
82 $YUMCOMMAND
84 if [[ $? -ne 0 ]]
85 then
86 echo "The yum command failed. Please fix the errors and re-run this script."
87 exit 1
90 if [[ $RHEL_MAJOR_VER == 5 ]]
91 then
92 # Now that we've ensured all the devel packages required for pecl/apc are there, let's
93 # set up PEAR, and install apc.
94 echo "Attempting to install PEAR"
95 wget https://pear.php.net/go-pear.phar
96 $SUDO php go-pear.phar && $SUDO pecl install apc
99 if [[ $? -ne 0 ]]
100 then
101 echo "The apc install failed. Continuing without APC, performance may be impacted."
104 pidof httpd 2>&1 > /dev/null
105 if [[ $? -eq 0 ]]
106 then
107 echo "If php was installed above, please run: /etc/init.d/httpd graceful"
108 else
109 echo "Please remember to start the httpd with: /etc/init.d/httpd start"
112 pidof mysqld 2>&1 > /dev/null
113 if [[ $? -ne 0 ]]
114 then
115 echo "Please remember to start the mysql server: /etc/init.d/mysqld start"
118 confirm
120 if [[ ! -e libphutil ]]
121 then
122 git clone https://github.com/phacility/libphutil.git
123 else
124 (cd libphutil && git pull --rebase)
127 if [[ ! -e arcanist ]]
128 then
129 git clone https://github.com/phacility/arcanist.git
130 else
131 (cd arcanist && git pull --rebase)
134 if [[ ! -e phabricator ]]
135 then
136 git clone https://github.com/phacility/phabricator.git
137 else
138 (cd phabricator && git pull --rebase)
141 echo
142 echo
143 echo "Install probably worked mostly correctly. Continue with the 'Configuration Guide':";
144 echo
145 echo " https://secure.phabricator.com/book/phabricator/article/configuration_guide/";