Moodle + Office 365: Better together


Setting up and configuring the database server



Download 345.09 Kb.
Page8/13
Date29.07.2017
Size345.09 Kb.
#24227
1   ...   5   6   7   8   9   10   11   12   13

32.Setting up and configuring the database server


Moodle supports various types of database servers:

  • MySQL,

  • PostgreSQL,

  • Microsoft SQL Server,

  • MariaDB,

  • Oracle.

It is advisable to use a MySQL database server. Even if the core of Moodle is compatible with Microsoft SQL Server, this is not the case for all the plugins developed by the Moodle community. This is the reason why we will opt to use a MySQL database server in our test lab environment.

33.Setting up the database server


To setup the database server, proceed with the following steps:

  1. Log onto the MySQL server using the SSH client of your choosing (for example PuTTY):

  • Host name: m2o-contoso123svc.cloudapp.net

  • Port: 59337



  1. Enter the following user name and password when invited to do so by the server:

  • User name: "moodleadmin"

  • Password: "Contoso123! "

  1. Switch to super user (root) mode.


moodleadmin@m2o-mysql:~$ sudo –s


  1. Update the packages of the Linux distribution.


root@m2o-mysql:~$ apt-get update


  1. Install the MySQL server.


root@m2o-mysql:~$ apt-get install mysql-server



  1. Enter the administrator password of the database server, for example "Contoso123!" in our illustration and press ENTER.



  1. Confirm the administrator password of the database server, for example "Contoso123!" in our illustration and press ENTER.

34.Configuring the database server


To configure the database server, proceed with the following steps:

  1. From the previous SSH connection, log onto the database server as the administrator.


root@m2o-mysql:~$ mysql -uroot -p


  1. Type the password, for example “Contoso123!" in our illustration.


Enter password:


  1. Log onto the MySQL database.


mysql> connect mysql;


  1. Authorize the Moodle server to connect to the MySQL database.


mysql> CREATE USER 'moodleadmin'@'10.0.1.4' IDENTIFIED BY 'moodleazure';

mysql> GRANT ALL PRIVILEGES ON * . * TO 'moodleadmin'@’10.0.1.4' IDENTIFIED BY 'moodleazure' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
Note moodleadmin is the username of the virtual machine hosting the Moodle server. 10.0.1.4 is the public IP address of the virtual machine hosting the Moodle server. moodleazure is the password that the Moodle server uses to log onto the MySQL database.

  1. Update the access privileges to the database to apply the recent changes.


mysql> FLUSH PRIVILEGES ;


  1. Quit the MySQL database.


mysql> quit ;

35.Opening the MySQL server on the virtual network


Since the MySQL server is installed in packages, by default, it is configured as local. Consequently, it must be made accessible from the virtual network between the two virtual machines.

Proceed with the following steps:



  1. Still working from the same SSH connection, edit the MySQL database configuration file.


root@m2o-mysql:~$ vi /etc/mysql/my.cnf


  1. Find the line bind-address and replace the value 127.0.0.1 with 10.0.2.4 to open the MySQL database on the virtual network.


bind-address= 10.0.2.4
Note 10.0.2.4 is the public IP address of the virtual machine hosting the MySQL server.

  1. Restart the database to apply the new configuration.


root@m2o-mysql:~$ service mysql restart
Note The following command can be executed on the Moodle server to check that the MySQL can be accessed from the Moodle server by the user moodleadmin we configured in step 4. If everything is functioning correctly, we can enter the password moodleazure to access the mysql> invite.
root@m2o-moodle:~$ mysql –hm2o-mysql –umoodleadmin p

36.Pointing the domain name o2m.contoso123.fr to the Moodle server


The virtual hosting service (or vhost) should be activated on the Moodle server in order to point the domain name o2m.contoso123.fr to the Moodle server. Virtual hosting can also address several instances of Moodle hosted on a shared Apache HTTP server (e.g., a production instance of Moodle and a qualification instance of Moodle).

If you have logged off the Moodle server, log on again by repeating steps 1 to 3 in section § Setting up the Apache HTTP server.



  1. Activate the virtual hosting service on the Apache HTTP server.


root@m2o-moodle:~$ cd /etc/apache2/mods-enabled

root@m2o-moodle:/etc/apache2/mods-enabled$ ln -s ../mods-available/vhost_alias.load
Note The command ln creates a symbolic link (-s) with the target file vhost_alias.load in the current directory. To deactivate the hosting service, simply delete the symbolic link. In this way, the target file is not deleted and can be used again to reactivate the service.

  1. Restart the Apache HTTP server.


root@m2o-moodle:~$ service apache2 restart


  1. Create a virtual hosting configuration file for Moodle.

Note Use the default virtual hosting configuration file as a starting point.
root@m2o-moodle:~$ cd /etc/apache2/sites-available

root@m2o-moodle:/etc/apache2/sites-available$ cp 000-default.vhost 030-moodle27.conf

root@m2o-moodle:/etc/apache2/sites-available$ vi 030-moodle27.conf




  1. Add the name of the server above the line ServerAdmin webmaster@localhost.


ServerName o2m.contoso123.fr


  1. Replace the default root directory with /var/www/moodle27.


DocumentRoot /var/www/moodle27


  1. Add a permanent HTTP redirection in order to force the HTTPS connection on all the pages of the platform.


Redirect Permanent / https://o2m.contoso123.fr/


  1. Add the following lines after the root file in order to configure access control.




Options -Indexes +FollowSymLinks +Multiviews

AllowOverride None

Allow from all


Note The -Indexes option prevents the list of files from being displayed. The +FollowSymLinks option allows symbolic links to the followed. The +Multiviews option authorizes file variants (for example, in the event of multiple languages). It is optional. The AllowOverride None directive prevents access rights from being overridden using .htaccess files. It is very important to deactivate this directive in order to protect the security of a Moodle platform. Finally, the Allow from all directive allows users to access the platform from the web.

  1. Edit the log files as shown below in order to reflect the virtual hosting instance.


ErrorLog ${APACHE_LOG_DIR}/error_moodle27.log

CustomLog ${APACHE_LOG_DIR}/access_moodle27.log combined




  1. Save the changes and exit the text editor.


:wq



  1. Activate the new configuration.


root@m2o-moodle:~$ cd /etc/apache2/sites-enabled

root@m2o-moodle:/etc/apache2/sites-enabled$ ln -s ../sites-available/030-moodle27.conf
Note The .conf file extension is essential for the configuration to be properly applied.


Download 345.09 Kb.

Share with your friends:
1   ...   5   6   7   8   9   10   11   12   13




The database is protected by copyright ©ininet.org 2024
send message

    Main page