Last active
September 26, 2016 06:33
-
-
Save tonejito/dca51c6ebbbfd421c5395d82c1d40acf to your computer and use it in GitHub Desktop.
Install Moodle 3.0 on Ubuntu Server 16.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| MYSQL_PW="" | |
| MOODLE_PW="" | |
| # Install software | |
| aptitude update | |
| aptitude --assume-yes safe-upgrade | |
| aptitude --assume-yes install tasksel git curl | |
| tasksel install lamp-server | |
| aptitude --assume-yes install php7.0-xml php7.0-curl php7.0-zip php7.0-gd php7.0-mbstring php7.0-xmlrpc php7.0-soap php7.0-intl | |
| # Configure Apache | |
| echo "AcceptPathInfo On" > /etc/apache2/conf-available/PathInfo.conf | |
| a2enconf PathInfo | |
| service apache2 reload | |
| # Create database | |
| cat > my.sql << EOF | |
| CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; | |
| GRANT ALL PRIVILEGES ON moodle.* TO 'moodle'@'localhost' IDENTIFIED BY '${MOODLE_PW}'; | |
| FLUSH PRIVILEGES; | |
| SHOW GRANTS FOR 'moodle'@'localhost'; | |
| EOF | |
| mysql -v -u root -p${MYSQL_PW} mysql < my.sql | |
| rm -v my.sql | |
| # Test PHP installation | |
| cat > /var/www/html/info.php << EOF | |
| <?php phpinfo(); | |
| EOF | |
| curl -v# 'http://localhost/info.php' | egrep -i 'PHP Version' | |
| # Download and prepare moodle | |
| pushd . | |
| cd /var/www/html/ | |
| git clone --branch MOODLE_30_STABLE https://github.com/moodle/moodle.git | |
| mkdir -vp /var/www/moodledata/ | |
| chown -R www-data:www-data /var/www/{html,moodledata} | |
| popd | |
| # Prepare cron job | |
| # m h dom mon dow command | |
| echo ' 0 * * * * /usr/bin/php /var/www/html/moodle/admin/cli/cron.php > /dev/null' | crontab - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment