# CentOS Server - Moodle Update

# Moodle Update Checklist



# Moodle Update Checklist

## Moodle Update Checklist

<table border="1" id="bkmrk-step-%E2%88%9A-to-do-%C2%A0-%C2%A0-pre" style="border-collapse: collapse; width: 100%; height: 532px;"><tbody><tr style="height: 28px;"><td style="width: 10%; height: 28px;"> </td><td style="width: 10%; height: 28px;">√</td><td style="width: 80%; height: 28px;">To Do</td></tr><tr style="height: 68px;"><td style="width: 10%; height: 68px;"> </td><td style="width: 10%; height: 68px;"> </td><td style="width: 80%; height: 68px;">#### Preparation

</td></tr><tr style="height: 34px;"><td style="width: 10%; height: 34px;">1</td><td style="width: 10%; height: 34px;"> </td><td style="width: 80%; height: 34px;">Downloading Moodle</td></tr><tr style="height: 34px;"><td style="width: 10%; height: 34px;">2</td><td style="width: 10%; height: 34px;"> </td><td style="width: 80%; height: 34px;">Adding plugins</td></tr><tr><td style="width: 10%;">3</td><td style="width: 10%;"> </td><td style="width: 80%;">Moodle maintenance mode</td></tr><tr style="height: 68px;"><td style="width: 10%; height: 68px;"> </td><td style="width: 10%; height: 68px;"> </td><td style="width: 80%; height: 68px;">#### Backups

</td></tr><tr style="height: 29px;"><td style="width: 10%; height: 29px;">4</td><td style="width: 10%; height: 29px;"> </td><td style="width: 80%; height: 29px;">Backup the Moodle database</td></tr><tr style="height: 29px;"><td style="width: 10%; height: 29px;">5</td><td style="width: 10%; height: 29px;"> </td><td style="width: 80%; height: 29px;">Backup the Moodle data folder</td></tr><tr><td style="width: 10%;">6</td><td style="width: 10%;"> </td><td style="width: 80%;">Backup Moodle config.php</td></tr><tr style="height: 68px;"><td style="width: 10%; height: 68px;"> </td><td style="width: 10%; height: 68px;"> </td><td style="width: 80%; height: 68px;">#### Upgrading Moodle

</td></tr><tr><td style="width: 10%;">7</td><td style="width: 10%;"> </td><td style="width: 80%;">Upgrading Moodle</td></tr><tr><td style="width: 10%;">8</td><td style="width: 10%;"> </td><td style="width: 80%;">Post upgrade tasks</td></tr></tbody></table>

# Preparation



# Downloading Moodle

### Getting the latest version of Moodle

1. Go to the download page of Moodle  
      
    `<a href="https://download.moodle.org/releases/latest/" style="color: #f25e0d;">https://download.moodle.org/releases/latest/</a>`
2. Check and ensure that the server meets the minimum requirements for the latest version of Moodle
3. Update the server if necessary
4. Download the latest version of Moodle
5. Unzip/untar the download package  
      
    `unzip file.zip -d /path/to/directory`  
      
    or  
      
    `tar -C /path/to/directory -zxvf file.tar.gz`

# Adding plugins

### Adding plugins

1. Log in to the current version of Moodle as an administrator
2. Expand the Site Administrator menu  
      
    [![026.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/dQkwIGU1YEkKqeoR-026.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/dQkwIGU1YEkKqeoR-026.PNG)
3. Expand the Plugins menu  
      
    [![027.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/eeXLEzeYsPYPGYSQ-027.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/eeXLEzeYsPYPGYSQ-027.PNG)
4. Click Plugins Overview  
      
    [![028.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/4bMf9emo79NaFxVH-028.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/4bMf9emo79NaFxVH-028.PNG)
5. Click Additional Plugins  
      
    [![029.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/wLMgU5X3qCjVRIdF-029.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/wLMgU5X3qCjVRIdF-029.PNG)
6. Make a note of all the additional plugins
7. Navigate to Moodle plugins directory  
      
    `<a href="https://moodle.org/plugins/" style="color: #f25e0d;">https://moodle.org/plugins/</a>`
8. Search and download each of the plugins
9. Extract and add to the plugin to one of the correct common paths below

```
/path/to/moodle/theme/ - themes
/path/to/moodle/mod/ - activity modules and resources
/path/to/moodle/blocks/ - sidebar blocks
/path/to/moodle/question/type/ - question types
/path/to/moodle/course/format/ - course formats
/path/to/moodle/admin/report/ - admin reports
```

# Moodle Maintenance Mode

### Moodle Maintenance Mode

1. Log in as an administrator
2. Expand the Administrator panel  
      
    [![026.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/dQkwIGU1YEkKqeoR-026.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/dQkwIGU1YEkKqeoR-026.PNG)
3. Expand the Server sub-menu and click Maintenance Mode  
      
    [![030.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/m3Oh5aK69FviFjW9-030.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/m3Oh5aK69FviFjW9-030.PNG)
4. Enable Maintenance mode, add an addition message if necessary and save the changes  
      
    [![031.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/8ijtpxEVpAkXLwS2-031.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/8ijtpxEVpAkXLwS2-031.PNG)

# Backups



# Backup The Moodle Database

### Moodle Database Backup

#### MySQL Database Dump

1. Backup Moodle database with the command below

```
mysqldump -u [username] –p[password] [database_name] > [dump_file.sql]

The parameters of the said command as follows:

  [username] - A valid MySQL username
  [password] - A valid MySQL password for the user (leave empty to be prompted for password)
  [database_name] - A valid Database name you want to take backup
  [dump_file.sql] - The name of backup dump file you want to generate
```

#### Downloading the file

1. Download the file a backup medium for safekeeping

# Backup The Moodle Data Folder

### Backing Up The Moodle Data Folder

#### Compress the data folder

1. Compress the Moodle data folder with the command below

```
tar -czvf name-of-archive.tar.gz /path/to/moodle-data-folder

Here’s what those switches actually mean:

  -c: Create an archive.
  -z: Compress the archive with gzip.
  -v: Display progress in the terminal while creating the archive, also known as “verbose” mode. 
      The v is always optional in these commands, but it’s helpful.
  -f: Allows you to specify the filename of the archive.
```

#### Downloading the file

1. Once the folder is compressed, download to a backup medium for safekeeping

# Backup Moodle Config.php

<p class="callout warning">Although not necessary, you can also backup the Moodle directory and not just the config.php file.  
  
Follow the same steps set out in [Backup the Moodle Data Folder](https://docs.azandi.co.za/books/centos-server---moodle-update/page/backup-the-moodle-data-folder)</p>

### Backing Up Moodle's Config File

1. Copy the config.php found in the root directory of the Moode installation to a safe medium backup medium

# Upgrading Moodle



# Upgrading Moodle

### Upgrading Moodle

1. Rename the current production Moodle folder  
      
    `mv /path/to/current/moodle-folder/ /path/to/current/moodle-folder_old`
2. Upload/copy/move the new installation folder and rename to current Moodle production folder, i.e. if the production folder was named learn.azandi.co.za then rename the new folder to learn.azandi.co.za
3. Restore the permissions/ownership of the folder and files  
      
    `chowen -R apache:apache /path/to/current/moodle-folder`
4. Navigate to the Moodle platform website in a browser and follow the onscreen prompts

# Post Upgrade Tasks

### Post Upgrade Tasks

1. Check and restore all custom settings where necessary
2. Check Moodle to ensure site is functioning as at it should and rectify any issues
3. Take Moodle out of maintenance mode

