Skip to content

Instantly share code, notes, and snippets.

@otarza
Created May 27, 2015 12:46
Show Gist options
  • Save otarza/5c9f4087aaaa53e72de0 to your computer and use it in GitHub Desktop.
Save otarza/5c9f4087aaaa53e72de0 to your computer and use it in GitHub Desktop.
Drupal Environment
#!/usr/bin/env bash
# Use single quotes instead of double quotes to make it work with special-character passwords
PASSWORD='12345678'
PROJECTFOLDER='gdson'
# create project folder
sudo mkdir "/sites/${PROJECTFOLDER}"
# update / upgrade
sudo apt-get update
sudo apt-get -y upgrade
# install apache 2.5 and php 5.5
sudo apt-get install -y apache2
sudo apt-get install -y php5
# install mysql and give password to installer
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password $PASSWORD"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $PASSWORD"
sudo apt-get -y install mysql-server
sudo apt-get install php5-mysql php5-curl
# install phpmyadmin and give password(s) to installer
# for simplicity I'm using the same password for mysql and phpmyadmin
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password $PASSWORD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password $PASSWORD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password $PASSWORD"
sudo debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2"
sudo apt-get -y install phpmyadmin
# setup hosts file
VHOST=$(cat <<EOF
<VirtualHost *:80>
ServerName gdson.dev
ServerAlias www.gdson.dev
DocumentRoot "/sites/${PROJECTFOLDER}"
<Directory "/sites/${PROJECTFOLDER}">
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
ErrorLog /sites/logs/${PROJECTFOLDER}.log
CustomLog /sites/logs/${PROJECTFOLDER}_access.log combined
</VirtualHost>
EOF
)
echo "${VHOST}" > /etc/apache2/sites-available/000-default.conf
# enable mod_rewrite
sudo a2enmod rewrite
# restart apache
service apache2 restart
# install git
sudo apt-get -y install git
# install curl
sudo apt-get install -y curl
# install Composer
curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# install drush
sudo composer global require drush/drush:6.*
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc
wget http://download.pear.php.net/package/Console_Table-1.1.3.tgz
tar -xzf Console_Table-1.1.3.tgz
sudo mv Console_Table-1.1.3 /home/vagrant/.composer/vendor/drush/drush/lib/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment