Created
February 3, 2015 08:13
-
-
Save fire/f23c280478b20f15a266 to your computer and use it in GitHub Desktop.
TACTIC install on ubuntu 14.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################# | |
# description: Install Tactic 4.1 in Ubuntu 14.04 | |
# date: 11-16-2014 | |
# by: Daniel Bair | |
################################################# | |
tfile="TACTIC-4.1.0.v05.zip" | |
tdir="${tfile%\.*}" | |
cd /home/apache | |
mkdir -v -p /home/apache/install_packages | |
cd /home/apache/install_packages | |
echo -e "\e[0;32m\n*** Downloading $tfile \e[0m\n" | |
sleep 3 | |
if [ -f "./$tfile" ] | |
then | |
echo -e "\t $tfile found, skipping download." | |
sleep 3 | |
else | |
wget "http://community.southpawtech.com/sites/default/files/download/TACTIC%20-%20Enterprise/$tfile" | |
fi | |
echo -e "\e[0;32m\n*** Unzipping $tfile \e[0m\n" | |
sleep 5 | |
rm -rf /home/apache/install_packages/$tdir | |
unzip $tfile | |
cd /home/apache/install_packages/$tdir/src/install/ | |
echo -e "\e[0;32m\n*** Setting up python2.7 environment for tactic\e[0m\n" | |
sleep 3 | |
sudo mkdir -v -p /usr/lib/python2.7/dist-packages/tacticenv | |
sudo chmod 755 /usr/lib/python2.7/dist-packages/tacticenv | |
echo " | |
TACTIC_INSTALL_DIR='/home/apache/tactic' | |
TACTIC_SITE_DIR='' | |
TACTIC_DATA_DIR='/home/apache/tactic_data'" | sudo tee -a data/tactic_paths.py > /dev/null | |
sudo cp -v data/*.py /usr/lib/python2.7/dist-packages/tacticenv | |
sudo chmod a+r /usr/lib/python2.7/dist-packages/tacticenv/*.py | |
echo -e "\e[0;32m\n*** Installing tactic service\e[0m\n" | |
sleep 3 | |
sudo cp -v service/tactic /etc/init.d/ | |
sudo chmod 775 /etc/init.d/tactic | |
echo -e "\e[0;32m\n*** Installing tactic postgres config\e[0m\n" | |
sleep 3 | |
pgver=`pg_lsclusters -h | head -n1 | cut -d' ' -f1` | |
sudo mv -v -n /etc/postgresql/$pgver/main/pg_hba.conf /etc/postgresql/$pgver/main/pg_hba.conf--ORIG | |
sudo cp -v postgresql/pg_hba.conf /etc/postgresql/$pgver/main/ | |
sudo chown postgres:postgres /etc/postgresql/$pgver/main/pg_hba.conf | |
sudo /etc/init.d/postgresql restart | |
echo -e "\e[0;32m\n*** Installing tactic apache2 config\e[0m\n" | |
sleep 3 | |
sudo a2enmod lbmethod_byrequests | |
sudo a2enmod proxy_balancer | |
sudo a2enmod proxy_http | |
sudo a2enmod rewrite | |
echo -e "\e[0;32m\n*** Uncommenting the two apache 2.4 config lines 'Require all granted' now\e[0m\n" | |
sleep 3 | |
sed -i "s/#Req/Req/g" apache/tactic.conf | |
sudo cp -v apache/tactic.conf /etc/apache2/conf-available/ | |
sudo ln -v -f -s /etc/apache2/conf-available/tactic.conf /etc/apache2/conf-enabled/ | |
echo -e "\e[0;32m\n*** Restarting apache2 service\e[0m\n" | |
sleep 3 | |
sudo service apache2 restart | |
echo -e "\e[0;32m\n*** Creating /var/www/index.html redirect\e[0m\n" | |
sleep 3 | |
echo '<META http-equiv="refresh" content="0;URL=/tactic">' | sudo tee /var/www/index.html > /dev/null | |
sudo mkdir -v -p /var/www/html | |
sudo cp -v /var/www/index.html /var/www/html/ | |
echo -e "\e[0;32m\n*** Running main tactic installer...\e[0m\n" | |
sleep 3 | |
sudo python2.7 install.py | |
echo -e "\e[0;32m\n*** Installing tactic license\e[0m\n" | |
sleep 3 | |
sudo chown -R apache:apache /home/apache | |
cp -v /home/apache/tactic/src/install/start/config/tactic-license.xml /home/apache/tactic_data/config/ | |
echo -e "\e[0;32m\n*** Running tactic database upgrade...\e[0m\n" | |
sleep 3 | |
python /home/apache/tactic/src/bin/upgrade_db.py | |
echo -e "\e[0;32m\n*** Fist-run tactic test\e[0m\n\t Press Ctrl-C when done...\e[0m\n" | |
sleep 3 | |
python /home/apache/tactic/src/bin/startup_dev.py | |
echo -e "\e[0;32m\n*** Setting tactic service to start at boot\e[0m\n" | |
sleep 3 | |
sudo update-rc.d tactic defaults | |
echo -e "\e[0;32m\n*** Starting tactic service\e[0m\n" | |
sleep 3 | |
sudo service tactic start | |
echo -e '\e[0;32m\n*** All Done!\e[0m\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
################################################# | |
# description: Install Tactic 4.1 in Ubuntu 14.04 | |
# date: 11-16-2014 | |
# by: Daniel Bair | |
################################################# | |
echo -e "\e[1;31m\n*** Installing required ubuntu packages\e[0m\n" | |
sleep 3 | |
sudo apt-get install apache2 gcc imagemagick libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev liblcms1-dev libpng-dev libxml2-dev libxslt1-dev make ntp ntpdate openssh-server postgresql postgresql-server-dev-all python python-crypto python-dev python-pil python-pythonmagick python-psycopg2 python-pycryptopp python-lxml python-imaging python-simplejson python-sql samba unzip vim vim-nox zlib1g-dev | |
# This will fail on Ubuntu 14.04 without the trusty-media ppa | |
sudo apt-get install ffmpeg | |
echo -e "\e[1;31m\n*** Apparmor can cause conflicts with tactic\e[0m" | |
read -r -p "Do you want to remove it? [y/N] " response | |
response=${response,,} # tolower | |
if [[ $response =~ ^(yes|y)$ ]] | |
then | |
echo -e "\n\t Removing apparmor to avoid conflicts with tactic\e[0m\n" | |
sleep 3 | |
sudo /etc/init.d/apparmor stop | |
sudo update-rc.d -f apparmor remove | |
sudo apt-get remove apparmor apparmor-utils | |
fi | |
echo -e "\e[1;31m\n*** Dash is configured by default for /bin/sh and can cause conflicts with tactic\e[0m" | |
read -r -p "Do you want to change it? [y/N] " response | |
response=${response,,} # tolower | |
if [[ $response =~ ^(yes|y)$ ]] | |
then | |
echo -e "\n\t Reconfiguring now...\e[0m" | |
sleep 3 | |
sudo dpkg-reconfigure dash | |
fi | |
echo -e "\e[1;31m\n*** For your convience, you can change the root user password now\e[0m" | |
read -r -p "Do you want to change it? [y/N] " response | |
response=${response,,} # tolower | |
if [[ $response =~ ^(yes|y)$ ]] | |
then | |
echo | |
sudo passwd root | |
fi | |
echo -e "\e[1;31m\n*** Adding apache user and group\e[0m\n" | |
sleep 3 | |
sudo groupadd --gid 48 apache | |
sudo useradd -c Apache -d /home/apache -s /bin/bash --uid 48 --gid 48 -m apache | |
sudo usermod -c Apache -d /home/apache -s /bin/bash apache | |
sudo mkdir -v -p /home/apache | |
sudo chown -R apache:apache /home/apache | |
sudo chmod -R a+rx /home/apache | |
echo -e "\e[1;31m\n*** Please set apache user password now\e[0m\n" | |
sleep 3 | |
sudo passwd apache | |
echo -e "\e[1;31m\n*** Please add the line below after '# User privilege specification' \e[0m\n\tapache ALL=(ALL) ALL" | |
sleep 10 | |
sudo visudo | |
echo -e "\e[1;31m\n*** Copying second install script to apache user home directory\e[0m\n" | |
sleep 3 | |
sudo -u apache mkdir -v -p /home/apache/install_packages | |
sudo -u apache cp -v ./tactic_apache_install.sh /home/apache/install_packages/ | |
# This checks to see if TACTIC zip file is already downloaded | |
dfile="TACTIC-4.1.0.v05.zip" | |
if [ -f "./$dfile" ] | |
then | |
echo -e "\e[1;31m\n*** $dfile found. Copying to apache home directory\e[0m\n" | |
sudo -u apache cp -v "./$dfile" /home/apache/install_packages/ | |
fi | |
sudo chown -R apache:apache /home/apache | |
sudo chmod -R a+rx /home/apache | |
# Now logging in as apache user and running the second install script | |
echo -e "\e[1;31m\n*** Logging in as apache user and running second install script now...\e[0m\n" | |
sleep 5 | |
exec sudo -i -u apache /bin/bash /home/apache/install_packages/tactic_apache_install.sh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment