Skip to content

Instantly share code, notes, and snippets.

@jonathonsim
Last active January 14, 2020 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathonsim/5a50a77c8d0fce41b80e37eaa98b239c to your computer and use it in GitHub Desktop.
Save jonathonsim/5a50a77c8d0fce41b80e37eaa98b239c to your computer and use it in GitHub Desktop.
install a simple test version of moodle
#Install moodle via commandline
if [[ -z $5 ]]; then
echo "Usage $0 url dbhost dbname dbuser dbpass"
exit 1
fi
cd ~
curl -O https://download.moodle.org/download.php/direct/stable38/moodle-3.8.1.tgz
tar -xzf moodle-3.8.1.tgz
shopt -s dotglob nullglob
mv moodle/* ~/public_html
rmdir moodle
cd public_html
PREFIX=mo_$(cat /dev/urandom | tr -dc 'a-z_' | fold -w 11 | head -n 1)_
php admin/cli/install.php --lang=en --wwwroot=$1 --dbhost=$2 \
--dbname=$3 --dbuser=$4 --dbpass="$5" --dbport=3306 \
--prefix=$PREFIX --adminpass=$PREFIX --fullname=test --shortname=test --non-interactive --agree-license
@jonathonsim
Copy link
Author

Usage is curl https://gist.github.com/jonathonsim/5a50a77c8d0fce41b80e37eaa98b239c/raw//install-test-moodle.sh | bash -s -- http://testur dbhost testdb dbuser dbpass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment