Skip to content

Install moodle manually

Lea Cohen edited this page Feb 12, 2018 · 1 revision

We are following the instructions in moodle.org with some changes.
Installation on moodle dev server.

  1. Download moodle files to server:
    1.1. Log into PuTTY.
    1.2. Log into moodle dev server (62.0.192.15).
    1.3. Create a new directory to the project under /usr/share/nginx/html: mkdir {projectname}.
    1.4. Clone moodle files from github into the new directory: git clone -b MOODLE_{version}_STABLE https://github.com/moodle/moodle.git pblit.
    1.5. Secure the moodle files as explained in "Secure the Moodle files" section in the docs linked above. You might need to change user to root with: sudo su.
    Notice: Do not run the first command that changes the owner of the directory to "root", we want the owner to be "moodleDev".

  2. Create an empty DB:
    See in the docs under this section the information you should remember for the final installation.
    We are creating the database via HeidiSQL.
    Instructions to install MySQL with cli are in moodle docs for MySQL.

    1. Log into MySQL of moodle dev with HiediSQL.
    2. Create new database:
      2.1. Right click on server name in the left panel.
      2.2. Choose Create new and than database.
      2.3. Name the database "moodle_{projectname}".
      2.4. In the collation drop down choose "utf8_unicode_ci" (In contrast to the docs instruction to use utf8mb4_unicode_ci, since it causes problems).
      2.5. Click ok.
    3. Create database user:
      3.1. Click on the icon of the two people in the top bar (8th from the left), than click הוסף+ in the top left.
      3.2. Name the user "moodledbadmin_{projectname}".
      3.3. Set "From host" to be "localhost".
      3.4. From the password drop down choose an automatic generated, 10 character's length password. Save it aside to later use.
      3.5. Click Add object and choose the database we created previously.
      3.6. Click on the arrow in the left of the db name to open the permissions list. Check the needed permissions according to the MySQL docs linked above in the section of "Command Line", sub section "Add a user/password with the minimum needed permissions".
      3.7. Click שמור.
  3. Create a moodledata directory:
    3.1 Outside /html directory, in /usr/share/nginx, create a new directory: mkdir moodledata-{projectname}.
    3.2. Set permissions to this directory: chmod 0777 moodledata-{projectname}.

  4. Follow "Web based installer" section in the docs to install moodle.
    *notice: In ..... page choose "mariadb" from the drop down.
    *notice: If there is an error in .... page, download the config.php file an upload it again:

    1. Set project directory permission of 0777: chmod 0777 {projectname}. Make sure you are "root" user.
    2. Duplicate config-dist.php to a new config.php file.
    3. Change the fields in the new file to the correct value according to the on-screen values in ..... page.
    4. Return project directory permission to 0755: chmod 0755 {projectname}.
    5. Continue with the web installer.
    6. After moodle is up, in the Installation page create a Super User. This user is created only once.
      Super User details:
      שם משתמש: moodleadmin_{projectname}
      שם פרטי: מנהל/ת
      שם משפחה: משתמש
      כתובת דואר אלקטרוני: support@ort.org.il
      סיסמא: Adminpass_changeme32#
      After Super User is created fill in site details.
      After that create a new user and set him to be admin.
  5. Set up cron:
    5.1. Log into PuTTY.
    5.2. Log into Moodle dev server.
    5.3. Enter crontab to add a task: crontab -e.
    5.4. Press "insert" button on keyboard to make the file editable. 5.5. Add a new task: */1 * * * * /usr/bin/php /usr/share/nginx/html/{projectname}/admin/cli/cron.php >/dev/null.
    5.6. Press "Esc" key to exit edit mode.
    5.7. Type :wp to exit crontab (write & quit).
    If you want to check that the new added task runs, change the destination of the output of the task:

  6. Create a new test_cron.log file in /html directory (it can be placed somewhere else as well).

  7. Follow the previous steps to set up cron. In section 5.5 change the destination from /dev/null (the output goes nowhere) to /usr/share/nginx/html/test_cron.log 2>&1 (the output goes to the new created file. See What does “2>&1” do in command line? for more information about this part of the command).

  8. The task should run every minute. Wait one minute and open test_cron.log file to see if new output was wrriten.

  9. Return the output destination file to be /dev/null.