Skip to content

Instantly share code, notes, and snippets.

@alphaJohnny
Forked from DmitryMiroshnichenko/installOpenVbx.sh
Last active July 16, 2017 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alphaJohnny/c0256a24ed66d45ca0428938378a7708 to your computer and use it in GitHub Desktop.
Save alphaJohnny/c0256a24ed66d45ca0428938378a7708 to your computer and use it in GitHub Desktop.
A simple install script to setup OpenVbx on a Debian with random passwords
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get -y update
apt-get -y upgrade
apt-get -y install apache2 php5 libapache2-mod-php5 php5-mysql php5-curl git mysql-server git pwgen libapache2-mod-auth-mysql
export DBNAME="openvbxexmpl"
export DBUSER="openvbx"
export DBPASS=`pwgen 13 1`
export DIR="vbx.espilo.com"
# if the DIR is not a vhost setup, then enable SED below
echo "Your db user $DBUSER 's password is set to random password $DBPASS; please note this down for your records"
echo "Initializing database $DBNAME; please have your root MySQL password ready"
mysql -p -e "drop database if exists $DBNAME; create database if not exists $DBNAME; GRANT ALL PRIVILEGES ON $DBNAME.* to $DBUSER@localhost IDENTIFIED BY '$DBPASS'; FLUSH PRIVILEGES;"
cd /var/www/html/
#rm -f index.html
git clone git://github.com/twilio/OpenVBX.git $DIR
#cp -rf OpenVBX/* ./
#rm -Rf OpenVBX/
#sed -i -e "s/# RewriteBase \/openvbx/RewriteBase \/$DIR/g" /var/www/html/$DIR/.htaccess
chmod 777 -Rf /var/www/html/$DIR/OpenVBX/config
chmod 777 -Rf /var/www/html/$DIR/audio-uploads
service apache2 restart
echo "Succeed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment