Installing Drupal on Ubuntu 16.04

  • Install LAMP stack
apt -y install openssh-server
apt -y install tasksel
tasksel install lamp-server
  • Some basic stuff
apt -y install vim g++ build-essential subversion python-mysqldb imagemagick php-gd php-dom php-xml php-mbstring postfix
echo "<?php phpinfo(); ?>" > /var/www/html/testphp.php
  • visit server and check php is running
  • now add webmin
echo 'deb http://download.webmin.com/download/repository sarge contrib' >> /etc/apt/sources.list
wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add -
apt-get update; apt -y install webmin
systemctl status webmin # restart if there are problems
  • Make sure opcache is installed and running (by looking at testphp.php). If not, make change in php.ini below.
  • configure Apache
  • unfortunately you may have to configure each instance to have Options FollowSymLinks
vi /etc/apache2/apache2.conf #and add the following:
<Directory /home/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

vi /etc/php5/apache2/php.ini
 # change memory_limit = 256M
 # opcache.enable=1 (& remove ; )

 # [dba]
 # extension=pdo.so
 # extension=pdo_mysql.so

a2enmod rewrite
service apache2 restart
  • Check out the dget suite of utilities
DGETDIR=/root/dget
svn co http://svn.code.sf.net/p/drupal-get/code/trunk $DGETDIR
cp $DGETDIR/rename-to-dsite-defaults.conf $DGETDIR/dsite-defaults.conf
vi $DGETDIR/dsite-defaults.conf # make changes for this server

cp $DGETDIR/rename_to_settings.sh $DGETDIR/settings.sh

$DGETDIR/setup.sh $DGETDIR #only check out Drupal versions needed
svn co https://subversion.assembla.com/svn/drupal_core/pressflow6 /opt/pr6/core # optional for pressflow 6
dsite update
$DGETDIR/makecommon.sh

#install Drush
wget http://files.drush.org/drush.phar -o /opt/dr8/drush
chmod +x /opt/dr8/drush
ln -sfn /opt/dr8/drush /usr/local/bin/drush

  • Create drupal database user
    • Note that CiviCRM needs more access to its database
DRUSR=drupalusername
DRPW=mylongdrupalpassword
echo "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON *.* TO '$DRUSR'@'localhost' IDENTIFIED BY '$DRPW';" | mysql -u root -p
  • optionally install writeup
svn co --username andrewfn http://quadruple.unfuddle.com/svn/quadruple_cleanwriter /opt/writeupsource
cd /opt/writeupsource
branches/130/make130.sh
make -j2 -C trunk/ && tests/wtall.sh
ln -sfn /opt/writeupsource/trunk/writeup /usr/local/bin/
writeup -V
  • create Drupal 7 instance:
SITE=/home/demo7
dsite create $SITE -d 7 -u "demo7.isnew.org" -C "Drupal 7 demo" -s dev
#visit site and set up Drupal
dsite secure $SITE
#copy cron key from http://demo7.isnew.org/#overlay=admin/config/system/cron
dsite config $SITE --cron 'cron key from above'
dscan #add to backup and cron scripts
  • Setting up CiviCRM
apt install php-curl php-soap