| 213 | |
| 214 | = Moodle Installation = |
| 215 | |
| 216 | Now we have setup the web server, PHP and database server. Also we have configured virtual hosting. Now we are going to install Moodle under lms sub domain created above. Before installing the Moodle need to install the prerequisites for Moodle. This includes software and PHP modules that support Moodle’s features and Git for installing Moodle and keeping it up to date. |
| 217 | |
| 218 | {{{ |
| 219 | sudo apt install graphviz aspell ghostscript clamav php7.4-pspell php7.4-curl php7.4-gd php7.4-intl php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-ldap php7.4-zip php7.4-soap php7.4-mbstring |
| 220 | }}} |
| 221 | |
| 222 | Restart Apache to load the modules. |
| 223 | |
| 224 | {{{ |
| 225 | sudo systemctl restart apache2 |
| 226 | }}} |
| 227 | |
| 228 | Then let's download the Moodle using Git repository. |
| 229 | |
| 230 | {{{ |
| 231 | cd /opt |
| 232 | sudo git clone git://git.moodle.org/moodle.git |
| 233 | cd moodle |
| 234 | }}} |
| 235 | |
| 236 | Then get a list of stable releases from below command, |
| 237 | |
| 238 | {{{ |
| 239 | sudo git branch -a |
| 240 | }}} |
| 241 | |
| 242 | Here we are selecting release MOODLE_400_STABLE, track and then check out the branch selected. |
| 243 | |
| 244 | {{{ |
| 245 | sudo git branch --track MOODLE_310_STABLE origin/MOODLE_310_STABLE |
| 246 | sudo git checkout MOODLE_310_STABLE |
| 247 | }}} |
| 248 | |
| 249 | Copy the directory with the Moodle repository into the /var/www/lms.your_domain.com/public_html directory. Then, modify the new Moodle directory’s permissions to grant read, execute, and write access to any user. |
| 250 | |
| 251 | {{{ |
| 252 | sudo cp -R /opt/moodle/* /var/www/lms.your_domain.com/public_html |
| 253 | sudo chmod -R 0777 /var/www/lms.your_domain.com/public_html |
| 254 | }}} |
| 255 | |
| 256 | Then we need to create a directory to hold moodle data in /var/moodledata and make www-data its owner, and modify its permissions to grant all users read, execute, and write access. below will be the steps. |
| 257 | |
| 258 | {{{ |
| 259 | sudo mkdir /var/moodledata |
| 260 | sudo chown -R www-data /var/moodledata |
| 261 | sudo chmod -R 0777 /var/moodledata |
| 262 | }}} |
| 263 | |
| 264 | Moodle uses a database which needs to be created in MariaDB in our case. below are the steps to create the database. |
| 265 | |
| 266 | First login the database, |
| 267 | |
| 268 | {{{ |
| 269 | sudo mysql -u root -p |
| 270 | }}} |
| 271 | Then use the following MySQL command to create a database for Moodle. |
| 272 | |
| 273 | {{{ |
| 274 | CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; |
| 275 | }}} |
| 276 | |
| 277 | Next create the user for the database and grant permissions to the database and exit, |
| 278 | |
| 279 | {{{ |
| 280 | create user 'moodledude'@'localhost' IDENTIFIED BY 'passwordformoodledude'; |
| 281 | GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO 'moodledude'@'localhost'; |
| 282 | quit; |
| 283 | }}} |
| 284 | |
| 285 | Now the rest of the installation is done through a web installer. To access that visit the url http://lms.your_domain.com/. |
| 286 | |
| 287 | In the installation follow the steps as below. |
| 288 | |
| 289 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web6.png)]] |
| 290 | |
| 291 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web7.png)]] |
| 292 | |
| 293 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web8.png)]] |
| 294 | |
| 295 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web9.png)]] |
| 296 | |
| 297 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web10.png)]] |
| 298 | |
| 299 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web11.png)]] |
| 300 | |
| 301 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web12.png)]] |
| 302 | |
| 303 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web13.png)]] |
| 304 | |
| 305 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web14.png)]] |
| 306 | |
| 307 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web15.png)]] |
| 308 | |
| 309 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web16.png)]] |
| 310 | |
| 311 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web17.png)]] |