# should be run as root and only on Ubuntu 18/20 versions!
echo"Welcome to the MediacMS installation!";
if[`id -u` -ne 0]
thenecho"Please run as root"
exit
fi
while true;do
read -p "
This script will attempt to perform a system update, install required dependencies, install and configure PostgreSQL, NGINX, Redis and a few other utilities.
It is expected to run on a new system **with no running instances of any these services**. Make sure you check the script before you continue. Then enter yes or no
" yn
case$yn in
[Yy]* )echo"OK!"; break;;
[Nn]* )echo"Have a great day"; exit;;
* )echo"Please answer yes or no.";;
esac
done
if[[`lsb_release -d`== *"Ubuntu 20"* ]];then
echo'Performing system update and dependency installation, this will take a few minutes'
echo"This script is tested for Ubuntu 18 and 20 versions only, if you want to try MediaCMS on another system you have to perform the manual installation"
exit
fi
read -p "Enter portal URL, or press enter for localhost : " FRONTEND_HOST
read -p "Enter portal name, or press enter for 'MediaCMS : " PORTAL_NAME
[ -z "$PORTAL_NAME"]&&PORTAL_NAME='MediaCMS'
[ -z "$FRONTEND_HOST"]&&FRONTEND_HOST='localhost'
echo'Creating database to be used in MediaCMS'
su -c "psql -c \"CREATE DATABASE mediacms\"" postgres
su -c "psql -c \"CREATE USER mediacms WITH ENCRYPTED PASSWORD 'mediacms'\"" postgres
su -c "psql -c \"GRANT ALL PRIVILEGES ON DATABASE mediacms TO mediacms\"" postgres
echo'Creating python virtualenv on /home/mediacms.io'