Friday, September 03, 2021

fresh moodle installation

Earlier, I had just duplicated moodle installations by backing up and restoring. Now a fresh install, for which:

  1. Set up the moodle files using git as in my previous post.

  2. Logged on to the database server, and created the required database and user as mentioned in the documentation - not as a single command, which doesn't seem to work, but as separate commands. Since the user is not on localhost, it is currently set up as 'username'@'%'
    mysql> CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    mysql> CREATE USER moodleuser@'%' IDENTIFIED BY 'yourpassword';
    mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@'%';



  3. Caveat - must log in as root with mysql -u root -p before doing the above, since other mysql users don't have all the required permissions. In this case, the root user's password was similar to the other user's password.

  4. Ran the installation from the CLI. The first time I ran it, www-data user could not write to that directory. So, changed the permissions to allow group write -
    chmod g+w the_git_dir
    cd the_git_dir
    sudo -u www-data php admin/cli/install.php

    This took quite a while - around 5 minutes - for all the database table creation etc. So, probably it would have been wiser for me to do this in a screen session. 

  5. Then made the site available via apache, with a letsencrypt certificate:
    cd /etc/apache2/sites-available
    sudo cp anothersite.conf thissite.conf
    sudo nano thissite.conf
    sudo a2ensite thissite.conf
    sudo systemctl reload apache2
    sudo certbot --apache


No comments:

Post a Comment