Skip to content

Instantly share code, notes, and snippets.

@araeuchle
Created December 26, 2017 23:34
Show Gist options
  • Save araeuchle/847689903f194c7a5b3ebcff2e0f82a5 to your computer and use it in GitHub Desktop.
Save araeuchle/847689903f194c7a5b3ebcff2e0f82a5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install -y apache2
# create desired folders
if ! [ -L /var/www/html/foxpal ]; then
rm -rf /var/www/html/foxpal
ln -sf /vagrant /var/www/html/foxpal
fi
if ! [ -d /var/www/html/ossn_data ]; then
mkdir -m 0777 /var/www/html/ossn_data
fi
sudo a2enmod rewrite
sudo a2enmod userdir
sudo service apache2 restart
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password secret'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password secret'
sudo apt-get install -y mysql-server
# Needed PHP Modules for OSSN
sudo apt-get install -y php
sudo apt-get install -y php-xml
sudo apt-get install -y php-curl
sudo apt-get install -y php-zip
sudo apt-get install -y php-mcrypt
sudo apt-get install -y php-gd
sudo apt-get install -y php-json
sudo apt-get install -y php-mysql
sudo apt-get install -y libapache2-mod-php
sudo apt-get install -y zip
sudo apt-get install -y curl
# Copy Skeleton Vhost and enable it
WEBROOT="/var/www/html"
VHOSTDIR="/etc/apache2/sites-available/"
VHOSTCONFIG="/vagrant/configurations/skeleton"
PROJECTNAME="dev.foxpal.local"
DBCONFIG="/vagrant/configurations/skeleton.config.db"
SITECONFIG="/vagrant/configurations/skeleton.config.site"
DBDEST="/vagrant/configurations/ossn.config.db.php"
SITEDEST="/vagrant/configurations/ossn.config.site.php"
if ! [ -f "$VHOSTDIR$PROJECTNAME" ]
then
cp "$VHOSTCONFIG" "$VHOSTDIR/$PROJECTNAME.conf"
fi
if ! [ -f "$DBDEST" ]
then
cp "$DBCONFIG" "$DBDEST"
fi
if ! [ -f "$SITEDEST" ]
then
cp "$SITECONFIG" "$SITEDEST"
fi
sudo a2ensite $PROJECTNAME
sudo service apache2 restart
MYSQL_USER="root"
MYSQL_PASSWORD="secret"
DBNAME="foxpal"
sudo mysql -u$MYSQL_USER -p$MYSQL_PASSWORD -e "CREATE DATABASE IF NOT EXISTS $DBNAME;" 2> /dev/null
sudo php /vagrant/install_project.php
sudo service apache2 restart
// Vagrant File:
Vagrant.configure("2") do |config|
config.vm.box = "geerlingguy/ubuntu1604"
config.vm.provision :shell, path: "configurations/bootstrap.sh"
config.vm.network :private_network, ip: "222.222.222.222"
config.vm.synced_folder '.', '/vagrant', nfs: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment