User Tools

Site Tools


computing:moodle

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
computing:moodle [2019/07/06 11:54]
oemb1905
computing:moodle [2019/07/31 19:56] (current)
oemb1905
Line 12: Line 12:
 ------------------------------------------- -------------------------------------------
  
-The pre-requisites+Make sure you have LAMP/FEMP and TLS set up first.  Visit here for help with doing that:  
-  +[[https://jonathanhaack.com/dokuwiki/doku.php?id=computing:apachesurvival|Apache Survival Tutorial]].  Okay, here are the pre-requisite packages:
-  * Using Debian or similar +
-  * Self Hosted Web Server using Apache 2.+
-  * Available Domain with DNS set up +
-  * Self-Signed Certificate is established as backup +
-  * Letsencrypt, using certbot, is established and working+
  
-If you are missing some of these pre-requisites, please visit the [[https://jonathanhaack.com/dokuwiki/doku.php?id=computing:apachesurvival|Apache Survival Tutorial]] I created which covers these topics.  Ok, now that you have all that ready, let'install some php extensions and some other dependencies of Moodle.  +  sudo apt-get install aspell graphviz php-curl php-gd php-intl php-ldap php-mysql php-pspell php-xml php-xmlrpc php-zip php-soap php-mbstring
  
-  sudo apt-get install aspell graphviz php7.0-curl php7.0-gd php7.0-intl php7.0-ldap php7.0-mysql php7.0-pspell php7.0-xml php7.0-xmlrpc php7.0-zip php7.0-soap php7.0-mbstring +Next, let's download the latest moodle and place it in the web-root:
- +
-There is a [[https://www.digitalocean.com/community/tutorials/how-to-install-moodle-on-ubuntu-16-04|Digital Ocean Tutorial]] for Moodle that I used as a jumping off point, but it omits two php packages that are recommended and which I included above.  Next, let's download Moodle and move it to our DocumentRoot for our preferred VirtualHost:+
  
 +  cd ~/Downloads
   curl -L https://download.moodle.org/download.php/direct/stable32/moodle-latest-32.tgz > moodle.tgz   curl -L https://download.moodle.org/download.php/direct/stable32/moodle-latest-32.tgz > moodle.tgz
-  sudo tar -xvzf moodle.tgz -C /var/www/domain.com/public_html/+  sudo tar -xvzf moodle.tgz -C /var/www/lms.haacksnetworking.com/ 
 +  sudo mv /var/www/lms.haacksnetworking.com/moodle /var/www/domain.com/public_html
      
-Now that you have installed the moodle directory into your Web Server'VirtualHost directory, you are ready to set up the Moodle Data directory, which should be outside of the root of the Web Server.  Additionally, change the ownership to the www-data user that Apache uses and give the owner and admin group full permissions as follows:+Create your moodle'data directory (one directory outside of web-root) and provide it proper permissions and make it writeable by www-data user:
  
-  sudo mkdir -p /var/www/domain.com/moodledata +  sudo mkdir /var/www/lms.haacksnetworking.com/moodledata 
-  sudo chown -R www-data /var/www/domain.com/moodledata +  sudo chown www-data -R /var/www/lms.haacksnetworking.com/moodledata 
-  sudo chmod 0770 /var/www/domain.com/moodledata+  sudo chmod 0770 -R /var/www/lms.haacksnetworking.com/moodledata
      
-If you visted the site and tutorial I sharedyou may notice that it some database configurations for Ubuntu that are not required for stock Debian.  As long as you followed the steps for setting up the LAMP stack that I outlined in the Apache Survival tutorial, you should be able to omit these steps and proceed to setting up the database.  Change the underlined parts below:+Now, it is time to ser up your database:
  
   sudo mysql -u root -p   sudo mysql -u root -p
-  CREATE DATABASE __nameofdatabase__ DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;  +  CREATE DATABASE database DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;  
-  create user '__usernameofdatabase__'@'localhost' IDENTIFIED BY '__passwordfordatabaseuser__'; +  create user 'databaseuser'@'localhost' IDENTIFIED BY 'passwordhere'; 
-  GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON __nameofdatabase__.* TO '__usernameofdatabase__'@'localhost' IDENTIFIED BY '__passwordfordatabaseuser__'; +  GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON database.* TO 'databaseuser'@'localhost' IDENTIFIED BY 'passwordhere'; 
-  quit;+  > FLUSH PRIVILEGES; 
 +  > QUIT;
  
 Now the database is set up, so let's restart the mysql service and while we are at it, let's restart apache2 for good measure: Now the database is set up, so let's restart the mysql service and while we are at it, let's restart apache2 for good measure:
Line 52: Line 48:
   sudo chmod -R 777 /var/www/domain.com/public_html/moodle   sudo chmod -R 777 /var/www/domain.com/public_html/moodle
  
-After this, use your web browser of choice and navigate to domain.com/moodle/ and go through the configuration steps.  You will need to specify the __usernameofdatabase__ and the __passwordfordatabaseuser__ you specified above.  Also, pay special attention to the Moodle Data directory and ensure that it populated correctly - sometimes it specifies the wrong directory.  Lastly, on Debian you will encounter an error in the php.config that needs to be resolved.  This glitch is covered on [[https://moodle.org/mod/forum/discuss.php?d=330272|Moodle.net Forums]] and thanks to Marina for identifying that annoyingyet easy to fixconfiguration error!+You may get a glitch with Debian which is covered on [[https://moodle.org/mod/forum/discuss.php?d=330272|Moodle.net Forums]].  If sonavigate hereand edit the php.config file before you continue set-up:
  
   cd /var/www/domain.com/public_html/moodle/   cd /var/www/domain.com/public_html/moodle/
   sudo nano php.config   sudo nano php.config
      
-In the first five lines, the configuration specifies "mysqli" and this needs to be changed to "mariadb" instead.  Once this is done, you should be able to complete the installation options given on the web page.  It is now time to set up Moodle and use the Learning Management System for what it is designed for - learning with FreeSoftware!  Here is a [[https://www.youtube.com/watch?v=DsQNAprWBfg|Moodle Tutorial]] I found helpful.  Now that we are done with the tutorial, take a look at my finished product [[https://jonathanhaack.com/moodle|haackslms]]. +In the first five lines, the configuration specifies "mysqli" and this needs to be changed to "mariadb" instead.  Once this is done, you should be able to complete the installation options given on the web page.  Once moodle is running, set up permissions:  
  
-Moodle recommends the following directory hardening measures:+[Updating Now - please be patient]
  
 1. moodledata directory and all of its contents (and subdirectories, includes sessions): 1. moodledata directory and all of its contents (and subdirectories, includes sessions):
 +
 +  sudo find /var/www/lms.haacksnetworking.com/moodledata -type d -exec chmod g+s {} \;
 +
  
 owner: apache user (apache, httpd, www-data, whatever; see above) owner: apache user (apache, httpd, www-data, whatever; see above)
Line 79: Line 78:
 permissions: 750 on directories, 640 on files. permissions: 750 on directories, 640 on files.
  
-Think of these permissions as the most paranoid ones. You can be secure enough with less tighter permissions, both in moodledata and moodle directories (and subdirectories). +
  
 This tutorial is a designated "Invariant Section" of the "Technotronic" section of Haack's Wiki as described on the [[https://jonathanhaack.com/dokuwiki/doku.php?id=start|Start Page]]. This tutorial is a designated "Invariant Section" of the "Technotronic" section of Haack's Wiki as described on the [[https://jonathanhaack.com/dokuwiki/doku.php?id=start|Start Page]].
  
- --- //[[netcmnd@jonathanhaack.com|oemb1905]] 2018/08/04 16:45//+ --- //[[oemb1905@jonathanhaack.com|oemb1905]] 2019/08/01 01:44//
computing/moodle.txt · Last modified: 2019/07/31 19:56 by oemb1905