Skip to content

Instantly share code, notes, and snippets.

@ijobling
Last active May 15, 2018 14:17
Show Gist options
  • Save ijobling/627397e0326f80f70b0c to your computer and use it in GitHub Desktop.
Save ijobling/627397e0326f80f70b0c to your computer and use it in GitHub Desktop.
##########################################################################
#### Script to copy install process explained in codio Drupal Tutorial at
#### https://codio.com/s/docs/specifics/drupal/
##########################################################################
#### Instructions
#### Option 1.
#### From the Codio Dashboard, create a new project and select the Git Tab
#### and then paste the following URL into the box
#### https://gist.github.com/627397e0326f80f70b0c.git
#### Give your project a name and click Create.
#### Option 2.
#### From the Codio Dashboard, create a new Empty template project.
#### Open a Terminal window from the Tools->Terminal window
#### Copy the contents of this file to a file called 'drupalinst.sh' in the root of your machines file system
#### Then
#### Find the Version number of the latest Drupal by looking at the website at -
#### https://www.drupal.org/project/drupal
#### At the time of writing, it is 7.31
#### If needed, edit the variable on the next line to show the latest version number
DRU_VER="7.31"
#### Then run the script in the terminal window by typing
#### bash drupalinst.sh
#### End of Instructions
##########################################################################
echo
echo " START OF AUTOMATED INSTALL"
echo
# set the hostname variable
CODIO_HOST=`cat /etc/hostname`
WORKSPACE="$HOME/workspace"
# set colour output = echo -e '\E[1;33;44m'
# remove colour = ; tput sgr0
# See http://www.tldp.org/LDP/abs/html/colorizing.html for colour codes
echo -e '\E[1;33;44m' "Download, decompress the latest version of Drupal"; tput sgr0
wget http://ftp.drupal.org/files/projects/drupal-$DRU_VER.tar.gz -O - | tar --strip-components=1 -zxf - drupal-$DRU_VER/ -C $WORKSPACE
echo -e '\E[1;33;44m' "Set up default settings"; tput sgr0
cp sites/default/default.settings.php sites/default/settings.php
echo -e '\E[1;33;44m' "allow the installer to write to the configuration file and folder"; tput sgr0
chmod a+w sites/default/settings.php
chmod a+w sites/default
echo -e '\E[1;33;44m' "Install php mysql and apache services"; tput sgr0
parts install php5 php5-apache2 php5-pdo-mysql php5-gd mysql
echo -e '\E[1;33;44m' "Start the apache and mysql services"; tput sgr0
parts start apache2 mysql
echo -e '\E[1;33;44m' "Create the MySQL database that Drupal will use"; tput sgr0
echo
echo This script uses the default password 'password' - IT IS NOT SECURE!
echo "CREATE DATABASE drupal;" > msqlcmds.txt
echo "USE drupal;" >> msqlcmds.txt
echo "CREATE USER drupaluser@localhost;" >> msqlcmds.txt
# note escaped quotes on line below
echo "SET PASSWORD FOR drupaluser@localhost= PASSWORD(\"password\");" >> msqlcmds.txt
######################## drupaluser ########
echo "GRANT ALL PRIVILEGES ON drupal.* TO drupaluser@localhost IDENTIFIED BY 'password';" >> msqlcmds.txt
######################## wordpressuser ########
echo "FLUSH PRIVILEGES;" >> msqlcmds.txt
echo "exit" >> msqlcmds.txt
echo The password for the MySQL server is blank!
echo You should change it after instalation.
echo -
echo For now - Just press the enter key to enter the blank password
mysql -u root -p < msqlcmds.txt -v
echo -e '\E[1;33;44m' Remove script file"; tput sgr0
rm drupalinst.sh
echo -e '\E[1;33;44m' ".......Drupal Installed!"; tput sgr0
echo -
echo - Two MySQL accounts have been created which
echo are not secure and should be changed;
echo 1. The MySQL admin account:
echo username=root, password is blank
echo 2. The MySQL account used by drupal:
echo username=drupaluser, password=password
echo -
echo You may now use drupal itself to complete the setup.
echo Once in drupal you will be asked login as that user.
echo Make sure you enter drupal for the database name,
echo drupaluser for the username
echo and password for the password
echo -
echo To get to your Drupal site, open your browser and go to -
echo
echo http://"$CODIO_HOST"-3000.codio.io
echo "or"
echo from the Preview menu - the right most Codio menu and select
echo the drop down menu and check New Browser Tab and select Box URL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment