Skip to content

Instantly share code, notes, and snippets.

@zebde
Last active October 28, 2016 14:22
Show Gist options
  • Save zebde/1c193b87d6f1259cacf2da2f53351f11 to your computer and use it in GitHub Desktop.
Save zebde/1c193b87d6f1259cacf2da2f53351f11 to your computer and use it in GitHub Desktop.
Install a DRUPAL with a LAMP stack
#!/bin/bash
# Copyright 2016, https://github.com/zebde
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License at <http://www.gnu.org/licenses/> for
# more details.
# Usage: drupal_install.sh
# Usage: bash -c "$(curl -fsSL https://gist.github.com/zebde/1c193b87d6f1259cacf2da2f53351f11/raw/001-drupal_install.sh)"
# ---------------------------------------------------------------------------
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install -y apache2 mysql-server php5 php5-mysql php5-gd drush
sudo a2enmod rewrite
sudo wget -O /etc/apache2/sites-available/drupal.conf https://gist.githubusercontent.com/zebde/1c193b87d6f1259cacf2da2f53351f11/raw/002-drupal.conf.nginx
sudo a2ensite drupal.conf
sudo a2dissite 000-default.conf
sudo service apache2 restart
sudo mysql_install_db
mysql -h localhost -uroot -proot -e "create database drupal_prod;"
echo "log = /var/log/mysql/query.log" >> /etc/mysql/my.cnf
cd /var/www
sudo drush dl drupal-7.30 --drupal-project-rename=drupal_prod
cd /var/www/drupal_prod
sudo drush site-install --account-name=admin --account-pass=admin --db-url=mysql://root:root@localhost/drupal_prod -y
sudo drush en php corporateclean ckeditor imce devel devel_generate realistic_dummy_content -y
sudo drush vset theme_default corporateclean
sudo chown -R www-data:www-data /var/www
sudo service apache2 restart
<VirtualHost *:80>
ServerAdmin hostmaster@server.com
DocumentRoot /var/www/drupal_prod
ServerName www.drupal-prod.com
ServerAlias drupal-prod.com *.drupal-prod.com
RewriteEngine On
RewriteOptions inherit
CustomLog ${APACHE_LOG_DIR}/drupal-prod.com.log combined
</VirtualHost>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
</Directory>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment