https://docs.moodle.org/37/en/api.php?action=feedcontributions&user=Wwycheuk&feedformat=atomMoodleDocs - User contributions [en]2024-03-28T10:08:34ZUser contributionsMediaWiki 1.39.6https://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135465RedHat Linux installation2019-09-16T09:49:28Z<p>Wwycheuk: /* Firewall */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1; RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6; RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/deploying_different_types_of_servers/index#using-mariadb]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Name", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld'[https://firewalld.org/]) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL) (MariaDB 10.3 doesn't need this as these are already the default settings.)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = 'mariadb' (use 'mysqli' for MySQL)<br />
** dbhost = 'localhost'<br />
** dbname = 'mymoodle'<br />
** dbuser = 'moodleuser'<br />
** dbpass = 'moodlepass' (<-- better make this something of your own)<br />
** prefix = 'mdl_'<br />
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)<br />
** wwwroot = 'http://myhost.mydomain'<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use 'http://localhost/mymoodle')<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
If you want the web site to be served as "http://www.whatever.com/mymoodle" instead of "http://www.whatever.com", don't change it, and modify the 'wwwroot' parameter of Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
<!--RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages--><br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/admin<br />
or<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/admin<br />
or<br />
http://localhost/mymoodle/admin<br />
<br />
== Installing SSL certificate ==<br />
<br />
After installing the SSL certificate, change the 'http' to 'https' in the 'wwwroot' parameter of Moodle 'config.php' file.<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135464RedHat Linux installation2019-09-16T09:46:31Z<p>Wwycheuk: /* Firewall */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1; RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6; RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/deploying_different_types_of_servers/index#using-mariadb]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Name", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld') is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL) (MariaDB 10.3 doesn't need this as these are already the default settings.)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = 'mariadb' (use 'mysqli' for MySQL)<br />
** dbhost = 'localhost'<br />
** dbname = 'mymoodle'<br />
** dbuser = 'moodleuser'<br />
** dbpass = 'moodlepass' (<-- better make this something of your own)<br />
** prefix = 'mdl_'<br />
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)<br />
** wwwroot = 'http://myhost.mydomain'<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use 'http://localhost/mymoodle')<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
If you want the web site to be served as "http://www.whatever.com/mymoodle" instead of "http://www.whatever.com", don't change it, and modify the 'wwwroot' parameter of Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
<!--RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages--><br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/admin<br />
or<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/admin<br />
or<br />
http://localhost/mymoodle/admin<br />
<br />
== Installing SSL certificate ==<br />
<br />
After installing the SSL certificate, change the 'http' to 'https' in the 'wwwroot' parameter of Moodle 'config.php' file.<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135119RedHat Linux installation2019-08-19T01:58:39Z<p>Wwycheuk: /* Server Installation */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1; RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6; RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/deploying_different_types_of_servers/index#using-mariadb]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Name", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL) (MariaDB 10.3 doesn't need this as these are already the default settings.)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = 'mariadb' (use 'mysqli' for MySQL)<br />
** dbhost = 'localhost'<br />
** dbname = 'mymoodle'<br />
** dbuser = 'moodleuser'<br />
** dbpass = 'moodlepass' (<-- better make this something of your own)<br />
** prefix = 'mdl_'<br />
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)<br />
** wwwroot = 'http://myhost.mydomain'<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use 'http://localhost/mymoodle')<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
If you want the web site to be served as "http://www.whatever.com/mymoodle" instead of "http://www.whatever.com", don't change it, and modify the 'wwwroot' parameter of Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
<!--RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages--><br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/admin<br />
or<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/admin<br />
or<br />
http://localhost/mymoodle/admin<br />
<br />
== Installing SSL certificate ==<br />
<br />
After installing the SSL certificate, change the 'http' to 'https' in the 'wwwroot' parameter of Moodle 'config.php' file.<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135116RedHat Linux installation2019-08-16T10:08:14Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Name", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL) (MariaDB 10.3 doesn't need this as these are already the default settings.)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = 'mariadb' (use 'mysqli' for MySQL)<br />
** dbhost = 'localhost'<br />
** dbname = 'mymoodle'<br />
** dbuser = 'moodleuser'<br />
** dbpass = 'moodlepass' (<-- better make this something of your own)<br />
** prefix = 'mdl_'<br />
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)<br />
** wwwroot = 'http://myhost.mydomain'<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use 'http://localhost/mymoodle')<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
If you want the web site to be served as "http://www.whatever.com/mymoodle" instead of "http://www.whatever.com", don't change it, and modify the 'wwwroot' parameter of Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
<!--RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages--><br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/admin<br />
or<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/admin<br />
or<br />
http://localhost/mymoodle/admin<br />
<br />
== Installing SSL certificate ==<br />
<br />
After installing the SSL certificate, change the 'http' to 'https' in the 'wwwroot' parameter of Moodle 'config.php' file.<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135115RedHat Linux installation2019-08-16T10:03:49Z<p>Wwycheuk: /* Network Interface */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Name", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL) (MariaDB 10.3 doesn't need this as these are already the default settings.)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = 'mariadb' (use 'mysqli' for MySQL)<br />
** dbhost = 'localhost'<br />
** dbname = 'mymoodle'<br />
** dbuser = 'moodleuser'<br />
** dbpass = 'moodlepass' (<-- better make this something of your own)<br />
** prefix = 'mdl_'<br />
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)<br />
** wwwroot = 'http://myhost.mydomain'<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use 'http://localhost/mymoodle')<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
If you want the web site to be served as "http://www.whatever.com/mymoodle" instead of "http://www.whatever.com", don't change it, and modify the 'wwwroot' parameter of Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/admin<br />
or<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/admin<br />
or<br />
http://localhost/mymoodle/admin<br />
<br />
== Installing SSL certificate ==<br />
<br />
After installing the SSL certificate, change the 'http' to 'https' in the 'wwwroot' parameter of Moodle 'config.php' file.<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135114RedHat Linux installation2019-08-16T09:34:20Z<p>Wwycheuk: /* MariaDB / MySQL */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL) (MariaDB 10.3 doesn't need this as these are already the default settings.)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = 'mariadb' (use 'mysqli' for MySQL)<br />
** dbhost = 'localhost'<br />
** dbname = 'mymoodle'<br />
** dbuser = 'moodleuser'<br />
** dbpass = 'moodlepass' (<-- better make this something of your own)<br />
** prefix = 'mdl_'<br />
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)<br />
** wwwroot = 'http://myhost.mydomain'<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use 'http://localhost/mymoodle')<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
If you want the web site to be served as "http://www.whatever.com/mymoodle" instead of "http://www.whatever.com", don't change it, and modify the 'wwwroot' parameter of Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/admin<br />
or<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/admin<br />
or<br />
http://localhost/mymoodle/admin<br />
<br />
== Installing SSL certificate ==<br />
<br />
After installing the SSL certificate, change the 'http' to 'https' in the 'wwwroot' parameter of Moodle 'config.php' file.<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135113RedHat Linux installation2019-08-16T09:30:29Z<p>Wwycheuk: /* Try your new installation */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = 'mariadb' (use 'mysqli' for MySQL)<br />
** dbhost = 'localhost'<br />
** dbname = 'mymoodle'<br />
** dbuser = 'moodleuser'<br />
** dbpass = 'moodlepass' (<-- better make this something of your own)<br />
** prefix = 'mdl_'<br />
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)<br />
** wwwroot = 'http://myhost.mydomain'<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use 'http://localhost/mymoodle')<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
If you want the web site to be served as "http://www.whatever.com/mymoodle" instead of "http://www.whatever.com", don't change it, and modify the 'wwwroot' parameter of Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/admin<br />
or<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/admin<br />
or<br />
http://localhost/mymoodle/admin<br />
<br />
== Installing SSL certificate ==<br />
<br />
After installing the SSL certificate, change the 'http' to 'https' in the 'wwwroot' parameter of Moodle 'config.php' file.<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135112RedHat Linux installation2019-08-16T09:28:04Z<p>Wwycheuk: /* Try your new installation */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = 'mariadb' (use 'mysqli' for MySQL)<br />
** dbhost = 'localhost'<br />
** dbname = 'mymoodle'<br />
** dbuser = 'moodleuser'<br />
** dbpass = 'moodlepass' (<-- better make this something of your own)<br />
** prefix = 'mdl_'<br />
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)<br />
** wwwroot = 'http://myhost.mydomain'<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use 'http://localhost/mymoodle')<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
If you want the web site to be served as "http://www.whatever.com/mymoodle" instead of "http://www.whatever.com", don't change it, and modify the 'wwwroot' parameter of Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
== Installing SSL certificate ==<br />
<br />
After installing the SSL certificate, change the 'http' to 'https' in the 'wwwroot' parameter of Moodle 'config.php' file.<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135111RedHat Linux installation2019-08-16T09:25:11Z<p>Wwycheuk: /* Setting Document Root */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = 'mariadb' (use 'mysqli' for MySQL)<br />
** dbhost = 'localhost'<br />
** dbname = 'mymoodle'<br />
** dbuser = 'moodleuser'<br />
** dbpass = 'moodlepass' (<-- better make this something of your own)<br />
** prefix = 'mdl_'<br />
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)<br />
** wwwroot = 'http://myhost.mydomain'<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use 'http://localhost/mymoodle')<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
If you want the web site to be served as "http://www.whatever.com/mymoodle" instead of "http://www.whatever.com", don't change it, and modify the 'wwwroot' parameter of Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135110RedHat Linux installation2019-08-16T09:22:20Z<p>Wwycheuk: /* Setup config.php */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = 'mariadb' (use 'mysqli' for MySQL)<br />
** dbhost = 'localhost'<br />
** dbname = 'mymoodle'<br />
** dbuser = 'moodleuser'<br />
** dbpass = 'moodlepass' (<-- better make this something of your own)<br />
** prefix = 'mdl_'<br />
*** (Use different prefix if there is more than one instance of Moodle on the same server, and you plan to share the database)<br />
** wwwroot = 'http://myhost.mydomain'<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use 'http://localhost/mymoodle')<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
So that the web site is served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, <br />
<br />
Remember to modify the Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135109RedHat Linux installation2019-08-16T09:16:07Z<p>Wwycheuk: /* Apache */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
=== Setting Document Root ===<br />
Edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
So that the web site is served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, <br />
<br />
Remember to modify the Moodle 'config.php' file accordingly.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135108RedHat Linux installation2019-08-16T09:13:48Z<p>Wwycheuk: /* Setting Apache Document Root */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135107RedHat Linux installation2019-08-16T08:38:43Z<p>Wwycheuk: /* Set up the cron job */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Install Moodle ==<br />
Now everything's ready. Use web browser to open "http://webserver/mymoodle/install.php" to start the installation.<br />
<br />
== Set up cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135106RedHat Linux installation2019-08-16T08:37:26Z<p>Wwycheuk: /* Moodle */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135105RedHat Linux installation2019-08-16T08:35:26Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-json php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135104RedHat Linux installation2019-08-16T08:31:23Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file for security reason.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135103RedHat Linux installation2019-08-16T08:30:58Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
* Restart the web server so that PHP can start working:<br />
<pre><br />
service httpd restart<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135102RedHat Linux installation2019-08-16T08:25:47Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
<pre><br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135101RedHat Linux installation2019-08-16T08:13:54Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install PHP:<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135100RedHat Linux installation2019-08-16T08:11:45Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php php-cli php-common php-fpm php-gd php-intl php-mbstring php-mysqlnd php-opcache php-pdo php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135099RedHat Linux installation2019-08-16T08:07:07Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php php-gd php-intl php-mbstring php-mysqlnd php-opcache php-xml php-xmlrpc php-pecl-zip php-soap<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135098RedHat Linux installation2019-08-16T07:44:57Z<p>Wwycheuk: /* Setup config.php */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135097RedHat Linux installation2019-08-16T06:30:36Z<p>Wwycheuk: /* MariaDB / MySQL */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password, also secure the installation<br />
** mysql_secure_installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135096RedHat Linux installation2019-08-16T04:51:00Z<p>Wwycheuk: /* System Registration */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username and password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135095RedHat Linux installation2019-08-16T04:39:32Z<p>Wwycheuk: /* Apache */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Install it if it's not installed already.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135094RedHat Linux installation2019-08-16T01:56:36Z<p>Wwycheuk: /* Apache */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see above). Correct the problem before continuing.<br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135093RedHat Linux installation2019-08-16T01:45:48Z<p>Wwycheuk: /* Apache */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135092RedHat Linux installation2019-08-16T01:45:21Z<p>Wwycheuk: /* Firewall */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL since version 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd-*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135091RedHat Linux installation2019-08-15T09:44:04Z<p>Wwycheuk: /* MariaDB / MySQL */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under "Basic Settings", add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB/MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the installation<br />
* Next, set up the MariaDB/MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MariaDB/MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MariaDB/MySQL prompt, enter the following commands (MariaDB/MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB/MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd-*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135090RedHat Linux installation2019-08-15T09:41:07Z<p>Wwycheuk: /* Server Installation */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** Moodle 3.7 needs PHP 7.1 and RHEL8 comes with PHP 7.2.[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* Database<br />
** Moodle 3.7 needs MariaDB 5.5 or MySQL 5.6, and RHEL8 comes with MariaDB 10.3 and MySQL 8.0 (They cannot be installed at the same time).[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages]<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB(MySQL) root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB(MySQL) security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd-*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135089RedHat Linux installation2019-08-15T09:23:07Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB(MySQL) root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB(MySQL) security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd-*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory (or anywhere the Apache "DocumentRoot" points to) with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135088RedHat Linux installation2019-08-15T09:22:22Z<p>Wwycheuk: /* Web version */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB(MySQL) root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB(MySQL) security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd-*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" (or anywhere the Apache "DocumentRoot" points to) directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note|Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135087RedHat Linux installation2019-08-15T09:19:10Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB(MySQL) root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB(MySQL) security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd-*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case).<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" (or anywhere the Apache "DocumentRoot" points to) directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note| Web version is kept here for reference only. Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135086RedHat Linux installation2019-08-15T09:11:26Z<p>Wwycheuk: /* Configure hostname and domain name */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Network Interface ==<br />
<br />
During installation, under "System" -> "Network & Host Management", remember to enable the NIC. It's not enabled by default.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB(MySQL) root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB(MySQL) security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd-*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case). See [https://access.redhat.com/solutions/2662201]<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note| Web version is kept here for reference only. Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135085RedHat Linux installation2019-08-15T09:06:59Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB(MySQL) root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB(MySQL) security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd-*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case). See [https://access.redhat.com/solutions/2662201]<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php executable:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note| Web version is kept here for reference only. Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135084RedHat Linux installation2019-08-15T09:04:52Z<p>Wwycheuk: /* PHP */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB(MySQL) root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB(MySQL) security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd-*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* Install the version of PHP you need (7.2 in this case). See [https://access.redhat.com/solutions/2662201]<br />
<pre><br />
yum install php72 php72-php php72-php-xml php72-php-xmlrpc php72-php-mysqlnd php72-php-zip php72-php-gd php72-php-intl php72-php-mbstring php72-php-soap php72-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
You may need to create a link to the php file:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note| Web version is kept here for reference only. Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135083RedHat Linux installation2019-08-15T09:01:18Z<p>Wwycheuk: /* Apache */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB(MySQL) root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB(MySQL) security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
<pre><br />
yum install httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd-*<br />
</pre><br />
* Start it and make it auto-start after reboot:<br />
<pre><br />
service httpd start; chkconfig httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/etc/httpd/conf/httpd.conf</pre><br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* By using the extra repo, install the version of PHP you need (7.0 in this case). See [https://access.redhat.com/solutions/2662201]<br />
<pre><br />
yum install rh-php70 rh-php70-php rh-php70-php-xml rh-php70-php-xmlrpc rh-php70-php-mysqlnd rh-php70-php-zip rh-php70-php-gd rh-php70-php-intl rh-php70-php-mbstring rh-php70-php-soap rh-php70-php-opcache<br />
</pre><br />
For remi-safe repo, use:<br />
<pre><br />
yum install php70 php70-php php70-php-xml php70-php-xmlrpc php70-php-mysqlnd php70-php-zip php70-php-gd php70-php-intl php70-php-mbstring php70-php-soap php70-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
**As the PHP7 was installed to a non-default location, update the PATH variable by editing /etc/bashrc and then run the source command (See [https://medium.com/tensult/install-moodle-in-rhel7-with-php7-and-http24-25695e213bb4]):<br />
<pre><br />
# vi /etc/bashrc<br />
export PATH=$PATH:/opt/rh/rh-php70/root/bin:/opt/rh/rh-php70/root/sbin<br />
# source /etc/bashrc<br />
# php -v<br />
</pre><br />
Or create a link to the php file:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note| Web version is kept here for reference only. Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135082RedHat Linux installation2019-08-15T08:59:02Z<p>Wwycheuk: /* MariaDB / MySQL */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MariaDB(MySQL) root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MariaDB(MySQL) security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
* The default version (httpd) doesn't work with the PHP7 needed, so we install httpd24 (from extra repo) to replace it:<br />
<pre><br />
yum install httpd24-httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd24-*<br />
</pre><br />
* Stop the existing version, prevent it from starting after reboot:<br />
<pre><br />
service httpd stop; chkconfig httpd off<br />
</pre><br />
* Start the new version, and make it auto-start after reboot:<br />
<pre><br />
service httpd24-httpd start; chkconfig httpd24-httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf</pre> (For the default version, it's <pre>/etc/httpd/conf/httpd.conf</pre>)<br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* By using the extra repo, install the version of PHP you need (7.0 in this case). See [https://access.redhat.com/solutions/2662201]<br />
<pre><br />
yum install rh-php70 rh-php70-php rh-php70-php-xml rh-php70-php-xmlrpc rh-php70-php-mysqlnd rh-php70-php-zip rh-php70-php-gd rh-php70-php-intl rh-php70-php-mbstring rh-php70-php-soap rh-php70-php-opcache<br />
</pre><br />
For remi-safe repo, use:<br />
<pre><br />
yum install php70 php70-php php70-php-xml php70-php-xmlrpc php70-php-mysqlnd php70-php-zip php70-php-gd php70-php-intl php70-php-mbstring php70-php-soap php70-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
**As the PHP7 was installed to a non-default location, update the PATH variable by editing /etc/bashrc and then run the source command (See [https://medium.com/tensult/install-moodle-in-rhel7-with-php7-and-http24-25695e213bb4]):<br />
<pre><br />
# vi /etc/bashrc<br />
export PATH=$PATH:/opt/rh/rh-php70/root/bin:/opt/rh/rh-php70/root/sbin<br />
# source /etc/bashrc<br />
# php -v<br />
</pre><br />
Or create a link to the php file:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note| Web version is kept here for reference only. Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135081RedHat Linux installation2019-08-15T08:56:33Z<p>Wwycheuk: /* Firewall */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Restart the firewall and then check the allow status:<br />
<pre><br />
service firewalld restart<br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
* The default version (httpd) doesn't work with the PHP7 needed, so we install httpd24 (from extra repo) to replace it:<br />
<pre><br />
yum install httpd24-httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd24-*<br />
</pre><br />
* Stop the existing version, prevent it from starting after reboot:<br />
<pre><br />
service httpd stop; chkconfig httpd off<br />
</pre><br />
* Start the new version, and make it auto-start after reboot:<br />
<pre><br />
service httpd24-httpd start; chkconfig httpd24-httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf</pre> (For the default version, it's <pre>/etc/httpd/conf/httpd.conf</pre>)<br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* By using the extra repo, install the version of PHP you need (7.0 in this case). See [https://access.redhat.com/solutions/2662201]<br />
<pre><br />
yum install rh-php70 rh-php70-php rh-php70-php-xml rh-php70-php-xmlrpc rh-php70-php-mysqlnd rh-php70-php-zip rh-php70-php-gd rh-php70-php-intl rh-php70-php-mbstring rh-php70-php-soap rh-php70-php-opcache<br />
</pre><br />
For remi-safe repo, use:<br />
<pre><br />
yum install php70 php70-php php70-php-xml php70-php-xmlrpc php70-php-mysqlnd php70-php-zip php70-php-gd php70-php-intl php70-php-mbstring php70-php-soap php70-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
**As the PHP7 was installed to a non-default location, update the PATH variable by editing /etc/bashrc and then run the source command (See [https://medium.com/tensult/install-moodle-in-rhel7-with-php7-and-http24-25695e213bb4]):<br />
<pre><br />
# vi /etc/bashrc<br />
export PATH=$PATH:/opt/rh/rh-php70/root/bin:/opt/rh/rh-php70/root/sbin<br />
# source /etc/bashrc<br />
# php -v<br />
</pre><br />
Or create a link to the php file:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note| Web version is kept here for reference only. Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135080RedHat Linux installation2019-08-15T08:50:14Z<p>Wwycheuk: /* Adding extra repo */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Check the allow status:<br />
<pre><br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
* The default version (httpd) doesn't work with the PHP7 needed, so we install httpd24 (from extra repo) to replace it:<br />
<pre><br />
yum install httpd24-httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd24-*<br />
</pre><br />
* Stop the existing version, prevent it from starting after reboot:<br />
<pre><br />
service httpd stop; chkconfig httpd off<br />
</pre><br />
* Start the new version, and make it auto-start after reboot:<br />
<pre><br />
service httpd24-httpd start; chkconfig httpd24-httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf</pre> (For the default version, it's <pre>/etc/httpd/conf/httpd.conf</pre>)<br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* By using the extra repo, install the version of PHP you need (7.0 in this case). See [https://access.redhat.com/solutions/2662201]<br />
<pre><br />
yum install rh-php70 rh-php70-php rh-php70-php-xml rh-php70-php-xmlrpc rh-php70-php-mysqlnd rh-php70-php-zip rh-php70-php-gd rh-php70-php-intl rh-php70-php-mbstring rh-php70-php-soap rh-php70-php-opcache<br />
</pre><br />
For remi-safe repo, use:<br />
<pre><br />
yum install php70 php70-php php70-php-xml php70-php-xmlrpc php70-php-mysqlnd php70-php-zip php70-php-gd php70-php-intl php70-php-mbstring php70-php-soap php70-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
**As the PHP7 was installed to a non-default location, update the PATH variable by editing /etc/bashrc and then run the source command (See [https://medium.com/tensult/install-moodle-in-rhel7-with-php7-and-http24-25695e213bb4]):<br />
<pre><br />
# vi /etc/bashrc<br />
export PATH=$PATH:/opt/rh/rh-php70/root/bin:/opt/rh/rh-php70/root/sbin<br />
# source /etc/bashrc<br />
# php -v<br />
</pre><br />
Or create a link to the php file:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note| Web version is kept here for reference only. Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135079RedHat Linux installation2019-08-15T08:38:18Z<p>Wwycheuk: /* Server Installation */</p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
* Database<br />
** Install MariaDB.<br />
* BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== Adding extra repo ==<br />
To install the httpd24 and PHP7 we need, add extra repo:<br />
<pre><br />
subscription-manager repos --enable rhel-server-rhscl-7-rpms<br />
</pre><br />
<br />
or the "remi-safe" repo, or any other repo you want.<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Check the allow status:<br />
<pre><br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
* The default version (httpd) doesn't work with the PHP7 needed, so we install httpd24 (from extra repo) to replace it:<br />
<pre><br />
yum install httpd24-httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd24-*<br />
</pre><br />
* Stop the existing version, prevent it from starting after reboot:<br />
<pre><br />
service httpd stop; chkconfig httpd off<br />
</pre><br />
* Start the new version, and make it auto-start after reboot:<br />
<pre><br />
service httpd24-httpd start; chkconfig httpd24-httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf</pre> (For the default version, it's <pre>/etc/httpd/conf/httpd.conf</pre>)<br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* By using the extra repo, install the version of PHP you need (7.0 in this case). See [https://access.redhat.com/solutions/2662201]<br />
<pre><br />
yum install rh-php70 rh-php70-php rh-php70-php-xml rh-php70-php-xmlrpc rh-php70-php-mysqlnd rh-php70-php-zip rh-php70-php-gd rh-php70-php-intl rh-php70-php-mbstring rh-php70-php-soap rh-php70-php-opcache<br />
</pre><br />
For remi-safe repo, use:<br />
<pre><br />
yum install php70 php70-php php70-php-xml php70-php-xmlrpc php70-php-mysqlnd php70-php-zip php70-php-gd php70-php-intl php70-php-mbstring php70-php-soap php70-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
**As the PHP7 was installed to a non-default location, update the PATH variable by editing /etc/bashrc and then run the source command (See [https://medium.com/tensult/install-moodle-in-rhel7-with-php7-and-http24-25695e213bb4]):<br />
<pre><br />
# vi /etc/bashrc<br />
export PATH=$PATH:/opt/rh/rh-php70/root/bin:/opt/rh/rh-php70/root/sbin<br />
# source /etc/bashrc<br />
# php -v<br />
</pre><br />
Or create a link to the php file:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note| Web version is kept here for reference only. Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=135078RedHat Linux installation2019-08-15T08:34:19Z<p>Wwycheuk: </p>
<hr />
<div>{{Note|This document is about installing Moodle 3.7 in an RedHat Enterprise Linux (RHEL) 8}}<br />
<br />
== Server Installation ==<br />
* Web Server<br />
** RHEL8 comes with PHP7.2[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.0_release_notes/index#web-servers-databases-dynamic-languages] and Moodle 3.7 needs PHP7.1.<br />
** Also the default version of Apache web server 'httpd' from RHEL7 won't work with the PHP7 from extra repo. We will install 'httpd24' to replace it, but there is no harm to install 'httpd' here first.<br />
** Or use the PHP7 packages from "remi-safe" repository, it works with the default "httpd" package.<br />
* Database<br />
** Install MariaDB (MySQL is replaced by MariaDB since RHEL7.3).<br />
* Also BEWARE OF the 'Server with a GUI' option, it may not work as expected.<br />
<br />
Note: Set up the firewall if necessary. You probably only need to enable HTTP/HTTPS (and perhaps FTP and SSH) access to your server machine, unless you know the difference.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== Adding extra repo ==<br />
To install the httpd24 and PHP7 we need, add extra repo:<br />
<pre><br />
subscription-manager repos --enable rhel-server-rhscl-7-rpms<br />
</pre><br />
<br />
or the "remi-safe" repo, or any other repo you want.<br />
<br />
== System Registration ==<br />
* To receive package updates, create a user account at redhat.com, and then login and register as developer at https://developers.redhat.com/<br />
* Subscribe the system by:<br />
<pre><br />
subscription-manager register --auto-attach<br />
</pre><br />
Enter the username, password as requested.<br />
* Update the system and then reboot<br />
<pre><br />
yum update<br />
reboot<br />
</pre><br />
See [https://developers.redhat.com/rhel8/install-rhel8-vbox/]<br />
<br />
== SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to 'enforcing'. But this may cause user problem accessing web content placed at directory other than the default directory (/var/www/html) or other access problem. If you are not used to SELinux and setting permissions, it's (maybe less secure but) often easier to lower the SELinux level to 'permissive' or even 'disabled'.<br />
<br />
<pre><br />
# vi /etc/sysconfig/selinux<br />
<br />
SELINUX=disabled<br />
</pre><br />
<br />
See the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== Firewall ==<br />
The internal firewall (RHEL 7 uses 'firewalld' instead of 'iptables' by default) is on by default. It will block the access to the web server. You may stop it first to test connection:<br />
<br />
<pre><br />
service firewalld stop<br />
</pre><br />
<br />
and then either disable it:<br />
<br />
<pre><br />
chkconfig firewalld off<br />
</pre><br />
<br />
or enable permanent HTTP access to it, you may want to enable HTTPS as well:<br />
<pre><br />
firewall-cmd --permanent --zone=public --add-service=http<br />
firewall-cmd --permanent --zone=public --add-service=https<br />
</pre><br />
<br />
Check the allow status:<br />
<pre><br />
firewall-cmd --zone=public --list-services<br />
</pre><br />
<br />
To use iptables instead of firewalld, see [https://access.redhat.com/solutions/1264743]<br />
<br />
== MariaDB / MySQL ==<br />
<br />
* Make sure at least 'mariadb' and 'mariadb-server' packages are installed.<br />
** (use "mysql" and "mysql-server" for MySQL)<br />
<pre><br />
yum install mariadb mariadb-server<br />
</pre><br />
*Then get the daemon running, it is not running by default. And set it to auto-start. See also [https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/chap-managing_confined_services-mariadb]<br />
** (use "mysqld" for MySQL)<br />
<pre><br />
service mariadb start; chkconfig mariadb on<br />
</pre><br />
*Edit /etc/my.cnf (May be different for MySQL)<br />
<br />
<pre>vi /etc/my.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement.<br />
<br />
<pre>innodb_file_format = Barracuda</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_large_prefix</pre><br />
<br />
* If you haven't yet, as root, change the MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
** Or run 'mysql_secure_installation' to set password for root and secure the system<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** ('mymoodle' is the name of the database you would like to use, it will be entered to the Moodle 'config.php' later)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' will be entered to the Moodle 'config.php' later)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Moodle ==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
=== Download ===<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
=== Unpack and set file permission etc ===<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
=== Setup config.php ===<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mariadb" (use "mysqli" for MySQL)<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Apache ==<br />
* Open a web browser and make sure you can connect to the installed web server and default port (80) of the server. If not OK, it may be blocked by the firewall (see below). Correct the problem.<br />
* The default version (httpd) doesn't work with the PHP7 needed, so we install httpd24 (from extra repo) to replace it:<br />
<pre><br />
yum install httpd24-httpd<br />
</pre><br />
or everything<pre><br />
yum install httpd24-*<br />
</pre><br />
* Stop the existing version, prevent it from starting after reboot:<br />
<pre><br />
service httpd stop; chkconfig httpd off<br />
</pre><br />
* Start the new version, and make it auto-start after reboot:<br />
<pre><br />
service httpd24-httpd start; chkconfig httpd24-httpd on<br />
</pre><br />
* Edit the Apache configuration file <pre>/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf</pre> (For the default version, it's <pre>/etc/httpd/conf/httpd.conf</pre>)<br />
* Right at the end of the file add the following lines:<br />
** <Directory "/usr/moodle/mymoodle"> (the directory used during Moodle installation)<br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== PHP ==<br />
* By using the extra repo, install the version of PHP you need (7.0 in this case). See [https://access.redhat.com/solutions/2662201]<br />
<pre><br />
yum install rh-php70 rh-php70-php rh-php70-php-xml rh-php70-php-xmlrpc rh-php70-php-mysqlnd rh-php70-php-zip rh-php70-php-gd rh-php70-php-intl rh-php70-php-mbstring rh-php70-php-soap rh-php70-php-opcache<br />
</pre><br />
For remi-safe repo, use:<br />
<pre><br />
yum install php70 php70-php php70-php-xml php70-php-xmlrpc php70-php-mysqlnd php70-php-zip php70-php-gd php70-php-intl php70-php-mbstring php70-php-soap php70-php-opcache<br />
</pre><br />
<br />
*Check the installed PHP version:<br />
**As the PHP7 was installed to a non-default location, update the PATH variable by editing /etc/bashrc and then run the source command (See [https://medium.com/tensult/install-moodle-in-rhel7-with-php7-and-http24-25695e213bb4]):<br />
<pre><br />
# vi /etc/bashrc<br />
export PATH=$PATH:/opt/rh/rh-php70/root/bin:/opt/rh/rh-php70/root/sbin<br />
# source /etc/bashrc<br />
# php -v<br />
</pre><br />
Or create a link to the php file:<br />
<pre><br />
# ln -s /opt/rh/rh-php70/root/bin/php /bin/php<br />
# php -v<br />
</pre><br />
<br />
*Create a "phpinfo.php" file within the "/var/www/html" directory with the following content:<br />
<pre><br />
<?php<br />
phpinfo();<br />
?><br />
</pre><br />
And then open web browser and browse to "http://webserver/phpinfo.php" to make sure PHP is working with the web server. Then remove the file.<br />
<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
===CLI version===<br />
{{Note| According to Moodle's documentation, users should use the CLI version if possible, as the web version may be removed in future.[https://docs.moodle.org/36/en/Cron#Working_out_the_Moodle_cron_command]}}<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** <pre>crontab -e</pre><br />
** Add the following line:<br />
<pre> */5 * * * * /usr/bin/php /path/to/mymoodle/admin/cli/cron.php</pre><br />
to run the command every 5 minutes.<br />
<br />
===Web version===<br />
{{Note| Web version is kept here for reference only. Use the CLI version if possible.}}<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Setting Apache Document Root ==<br />
If you want the web site to be served as http://www.whatever.com/ instead of http://www.whatever.com/mymoodle, edit <pre>/etc/httpd/conf/httpd.conf</pre><br />
<br />
Change From: DocumentRoot /var/www/html<br />
<br />
Change To: DocumentRoot /var/www/html/mymoodle<br />
<br />
Remember to modify the Moodle 'config.php' file and cron job accordingly.<br />
<br />
==See also==<br />
*[[Unix or Linux Installation]]<br />
*[[Installing Moodle]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=Step-by-step_Installation_Guide_for_Ubuntu&diff=134989Step-by-step Installation Guide for Ubuntu2019-08-02T08:02:14Z<p>Wwycheuk: </p>
<hr />
<div>{{Installing Moodle}}<br />
{{Note|This document is about installing Moodle 3.7 in an Ubuntu 18.04 server with PHP 7.2.}}<br />
<br />
==Before you begin==<br />
It is a good idea to write down the passwords (and usernames) you will need to use for Ubuntu and Moodle:<br />
* The Ubuntu root password<br />
* The MySQL username and password that Moodle will use<br />
* The Moodle main admin username and password<br />
* An additional admin Moodle username and password<br />
<br />
== Step 1: Install Ubuntu ==<br />
<br />
===Why we prefer Ubuntu server over Ubuntu desktop===<br />
* Most IT professionals prefer to use a Command Line Interface (CLI) server, because it is safer and less prone to hacking.<br />
* Amateur users might find it easier to use a graphical (desktop) interface.<br />
* If you will only be using your Moodle server for local, experimental purposes, you might prefer to install the desktop (64 bits preferred) version of Ubuntu.<br />
* If you install a CLI only server and later regret it, you can easily add a graphical desktop:<br />
{{Note| Even though it is not recommended by most experts, you could install a Graphical User Interface (desktop) by issuing the command 'sudo tasksel' or 'sudo apt install ubuntu-desktop' to [https://help.ubuntu.com/community/ServerGUI install 'Ubuntu desktop']. BUT USE WITH CAUTION: The GUI may not appear as expected, and may prevent user from getting even the CLI. Try it at test machine first.}}<br />
<br />
===Why we prefer (or don't prefer) Ubuntu 18.04 over Ubuntu 16.04 over Ubuntu 14.04===<br />
* All three are LTS (Long Term Service) releases. <b>amd64 edition preferred.</b> <b>http://www.ubuntu.com/download</b><br />
* Ubuntu Server 18.04 has all the required packages (comes default with Apache2, [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7.2], MySQL 5.7). Ubuntu Server 18.04 has some minor differences from 16.04 and 14.04, mainly PHP. This document has been updated to reflect those changes.<br />
* Moodle 3.0.1 onwards can use [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7.0]. Moodle 3.7 requries PHP 7.1.<br />
* But beware that if you are using external authentication or enrollment plug-ins, please note that at the moment of Moodle 3.0.1 release (December 2015) neither MSSQL nor SQLSRV are available under php7. So, [https://docs.moodle.org/dev/Moodle_and_PHP7#Can_I_use_PHP7_yet.3F anybody using SQL*Server as primary database or remote auth/enrol plugin should not move to PHP 7] at all ! Also, depending of your configuration, some extensions (memcached [https://docs.moodle.org/dev/Moodle_and_PHP7#Manually_installing_Memcached can be installed], redis, mongodb, xmlrpc...) maybe missing or work in progress for your distribution, triple check the exact availability for your OS.<br />
<br />
===Procedure===<br />
*Ubuntu has a well known issue with its automatic updates filling up the /boot directory until automated updates start to fail and automated removal of old kernel files from /boot is impossible. Because of this you should consider installing Ubuntu with a /boot directory of around 5Gb and putting some automated clean up in place. More info can be found here - [https://help.ubuntu.com/community/RemoveOldKernels]<br />
<br />
*You can use either VI (lightweight editor) or VIM (heavyweight editor), however, if you wish to use VIM you will need to install it<br />
<pre>sudo apt-get install vim</pre><br />
<br />
*VI or VIM Commands<br /><br />
To edit a file press "Insert" Key<br /><br />
To finish editing press "Esc" Key<br /><br />
To write the file press ":w"<br /><br />
To Exit the editor press ":q"<br /><br />
You can also write and quit ":wq"<br />
<br />
*In Ubuntu, the standard user, the account you created during the install, does not have rights to install/write to many of the directories. In the below tutorial we will be using the term "sudo" which stands for "super user do" before most of the commands.<br />
<br />
== Step 2: Install Apache/MySQL/PHP ==<br />
{{Note| Moodle 3.0.1 [https://docs.moodle.org/dev/Moodle_3.0.1_release_notes introduced support for PHP 7.0 and we will be using PHP 7.2 in this tutorial]}}<br />
Open up Terminal and install the following;<br />
<br />
<pre>sudo apt install apache2 mysql-client mysql-server php libapache2-mod-php</pre> <br />
<br />
'''Run 'sudo mysql_secure_installation' to set the root password for mysql - please, please my dear friends, WRITE IT DOWN and spare yourself some grief, you will need it in step 6.'''<br />
<br />
== Step 3: Install Additional Software ==<br />
<br />
<pre>sudo apt install graphviz aspell ghostscript clamav php7.2-pspell php7.2-curl php7.2-gd php7.2-intl php7.2-mysql php7.2-xml php7.2-xmlrpc php7.2-ldap php7.2-zip php7.2-soap php7.2-mbstring</pre><br />
<br />
Restart Apache so that the modules are loaded correctly<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
We will be using [[Git]] to install/update the Moodle Core Application<br />
<br />
<pre>sudo apt install git</pre><br />
<br />
== Step 4: Download Moodle ==<br />
<br />
Setup your local repository and download Moodle, We will use /opt for this installation.<br />
<br />
*[[Git]] is what is called a "version control system". By using [[Git|git]] it will much easier down the road to update the moodle core application. Within Step 5 there is a little more detail on why we put the moodle core application code in the /opt directory. <br />
<br />
<pre>cd /opt</pre><br />
<br />
Download the Moodle Code and Index<br />
<br />
<pre>sudo git clone git://git.moodle.org/moodle.git</pre><br />
<br />
Change directory into the downloaded Moodle folder<br />
<br />
<pre>cd moodle</pre><br /><br />
<br />
Retrieve a list of each branch available<br />
<br />
<pre>sudo git branch -a</pre><br />
<br />
Tell [[Git|git]] which branch to track or use<br />
<br />
<pre>sudo git branch --track MOODLE_37_STABLE origin/MOODLE_37_STABLE</pre><br />
<br />
Finally, Check out the Moodle version specified<br />
<br />
<pre>sudo git checkout MOODLE_37_STABLE</pre><br />
<br />
== Step 5: Copy local repository to /var/www/html/ ==<br />
<br />
<pre>sudo cp -R /opt/moodle /var/www/html/</pre><br /><br />
<pre>sudo mkdir /var/moodledata</pre><br /><br />
<pre>sudo chown -R www-data /var/moodledata</pre><br /><br />
<pre>sudo chmod -R 777 /var/moodledata</pre><br /><br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br /><br />
* Explanation:<br />
<br /><br />
Since we setup a local repository in the previous step, you will copy it to your webroot after any updates and making changes. Having your local repository outside of the webroot, like we have in /opt, you will be able to prepare and stage your upgrades in a more efficient manner. For example, you want to make some changes or add some plug-ins, you would download the plugin and copy it to your local moodle repository. After you have added the plug-in and any other changes you might have made you will need to edit the file located in /opt/moodle/.git/info/exclude. Within that file you want to tell [[Git|git]] which files/folders to exclude when it pulls down the updates when you run your next "sudo git pull". An example entry would be the certificate mod located in /opt/moodle/mod/certificate so within the exclude file you want to add "/mod/certificate" below the last comments. You would add additional entries, 1 per line, for each plug-in or file you might have changed. If I were to change the favicon.ico file you would just add "favicon.ico" to the exclude file. Now when you run "sudo git pull" to update moodle to the latest version it will ignore those files and directories and just update the core moodle code. Before copying to your webroot to upgrade you want to make sure and download and copy over the latest versions of the plug-ins you might have added.<br />
<br />
== Step 6: Setup MySQL Server ==<br />
<br />
First we need to change the default storage engine to innodb and change the default file format to Barracuda, this is a new setting compared to previous versions. You also need to set innodb_file_per_table in order for Barracuda to work properly. Ref: https://dev.mysql.com/doc/refman/5.6/en/innodb-compression-usage.html<br />
<br />
*You should not need to make innodb the default storage engine anymore, the latest version of Moodle will select it automatically during install. It is always a good idea to make it default anyway. You do however need to set the default file format!<br />
<br />
*If you chose to use VIM instead please substitute vi for vim<br />
<br />
<pre>sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement. if you want to add you have to press the "insert" button on your keyboard. this is usually above the "delete" button. this allows you to add some text.<br />
<br />
<pre>default_storage_engine = innodb</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_file_format = Barracuda</pre><br />
<br />
In order to save my.cnf using the editor, press the Esc (Escape) key, type the following in sequence which will save :w then close the editor :q<br />
<br />
<pre>:w</pre><br /><br />
<pre>:q</pre><br />
<br />
Restart MySQL Server for changes to take affect<br />
<br />
<pre>sudo service mysql restart</pre><br />
<br />
Now we need to create the Moodle database and the Moodle MySQL User with the correct permissions<br />
<br />
Use the password you created in step 1<br />
<pre>sudo mysql -u root -p</pre><br /><br />
mysql><pre>CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;</pre><br />
<br />
{{Note| Use 'utf8mb4' for full range (4-byte) support of UTF-8, including Emoji ('utf8' only supports 3-byte). You will be compliant by Moodle admin page if you don't use 'utf8mb4' here.}}<br />
<br />
Where it says "moodledude" and "passwordformoodledude" you should change to the username and password of your choosing.<br />
mysql><pre>create user 'moodledude'@'localhost' IDENTIFIED BY 'passwordformoodledude';</pre><br /><br />
mysql><pre>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodledude@localhost IDENTIFIED BY 'passwordformoodledude';</pre><br /><br />
mysql><pre>quit;</pre><br />
<br />
Note - If you are using MySQL 5.6+ and when you issue the create user and get an error about the password hash you need to adjust the password to use the hash value<br />
<br />
You can get this by following the below<br />
<br />
mysql><pre>SELECT password('passwordformoodledude');</pre><br /><br />
<br />
This will print the hash of the password like *AD51BAFB2GD003D3480BCED0DH81AB0BG1712535, you will want to use this in the IDENTIFIED BY ' part<br />
<br />
== Step 7: Complete Setup ==<br />
<br />
*Note - If you are not comfortable using terminal to create the config.php file that needs to be created when going through the installer, you should temporarily make the webroot writable by doing the following:<br />
<br />
<pre>sudo chmod -R 777 /var/www/html/moodle</pre><br />
<br />
After you have ran the installer and you have moodle setup, you NEED to revert permissions so that it is no longer writable using the below command.<br />
<br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br />
Open your browser and go to http://IP.ADDRESS.OF.SERVER/moodle <br />
<br />
Follow the prompts:<br />
<br />
===Change the path for moodledata===<br />
<br />
/var/moodledata<br />
<br />
===Database Type===<br />
<br />
Choose: mysqli<br />
<br />
=== Database Settings ===<br />
<br />
Host server: localhost<br />
<br />
Database: moodle<br />
<br />
User: moodledude (the user you created when setting up the database)<br />
<br />
Password: passwordformoodledude (the password for the user you created)<br />
<br />
Tables Prefix: mdl_<br />
<br />
=== Environment Checks ===<br />
<br />
This will indicate if any elements required to run moodle haven't been installed.<br />
<br />
=== Next next next... ===<br />
follow prompts and confirm installation<br />
<br />
===Create a Site Administrator Account ===<br />
Create your moodle user account which will have site administrator permissions.<br />
<br />
The password you select has to meet certain security requirements.<br />
<br />
===Installation Complete ===<br />
Congrats! You can now start using Moodle!<br />
<br />
===Don't Forget===<br />
If you made the webroot writable, revert permissions<br />
<br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br />
== System Paths After Install==<br />
After installing Moodle you should set the system paths, this will provide better performance VS not setting them. Each entry in Moodle will have it's explanation.<br />
<br />
Navigate, on the moodle webpage, to Site Administration > Server > System Paths<br />
<br />
Input the following;<br />
<br />
Path to du: /usr/bin/du<br />
<br />
Path to apsell: /usr/bin/aspell<br />
<br />
Path to dot: /usr/bin/dot<br />
<br />
Save Changes<br />
<br />
<br />
*Optional if you do not already have an AntiVirus Solution<br />
<br />
We also installed ClamAV in Step 3 so we need to set the path in Moodle<br />
<br />
1st Create the Quarantine Directory<br />
<pre>sudo mkdir /var/quarantine</pre><br />
Change Ownership<br />
<pre>sudo chown -R www-data /var/quarantine</pre><br />
<br />
Navigate to Site Administration > Plugins > Antivirus plugins > Manage antivirus plugins<br />
<br />
Enable ClamAV antivirus<br />
<br />
Click on Settings<br />
<br />
Set the proper settings<br />
<br />
Save changes<br />
<br />
In previous Moodle branches: <br />
Check "Use ClamAV on uploaded files"<br />
ClamAV Path : /usr/bin/clamscan<br />
Quarantine Directory : /var/quarantine<br />
<br />
Save Changes<br />
<br />
== Suggestions: Enable Zend OpCache/Change Document Root==<br />
<br />
*Since we have installed Ubuntu Server 14.04LTS, we can use the built-in PHP OPcache, https://docs.moodle.org/26/en/OPcache<br />
<br />
Within the link above, https://docs.moodle.org/26/en/OPcache add the recommended settings to your 05-opcache.ini file. Again, substitute vi with vim and remember to use the correct key squences from the introduction.<br />
<br />
<pre>sudo vi /etc/php5/apache2/conf.d/05-opcache.ini</pre><br />
<br />
NOTE: In Ubuntu 16.04 opcache.ini is located in:<br />
<br />
<pre>/etc/php/7.0/mods-available/opcache.ini</pre><br />
<br />
Restart Apache for changes to take affect.<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
That's it for the Zend OpCache!<br />
<br />
You can also install a GUI to view the status of your Zend OpCache, not recommended on production servers.<br />
<br />
<pre>cd /var/www/html/moodle/</pre><br />
<br />
Download the PHP Script to your Moodle directory, you should also add this file to /opt/moodle/.git/info/exclude file so it does not get removed when upgrading your installation.<br />
<br />
<pre>sudo wget https://github.com/rlerdorf/opcache-status/blob/master/opcache.php</pre><br />
<br />
Visit http://ip.address.of.server/moodle/opcache.php<br />
<br />
If you do not want your end users to type http://yourserver/moodle and just want them to navigate to http://youserver you will need to edit the site configuration for Apache which will tell Apache to use the /var/www/html/moodle as the root directory and not /var/www/html<br />
<br />
Open up the Apache sites config and change the document root<br />
<br />
<pre>sudo vi /etc/apache2/sites-available/000-default.conf</pre><br />
<br />
On the line where DocumentRoot is;<br />
<br />
<br>Change From: DocumentRoot /var/www/html<br><br />
<br>Change To: DocumentRoot /var/www/html/moodle<br><br />
<br />
<pre>:w</pre><br />
<pre>:q</pre><br />
<br />
Restart Apache for changes to take affect.<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
Important note!<br />
<br />
If you have already installed Moodle then you should make the below changes.<br />
<br />
== Editing config.php for moodle ==<br />
<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the Internet, you will have to change this setting:<br />
<br />
For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php).<br />
If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see masquerading.<br />
<br />
<br />
Edit config.php for Moodle<br />
<br />
cd /var/www/html/moodle<br />
sudo vim config.php<br />
<br />
Hit the "insert" button on your keyboard, make then changes you need to make. Then press "escape" and type the following in to quit and to save changes (excluding quotation marks): ":wq"<br />
<br />
Under $CFG->wwwroot change to http://ip.address.of.server instead of http://ip.address.of.server/moodle<br />
<br />
<br />
==Hosting several Moodle branches in one Ubuntu server==<br />
* This is very useful for the language pack maintainers to test translations in several Moodle branches.<br />
* It is also very useful for developers to test their plugins in different Moodle branches.<br />
* Just create a folder for each instance inside the web folder and that would be enough. <br />
* To access the sites you only need to add the folder to localhost URL: http://localhost/moodle31<br />
* You can have an instance for each version from 1.9 to 3.1 <br />
<br />
* You do need a separate data folder for each instance and a separate database (You can use phpmyadmin to set your database, but that's not necessary), add each instance in its own folder, and carry on as above. You can also host another service (eg, Mahara) in it's separate folder.<br />
<br />
===Example 1===<br />
*So, one example folder tree on one Linux laptop (an actual server would be more) may look something like:<br />
<br />
var<br />
--www<br />
----maharadata<br />
----moodlecleandata<br />
----moodlestabledata<br />
----moodlemasterdata<br />
----moodletestingdata<br />
----uswmoodledata<br />
----html<br />
------mahara<br />
------moodleclean<br />
------moodlestable<br />
------moodlemaster<br />
------moodletesting<br />
------uswmoodle<br />
<br />
===Example 2===<br />
* Have several sandboxed Moodles on a single (CentOS X) server all of different versions .. only the ones that are supported for security fixes and above - 2.7,2.8,2.9,3.0, and now a 3.1. Pretty much 'stock' Moodles with only occasional addons, etc. for testing.<br />
* All have their separate code and data directories as well as their separate DB's.<br />
<br />
* Hint: install and maintain them all with [[Git_for_Administrators|git]] ... even if you don't prefer/like command line, that is by far the most efficient way to update and/or upgrade a site.<br />
<br />
/var/www/html/moodle27/version.php:$release = '2.7.14 (Build: 20160509)'<br />
/var/www/html/moodle28/version.php:$release = '2.8.12 (Build: 20160509)'<br />
/var/www/html/moodle29/version.php:$release = '2.9.6+ (Build: 20160520)'<br />
/var/www/html/moodle30/version.php:$release = '3.0.4+ (Build: 20160603)'<br />
/var/www/html/moodle31/version.php:$release = '3.1+ (Build: 20160603)'<br />
<br />
* The git -b command locks a site into the version provided with the rest of the git command ... for example, installing the 3.1, which is a long term support version, installed with git -b option. Don't plan on upgrading nor testing upgrades with that one.<br />
<br />
git clone -b MOODLE_31_STABLE git://git.moodle.org/moodle.git moodle31<br />
<br />
* All the other moodles I have on that server have been installed via git <br />
<br />
git clone git://git.moodle.org/moodle.git [nameofdir]<br />
<br />
* then from nameofdir<br />
<br />
git branch --track MOODLE_2#_STABLE origin/MOODLE_2#_STABLE<br />
git checkout MOODLE_2#_STABLE<br />
<br />
* 2# is the version number.<br />
<br />
* That allows one to march that moodle upwards ... higher branch(es). So one can test an upgrade (as opposed to an 'update').<br />
<br />
* This second method 'gits' more code and backups will range in the 5+ Meg range due to all the older version git stuff The 3.1 much less (restricted to 3.1 branch):<br />
<br />
* 545M ./moodle296-code-20160604145012.tar<br />
<br />
* 193M ./moodle31+-code-2016060883737.tar<br />
<br />
==See also==<br />
*[[Installation on Ubuntu using Git]]<br />
<br />
[[es:Guia de instalacion paso-a-paso para Ubuntu 16.04]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=Step-by-step_Installation_Guide_for_Ubuntu&diff=134907Step-by-step Installation Guide for Ubuntu2019-07-30T02:02:57Z<p>Wwycheuk: /* Example 2 */</p>
<hr />
<div>{{Installing Moodle}}<br />
{{Note|This document is about installing Moodle 3.6 in an Ubuntu 18.04 server with PHP 7.2.}}<br />
<br />
==Before you begin==<br />
It is a good idea to write down the passwords (and usernames) you will need to use for Ubuntu and Moodle:<br />
* The Ubuntu root password<br />
* The MySQL username and password that Moodle will use<br />
* The Moodle main admin username and password<br />
* An additional admin Moodle username and password<br />
<br />
== Step 1: Install Ubuntu ==<br />
<br />
===Why we prefer Ubuntu server over Ubuntu desktop===<br />
* Most IT professionals prefer to use a Command Line Interface (CLI) server, because it is safer and less prone to hacking.<br />
* Amateur users might find it easier to use a graphical (desktop) interface.<br />
* If you will only be using your Moodle server for local, experimental purposes, you might prefer to install the desktop (64 bits preferred) version of Ubuntu.<br />
* If you install a CLI only server and later regret it, you can easily add a graphical desktop:<br />
{{Note| Even though it is not recommended by most experts, you could install a Graphical User Interface (desktop) by issuing the command 'sudo tasksel' or 'sudo apt install ubuntu-desktop' to [https://help.ubuntu.com/community/ServerGUI install 'Ubuntu desktop']. BUT USE WITH CAUTION: The GUI may not appear as expected, and may prevent user from getting even the CLI. Try it at test machine first.}}<br />
<br />
===Why we prefer (or don't prefer) Ubuntu 18.04 over Ubuntu 16.04 over Ubuntu 14.04===<br />
* All three are LTS (Long Term Service) releases. <b>amd64 edition preferred.</b> <b>http://www.ubuntu.com/download</b><br />
* Ubuntu Server 18.04 has all the required packages (comes default with Apache2, [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7.2], MySQL 5.7). Ubuntu Server 18.04 has some minor differences from 16.04 and 14.04, mainly PHP. This document has been updated to reflect those changes.<br />
* Moodle 3.0.1 onwards can use [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7.0]. Moodle 3.7 requries PHP 7.1.<br />
* But beware that if you are using external authentication or enrollment plug-ins, please note that at the moment of Moodle 3.0.1 release (December 2015) neither MSSQL nor SQLSRV are available under php7. So, [https://docs.moodle.org/dev/Moodle_and_PHP7#Can_I_use_PHP7_yet.3F anybody using SQL*Server as primary database or remote auth/enrol plugin should not move to PHP 7] at all ! Also, depending of your configuration, some extensions (memcached [https://docs.moodle.org/dev/Moodle_and_PHP7#Manually_installing_Memcached can be installed], redis, mongodb, xmlrpc...) maybe missing or work in progress for your distribution, triple check the exact availability for your OS.<br />
<br />
===Procedure===<br />
*Ubuntu has a well known issue with its automatic updates filling up the /boot directory until automated updates start to fail and automated removal of old kernel files from /boot is impossible. Because of this you should consider installing Ubuntu with a /boot directory of around 5Gb and putting some automated clean up in place. More info can be found here - [https://help.ubuntu.com/community/RemoveOldKernels]<br />
<br />
*You can use either VI (lightweight editor) or VIM (heavyweight editor), however, if you wish to use VIM you will need to install it<br />
<pre>sudo apt-get install vim</pre><br />
<br />
*VI or VIM Commands<br /><br />
To edit a file press "Insert" Key<br /><br />
To finish editing press "Esc" Key<br /><br />
To write the file press ":w"<br /><br />
To Exit the editor press ":q"<br /><br />
You can also write and quit ":wq"<br />
<br />
*In Ubuntu, the standard user, the account you created during the install, does not have rights to install/write to many of the directories. In the below tutorial we will be using the term "sudo" which stands for "super user do" before most of the commands.<br />
<br />
== Step 2: Install Apache/MySQL/PHP ==<br />
{{Note| Moodle 3.0.1 [https://docs.moodle.org/dev/Moodle_3.0.1_release_notes introduced support for PHP 7.0 and we will be using PHP 7.2 in this tutorial]}}<br />
Open up Terminal and install the following;<br />
<br />
<pre>sudo apt install apache2 mysql-client mysql-server php libapache2-mod-php</pre> <br />
<br />
'''Run 'sudo mysql_secure_installation' to set the root password for mysql - please, please my dear friends, WRITE IT DOWN and spare yourself some grief, you will need it in step 6.'''<br />
<br />
== Step 3: Install Additional Software ==<br />
<br />
<pre>sudo apt install graphviz aspell ghostscript clamav php7.2-pspell php7.2-curl php7.2-gd php7.2-intl php7.2-mysql php7.2-xml php7.2-xmlrpc php7.2-ldap php7.2-zip php7.2-soap php7.2-mbstring</pre><br />
<br />
Restart Apache so that the modules are loaded correctly<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
We will be using [[Git]] to install/update the Moodle Core Application<br />
<br />
<pre>sudo apt install git</pre><br />
<br />
== Step 4: Download Moodle ==<br />
<br />
Setup your local repository and download Moodle, We will use /opt for this installation.<br />
<br />
*[[Git]] is what is called a "version control system". By using [[Git|git]] it will much easier down the road to update the moodle core application. Within Step 5 there is a little more detail on why we put the moodle core application code in the /opt directory. <br />
<br />
<pre>cd /opt</pre><br />
<br />
Download the Moodle Code and Index<br />
<br />
<pre>sudo git clone git://git.moodle.org/moodle.git</pre><br />
<br />
Change directory into the downloaded Moodle folder<br />
<br />
<pre>cd moodle</pre><br /><br />
<br />
Retrieve a list of each branch available<br />
<br />
<pre>sudo git branch -a</pre><br />
<br />
Tell [[Git|git]] which branch to track or use<br />
<br />
<pre>sudo git branch --track MOODLE_36_STABLE origin/MOODLE_36_STABLE</pre><br />
<br />
Finally, Check out the Moodle version specified<br />
<br />
<pre>sudo git checkout MOODLE_36_STABLE</pre><br />
<br />
== Step 5: Copy local repository to /var/www/html/ ==<br />
<br />
<pre>sudo cp -R /opt/moodle /var/www/html/</pre><br /><br />
<pre>sudo mkdir /var/moodledata</pre><br /><br />
<pre>sudo chown -R www-data /var/moodledata</pre><br /><br />
<pre>sudo chmod -R 777 /var/moodledata</pre><br /><br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br /><br />
* Explanation:<br />
<br /><br />
Since we setup a local repository in the previous step, you will copy it to your webroot after any updates and making changes. Having your local repository outside of the webroot, like we have in /opt, you will be able to prepare and stage your upgrades in a more efficient manner. For example, you want to make some changes or add some plug-ins, you would download the plugin and copy it to your local moodle repository. After you have added the plug-in and any other changes you might have made you will need to edit the file located in /opt/moodle/.git/info/exclude. Within that file you want to tell [[Git|git]] which files/folders to exclude when it pulls down the updates when you run your next "sudo git pull". An example entry would be the certificate mod located in /opt/moodle/mod/certificate so within the exclude file you want to add "/mod/certificate" below the last comments. You would add additional entries, 1 per line, for each plug-in or file you might have changed. If I were to change the favicon.ico file you would just add "favicon.ico" to the exclude file. Now when you run "sudo git pull" to update moodle to the latest version it will ignore those files and directories and just update the core moodle code. Before copying to your webroot to upgrade you want to make sure and download and copy over the latest versions of the plug-ins you might have added.<br />
<br />
== Step 6: Setup MySQL Server ==<br />
<br />
First we need to change the default storage engine to innodb and change the default file format to Barracuda, this is a new setting compared to previous versions. You also need to set innodb_file_per_table in order for Barracuda to work properly. Ref: https://dev.mysql.com/doc/refman/5.6/en/innodb-compression-usage.html<br />
<br />
*You should not need to make innodb the default storage engine anymore, the latest version of Moodle will select it automatically during install. It is always a good idea to make it default anyway. You do however need to set the default file format!<br />
<br />
*If you chose to use VIM instead please substitute vi for vim<br />
<br />
<pre>sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement. if you want to add you have to press the "insert" button on your keyboard. this is usually above the "delete" button. this allows you to add some text.<br />
<br />
<pre>default_storage_engine = innodb</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_file_format = Barracuda</pre><br />
<br />
In order to save my.cnf using the editor, press the Esc (Escape) key, type the following in sequence which will save :w then close the editor :q<br />
<br />
<pre>:w</pre><br /><br />
<pre>:q</pre><br />
<br />
Restart MySQL Server for changes to take affect<br />
<br />
<pre>sudo service mysql restart</pre><br />
<br />
Now we need to create the Moodle database and the Moodle MySQL User with the correct permissions<br />
<br />
Use the password you created in step 1<br />
<pre>sudo mysql -u root -p</pre><br /><br />
mysql><pre>CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;</pre><br />
<br />
{{Note| Use 'utf8mb4' for full range (4-byte) support of UTF-8, including Emoji ('utf8' only supports 3-byte). You will be compliant by Moodle admin page if you don't use 'utf8mb4' here.}}<br />
<br />
Where it says "moodledude" and "passwordformoodledude" you should change to the username and password of your choosing.<br />
mysql><pre>create user 'moodledude'@'localhost' IDENTIFIED BY 'passwordformoodledude';</pre><br /><br />
mysql><pre>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodledude@localhost IDENTIFIED BY 'passwordformoodledude';</pre><br /><br />
mysql><pre>quit;</pre><br />
<br />
Note - If you are using MySQL 5.6+ and when you issue the create user and get an error about the password hash you need to adjust the password to use the hash value<br />
<br />
You can get this by following the below<br />
<br />
mysql><pre>SELECT password('passwordformoodledude');</pre><br /><br />
<br />
This will print the hash of the password like *AD51BAFB2GD003D3480BCED0DH81AB0BG1712535, you will want to use this in the IDENTIFIED BY ' part<br />
<br />
== Step 7: Complete Setup ==<br />
<br />
*Note - If you are not comfortable using terminal to create the config.php file that needs to be created when going through the installer, you should temporarily make the webroot writable by doing the following:<br />
<br />
<pre>sudo chmod -R 777 /var/www/html/moodle</pre><br />
<br />
After you have ran the installer and you have moodle setup, you NEED to revert permissions so that it is no longer writable using the below command.<br />
<br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br />
Open your browser and go to http://IP.ADDRESS.OF.SERVER/moodle <br />
<br />
Follow the prompts:<br />
<br />
===Change the path for moodledata===<br />
<br />
/var/moodledata<br />
<br />
===Database Type===<br />
<br />
Choose: mysqli<br />
<br />
=== Database Settings ===<br />
<br />
Host server: localhost<br />
<br />
Database: moodle<br />
<br />
User: moodledude (the user you created when setting up the database)<br />
<br />
Password: passwordformoodledude (the password for the user you created)<br />
<br />
Tables Prefix: mdl_<br />
<br />
=== Environment Checks ===<br />
<br />
This will indicate if any elements required to run moodle haven't been installed.<br />
<br />
=== Next next next... ===<br />
follow prompts and confirm installation<br />
<br />
===Create a Site Administrator Account ===<br />
Create your moodle user account which will have site administrator permissions.<br />
<br />
The password you select has to meet certain security requirements.<br />
<br />
===Installation Complete ===<br />
Congrats! You can now start using Moodle!<br />
<br />
===Don't Forget===<br />
If you made the webroot writable, revert permissions<br />
<br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br />
== System Paths After Install==<br />
After installing Moodle you should set the system paths, this will provide better performance VS not setting them. Each entry in Moodle will have it's explanation.<br />
<br />
Navigate, on the moodle webpage, to Site Administration > Server > System Paths<br />
<br />
Input the following;<br />
<br />
Path to du: /usr/bin/du<br />
<br />
Path to apsell: /usr/bin/aspell<br />
<br />
Path to dot: /usr/bin/dot<br />
<br />
Save Changes<br />
<br />
<br />
*Optional if you do not already have an AntiVirus Solution<br />
<br />
We also installed ClamAV in Step 3 so we need to set the path in Moodle<br />
<br />
1st Create the Quarantine Directory<br />
<pre>sudo mkdir /var/quarantine</pre><br />
Change Ownership<br />
<pre>sudo chown -R www-data /var/quarantine</pre><br />
<br />
Navigate to Site Administration > Plugins > Antivirus plugins > Manage antivirus plugins<br />
<br />
Enable ClamAV antivirus<br />
<br />
Click on Settings<br />
<br />
Set the proper settings<br />
<br />
Save changes<br />
<br />
In previous Moodle branches: <br />
Check "Use ClamAV on uploaded files"<br />
ClamAV Path : /usr/bin/clamscan<br />
Quarantine Directory : /var/quarantine<br />
<br />
Save Changes<br />
<br />
== Suggestions: Enable Zend OpCache/Change Document Root==<br />
<br />
*Since we have installed Ubuntu Server 14.04LTS, we can use the built-in PHP OPcache, https://docs.moodle.org/26/en/OPcache<br />
<br />
Within the link above, https://docs.moodle.org/26/en/OPcache add the recommended settings to your 05-opcache.ini file. Again, substitute vi with vim and remember to use the correct key squences from the introduction.<br />
<br />
<pre>sudo vi /etc/php5/apache2/conf.d/05-opcache.ini</pre><br />
<br />
NOTE: In Ubuntu 16.04 opcache.ini is located in:<br />
<br />
<pre>/etc/php/7.0/mods-available/opcache.ini</pre><br />
<br />
Restart Apache for changes to take affect.<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
That's it for the Zend OpCache!<br />
<br />
You can also install a GUI to view the status of your Zend OpCache, not recommended on production servers.<br />
<br />
<pre>cd /var/www/html/moodle/</pre><br />
<br />
Download the PHP Script to your Moodle directory, you should also add this file to /opt/moodle/.git/info/exclude file so it does not get removed when upgrading your installation.<br />
<br />
<pre>sudo wget https://github.com/rlerdorf/opcache-status/blob/master/opcache.php</pre><br />
<br />
Visit http://ip.address.of.server/moodle/opcache.php<br />
<br />
If you do not want your end users to type http://yourserver/moodle and just want them to navigate to http://youserver you will need to edit the site configuration for Apache which will tell Apache to use the /var/www/html/moodle as the root directory and not /var/www/html<br />
<br />
Open up the Apache sites config and change the document root<br />
<br />
<pre>sudo vi /etc/apache2/sites-available/000-default.conf</pre><br />
<br />
On the line where DocumentRoot is;<br />
<br />
<br>Change From: DocumentRoot /var/www/html<br><br />
<br>Change To: DocumentRoot /var/www/html/moodle<br><br />
<br />
<pre>:w</pre><br />
<pre>:q</pre><br />
<br />
Restart Apache for changes to take affect.<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
Important note!<br />
<br />
If you have already installed Moodle then you should make the below changes.<br />
<br />
== Editing config.php for moodle ==<br />
<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the Internet, you will have to change this setting:<br />
<br />
For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php).<br />
If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see masquerading.<br />
<br />
<br />
Edit config.php for Moodle<br />
<br />
cd /var/www/html/moodle<br />
sudo vim config.php<br />
<br />
Hit the "insert" button on your keyboard, make then changes you need to make. Then press "escape" and type the following in to quit and to save changes (excluding quotation marks): ":wq"<br />
<br />
Under $CFG->wwwroot change to http://ip.address.of.server instead of http://ip.address.of.server/moodle<br />
<br />
<br />
==Hosting several Moodle branches in one Ubuntu server==<br />
* This is very useful for the language pack maintainers to test translations in several Moodle branches.<br />
* It is also very useful for developers to test their plugins in different Moodle branches.<br />
* Just create a folder for each instance inside the web folder and that would be enough. <br />
* To access the sites you only need to add the folder to localhost URL: http://localhost/moodle31<br />
* You can have an instance for each version from 1.9 to 3.1 <br />
<br />
* You do need a separate data folder for each instance and a separate database (You can use phpmyadmin to set your database, but that's not necessary), add each instance in its own folder, and carry on as above. You can also host another service (eg, Mahara) in it's separate folder.<br />
<br />
===Example 1===<br />
*So, one example folder tree on one Linux laptop (an actual server would be more) may look something like:<br />
<br />
var<br />
--www<br />
----maharadata<br />
----moodlecleandata<br />
----moodlestabledata<br />
----moodlemasterdata<br />
----moodletestingdata<br />
----uswmoodledata<br />
----html<br />
------mahara<br />
------moodleclean<br />
------moodlestable<br />
------moodlemaster<br />
------moodletesting<br />
------uswmoodle<br />
<br />
===Example 2===<br />
* Have several sandboxed Moodles on a single (CentOS X) server all of different versions .. only the ones that are supported for security fixes and above - 2.7,2.8,2.9,3.0, and now a 3.1. Pretty much 'stock' Moodles with only occasional addons, etc. for testing.<br />
* All have their separate code and data directories as well as their separate DB's.<br />
<br />
* Hint: install and maintain them all with [[Git_for_Administrators|git]] ... even if you don't prefer/like command line, that is by far the most efficient way to update and/or upgrade a site.<br />
<br />
/var/www/html/moodle27/version.php:$release = '2.7.14 (Build: 20160509)'<br />
/var/www/html/moodle28/version.php:$release = '2.8.12 (Build: 20160509)'<br />
/var/www/html/moodle29/version.php:$release = '2.9.6+ (Build: 20160520)'<br />
/var/www/html/moodle30/version.php:$release = '3.0.4+ (Build: 20160603)'<br />
/var/www/html/moodle31/version.php:$release = '3.1+ (Build: 20160603)'<br />
<br />
* The git -b command locks a site into the version provided with the rest of the git command ... for example, installing the 3.1, which is a long term support version, installed with git -b option. Don't plan on upgrading nor testing upgrades with that one.<br />
<br />
git clone -b MOODLE_31_STABLE git://git.moodle.org/moodle.git moodle31<br />
<br />
* All the other moodles I have on that server have been installed via git <br />
<br />
git clone git://git.moodle.org/moodle.git [nameofdir]<br />
<br />
* then from nameofdir<br />
<br />
git branch --track MOODLE_2#_STABLE origin/MOODLE_2#_STABLE<br />
git checkout MOODLE_2#_STABLE<br />
<br />
* 2# is the version number.<br />
<br />
* That allows one to march that moodle upwards ... higher branch(es). So one can test an upgrade (as opposed to an 'update').<br />
<br />
* This second method 'gits' more code and backups will range in the 5+ Meg range due to all the older version git stuff The 3.1 much less (restricted to 3.1 branch):<br />
<br />
* 545M ./moodle296-code-20160604145012.tar<br />
<br />
* 193M ./moodle31+-code-2016060883737.tar<br />
<br />
==See also==<br />
*[[Installation on Ubuntu using Git]]<br />
<br />
[[es:Guia de instalacion paso-a-paso para Ubuntu 16.04]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=Step-by-step_Installation_Guide_for_Ubuntu&diff=134826Step-by-step Installation Guide for Ubuntu2019-07-23T02:41:42Z<p>Wwycheuk: /* Why we prefer (or don't prefer) Ubuntu 18.04 over Ubuntu 16.04 over Ubuntu 14.04 */</p>
<hr />
<div>{{Installing Moodle}}<br />
{{Note|This document is about installing Moodle 3.6 in an Ubuntu 18.04 server with PHP 7.2.}}<br />
<br />
==Before you begin==<br />
It is a good idea to write down the passwords (and usernames) you will need to use for Ubuntu and Moodle:<br />
* The Ubuntu root password<br />
* The MySQL username and password that Moodle will use<br />
* The Moodle main admin username and password<br />
* An additional admin Moodle username and password<br />
<br />
== Step 1: Install Ubuntu ==<br />
<br />
===Why we prefer Ubuntu server over Ubuntu desktop===<br />
* Most IT professionals prefer to use a Command Line Interface (CLI) server, because it is safer and less prone to hacking.<br />
* Amateur users might find it easier to use a graphical (desktop) interface.<br />
* If you will only be using your Moodle server for local, experimental purposes, you might prefer to install the desktop (64 bits preferred) version of Ubuntu.<br />
* If you install a CLI only server and later regret it, you can easily add a graphical desktop:<br />
{{Note| Even though it is not recommended by most experts, you could install a Graphical User Interface (desktop) by issuing the command 'sudo tasksel' or 'sudo apt install ubuntu-desktop' to [https://help.ubuntu.com/community/ServerGUI install 'Ubuntu desktop']. BUT USE WITH CAUTION: The GUI may not appear as expected, and may prevent user from getting even the CLI. Try it at test machine first.}}<br />
<br />
===Why we prefer (or don't prefer) Ubuntu 18.04 over Ubuntu 16.04 over Ubuntu 14.04===<br />
* All three are LTS (Long Term Service) releases. <b>amd64 edition preferred.</b> <b>http://www.ubuntu.com/download</b><br />
* Ubuntu Server 18.04 has all the required packages (comes default with Apache2, [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7.2], MySQL 5.7). Ubuntu Server 18.04 has some minor differences from 16.04 and 14.04, mainly PHP. This document has been updated to reflect those changes.<br />
* Moodle 3.0.1 onwards can use [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7.0]. Moodle 3.7 requries PHP 7.1.<br />
* But beware that if you are using external authentication or enrollment plug-ins, please note that at the moment of Moodle 3.0.1 release (December 2015) neither MSSQL nor SQLSRV are available under php7. So, [https://docs.moodle.org/dev/Moodle_and_PHP7#Can_I_use_PHP7_yet.3F anybody using SQL*Server as primary database or remote auth/enrol plugin should not move to PHP 7] at all ! Also, depending of your configuration, some extensions (memcached [https://docs.moodle.org/dev/Moodle_and_PHP7#Manually_installing_Memcached can be installed], redis, mongodb, xmlrpc...) maybe missing or work in progress for your distribution, triple check the exact availability for your OS.<br />
<br />
===Procedure===<br />
*Ubuntu has a well known issue with its automatic updates filling up the /boot directory until automated updates start to fail and automated removal of old kernel files from /boot is impossible. Because of this you should consider installing Ubuntu with a /boot directory of around 5Gb and putting some automated clean up in place. More info can be found here - [https://help.ubuntu.com/community/RemoveOldKernels]<br />
<br />
*You can use either VI (lightweight editor) or VIM (heavyweight editor), however, if you wish to use VIM you will need to install it<br />
<pre>sudo apt-get install vim</pre><br />
<br />
*VI or VIM Commands<br /><br />
To edit a file press "Insert" Key<br /><br />
To finish editing press "Esc" Key<br /><br />
To write the file press ":w"<br /><br />
To Exit the editor press ":q"<br /><br />
You can also write and quit ":wq"<br />
<br />
*In Ubuntu, the standard user, the account you created during the install, does not have rights to install/write to many of the directories. In the below tutorial we will be using the term "sudo" which stands for "super user do" before most of the commands.<br />
<br />
== Step 2: Install Apache/MySQL/PHP ==<br />
{{Note| Moodle 3.0.1 [https://docs.moodle.org/dev/Moodle_3.0.1_release_notes introduced support for PHP 7.0 and we will be using PHP 7.2 in this tutorial]}}<br />
Open up Terminal and install the following;<br />
<br />
<pre>sudo apt install apache2 mysql-client mysql-server php libapache2-mod-php</pre> <br />
<br />
'''Run 'sudo mysql_secure_installation' to set the root password for mysql - please, please my dear friends, WRITE IT DOWN and spare yourself some grief, you will need it in step 6.'''<br />
<br />
== Step 3: Install Additional Software ==<br />
<br />
<pre>sudo apt install graphviz aspell ghostscript clamav php7.2-pspell php7.2-curl php7.2-gd php7.2-intl php7.2-mysql php7.2-xml php7.2-xmlrpc php7.2-ldap php7.2-zip php7.2-soap php7.2-mbstring</pre><br />
<br />
Restart Apache so that the modules are loaded correctly<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
We will be using [[Git]] to install/update the Moodle Core Application<br />
<br />
<pre>sudo apt install git</pre><br />
<br />
== Step 4: Download Moodle ==<br />
<br />
Setup your local repository and download Moodle, We will use /opt for this installation.<br />
<br />
*[[Git]] is what is called a "version control system". By using [[Git|git]] it will much easier down the road to update the moodle core application. Within Step 5 there is a little more detail on why we put the moodle core application code in the /opt directory. <br />
<br />
<pre>cd /opt</pre><br />
<br />
Download the Moodle Code and Index<br />
<br />
<pre>sudo git clone git://git.moodle.org/moodle.git</pre><br />
<br />
Change directory into the downloaded Moodle folder<br />
<br />
<pre>cd moodle</pre><br /><br />
<br />
Retrieve a list of each branch available<br />
<br />
<pre>sudo git branch -a</pre><br />
<br />
Tell [[Git|git]] which branch to track or use<br />
<br />
<pre>sudo git branch --track MOODLE_36_STABLE origin/MOODLE_36_STABLE</pre><br />
<br />
Finally, Check out the Moodle version specified<br />
<br />
<pre>sudo git checkout MOODLE_36_STABLE</pre><br />
<br />
== Step 5: Copy local repository to /var/www/html/ ==<br />
<br />
<pre>sudo cp -R /opt/moodle /var/www/html/</pre><br /><br />
<pre>sudo mkdir /var/moodledata</pre><br /><br />
<pre>sudo chown -R www-data /var/moodledata</pre><br /><br />
<pre>sudo chmod -R 777 /var/moodledata</pre><br /><br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br /><br />
* Explanation:<br />
<br /><br />
Since we setup a local repository in the previous step, you will copy it to your webroot after any updates and making changes. Having your local repository outside of the webroot, like we have in /opt, you will be able to prepare and stage your upgrades in a more efficient manner. For example, you want to make some changes or add some plug-ins, you would download the plugin and copy it to your local moodle repository. After you have added the plug-in and any other changes you might have made you will need to edit the file located in /opt/moodle/.git/info/exclude. Within that file you want to tell [[Git|git]] which files/folders to exclude when it pulls down the updates when you run your next "sudo git pull". An example entry would be the certificate mod located in /opt/moodle/mod/certificate so within the exclude file you want to add "/mod/certificate" below the last comments. You would add additional entries, 1 per line, for each plug-in or file you might have changed. If I were to change the favicon.ico file you would just add "favicon.ico" to the exclude file. Now when you run "sudo git pull" to update moodle to the latest version it will ignore those files and directories and just update the core moodle code. Before copying to your webroot to upgrade you want to make sure and download and copy over the latest versions of the plug-ins you might have added.<br />
<br />
== Step 6: Setup MySQL Server ==<br />
<br />
First we need to change the default storage engine to innodb and change the default file format to Barracuda, this is a new setting compared to previous versions. You also need to set innodb_file_per_table in order for Barracuda to work properly. Ref: https://dev.mysql.com/doc/refman/5.6/en/innodb-compression-usage.html<br />
<br />
*You should not need to make innodb the default storage engine anymore, the latest version of Moodle will select it automatically during install. It is always a good idea to make it default anyway. You do however need to set the default file format!<br />
<br />
*If you chose to use VIM instead please substitute vi for vim<br />
<br />
<pre>sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement. if you want to add you have to press the "insert" button on your keyboard. this is usually above the "delete" button. this allows you to add some text.<br />
<br />
<pre>default_storage_engine = innodb</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_file_format = Barracuda</pre><br />
<br />
In order to save my.cnf using the editor, press the Esc (Escape) key, type the following in sequence which will save :w then close the editor :q<br />
<br />
<pre>:w</pre><br /><br />
<pre>:q</pre><br />
<br />
Restart MySQL Server for changes to take affect<br />
<br />
<pre>sudo service mysql restart</pre><br />
<br />
Now we need to create the Moodle database and the Moodle MySQL User with the correct permissions<br />
<br />
Use the password you created in step 1<br />
<pre>sudo mysql -u root -p</pre><br /><br />
mysql><pre>CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;</pre><br />
<br />
{{Note| Use 'utf8mb4' for full range (4-byte) support of UTF-8, including Emoji ('utf8' only supports 3-byte). You will be compliant by Moodle admin page if you don't use 'utf8mb4' here.}}<br />
<br />
Where it says "moodledude" and "passwordformoodledude" you should change to the username and password of your choosing.<br />
mysql><pre>create user 'moodledude'@'localhost' IDENTIFIED BY 'passwordformoodledude';</pre><br /><br />
mysql><pre>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodledude@localhost IDENTIFIED BY 'passwordformoodledude';</pre><br /><br />
mysql><pre>quit;</pre><br />
<br />
Note - If you are using MySQL 5.6+ and when you issue the create user and get an error about the password hash you need to adjust the password to use the hash value<br />
<br />
You can get this by following the below<br />
<br />
mysql><pre>SELECT password('passwordformoodledude');</pre><br /><br />
<br />
This will print the hash of the password like *AD51BAFB2GD003D3480BCED0DH81AB0BG1712535, you will want to use this in the IDENTIFIED BY ' part<br />
<br />
== Step 7: Complete Setup ==<br />
<br />
*Note - If you are not comfortable using terminal to create the config.php file that needs to be created when going through the installer, you should temporarily make the webroot writable by doing the following:<br />
<br />
<pre>sudo chmod -R 777 /var/www/html/moodle</pre><br />
<br />
After you have ran the installer and you have moodle setup, you NEED to revert permissions so that it is no longer writable using the below command.<br />
<br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br />
Open your browser and go to http://IP.ADDRESS.OF.SERVER/moodle <br />
<br />
Follow the prompts:<br />
<br />
===Change the path for moodledata===<br />
<br />
/var/moodledata<br />
<br />
===Database Type===<br />
<br />
Choose: mysqli<br />
<br />
=== Database Settings ===<br />
<br />
Host server: localhost<br />
<br />
Database: moodle<br />
<br />
User: moodledude (the user you created when setting up the database)<br />
<br />
Password: passwordformoodledude (the password for the user you created)<br />
<br />
Tables Prefix: mdl_<br />
<br />
=== Environment Checks ===<br />
<br />
This will indicate if any elements required to run moodle haven't been installed.<br />
<br />
=== Next next next... ===<br />
follow prompts and confirm installation<br />
<br />
===Create a Site Administrator Account ===<br />
Create your moodle user account which will have site administrator permissions.<br />
<br />
The password you select has to meet certain security requirements.<br />
<br />
===Installation Complete ===<br />
Congrats! You can now start using Moodle!<br />
<br />
===Don't Forget===<br />
If you made the webroot writable, revert permissions<br />
<br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br />
== System Paths After Install==<br />
After installing Moodle you should set the system paths, this will provide better performance VS not setting them. Each entry in Moodle will have it's explanation.<br />
<br />
Navigate, on the moodle webpage, to Site Administration > Server > System Paths<br />
<br />
Input the following;<br />
<br />
Path to du: /usr/bin/du<br />
<br />
Path to apsell: /usr/bin/aspell<br />
<br />
Path to dot: /usr/bin/dot<br />
<br />
Save Changes<br />
<br />
<br />
*Optional if you do not already have an AntiVirus Solution<br />
<br />
We also installed ClamAV in Step 3 so we need to set the path in Moodle<br />
<br />
1st Create the Quarantine Directory<br />
<pre>sudo mkdir /var/quarantine</pre><br />
Change Ownership<br />
<pre>sudo chown -R www-data /var/quarantine</pre><br />
<br />
Navigate to Site Administration > Plugins > Antivirus plugins > Manage antivirus plugins<br />
<br />
Enable ClamAV antivirus<br />
<br />
Click on Settings<br />
<br />
Set the proper settings<br />
<br />
Save changes<br />
<br />
In previous Moodle branches: <br />
Check "Use ClamAV on uploaded files"<br />
ClamAV Path : /usr/bin/clamscan<br />
Quarantine Directory : /var/quarantine<br />
<br />
Save Changes<br />
<br />
== Suggestions: Enable Zend OpCache/Change Document Root==<br />
<br />
*Since we have installed Ubuntu Server 14.04LTS, we can use the built-in PHP OPcache, https://docs.moodle.org/26/en/OPcache<br />
<br />
Within the link above, https://docs.moodle.org/26/en/OPcache add the recommended settings to your 05-opcache.ini file. Again, substitute vi with vim and remember to use the correct key squences from the introduction.<br />
<br />
<pre>sudo vi /etc/php5/apache2/conf.d/05-opcache.ini</pre><br />
<br />
NOTE: In Ubuntu 16.04 opcache.ini is located in:<br />
<br />
<pre>/etc/php/7.0/mods-available/opcache.ini</pre><br />
<br />
Restart Apache for changes to take affect.<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
That's it for the Zend OpCache!<br />
<br />
You can also install a GUI to view the status of your Zend OpCache, not recommended on production servers.<br />
<br />
<pre>cd /var/www/html/moodle/</pre><br />
<br />
Download the PHP Script to your Moodle directory, you should also add this file to /opt/moodle/.git/info/exclude file so it does not get removed when upgrading your installation.<br />
<br />
<pre>sudo wget https://github.com/rlerdorf/opcache-status/blob/master/opcache.php</pre><br />
<br />
Visit http://ip.address.of.server/moodle/opcache.php<br />
<br />
If you do not want your end users to type http://yourserver/moodle and just want them to navigate to http://youserver you will need to edit the site configuration for Apache which will tell Apache to use the /var/www/html/moodle as the root directory and not /var/www/html<br />
<br />
Open up the Apache sites config and change the document root<br />
<br />
<pre>sudo vi /etc/apache2/sites-available/000-default.conf</pre><br />
<br />
On the line where DocumentRoot is;<br />
<br />
<br>Change From: DocumentRoot /var/www/html<br><br />
<br>Change To: DocumentRoot /var/www/html/moodle<br><br />
<br />
<pre>:w</pre><br />
<pre>:q</pre><br />
<br />
Restart Apache for changes to take affect.<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
Important note!<br />
<br />
If you have already installed Moodle then you should make the below changes.<br />
<br />
== Editing config.php for moodle ==<br />
<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the Internet, you will have to change this setting:<br />
<br />
For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php).<br />
If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see masquerading.<br />
<br />
<br />
Edit config.php for Moodle<br />
<br />
cd /var/www/html/moodle<br />
sudo vim config.php<br />
<br />
Hit the "insert" button on your keyboard, make then changes you need to make. Then press "escape" and type the following in to quit and to save changes (excluding quotation marks): ":wq"<br />
<br />
Under $CFG->wwwroot change to http://ip.address.of.server instead of http://ip.address.of.server/moodle<br />
<br />
<br />
==Hosting several Moodle branches in one Ubuntu server==<br />
* This is very useful for the language pack maintainers to test translations in several Moodle branches.<br />
* It is also very useful for developers to test their plugins in different Moodle branches.<br />
* Just create a folder for each instance inside the web folder and that would be enough. <br />
* To access the sites you only need to add the folder to localhost URL: http://localhost/moodle31<br />
* You can have an instance for each version from 1.9 to 3.1 <br />
<br />
* You do need a separate data folder for each instance and a separate database (You can use phpmyadmin to set your database, but that's not necessary), add each instance in its own folder, and carry on as above. You can also host another service (eg, Mahara) in it's separate folder.<br />
<br />
===Example 1===<br />
*So, one example folder tree on one Linux laptop (an actual server would be more) may look something like:<br />
<br />
var<br />
--www<br />
----maharadata<br />
----moodlecleandata<br />
----moodlestabledata<br />
----moodlemasterdata<br />
----moodletestingdata<br />
----uswmoodledata<br />
----html<br />
------mahara<br />
------moodleclean<br />
------moodlestable<br />
------moodlemaster<br />
------moodletesting<br />
------uswmoodle<br />
<br />
===Example 2===<br />
* Have several sandboxed Moodles on a single (CentOS X) server all of different versions .. only the ones that are supported for security fixes and above - 2.7,2.8,2.9,3.0, and now a 3.1. Pretty much 'stock' Moodles with only occasional addons, etc. for testing.<br />
* All have their separate code and data directories as well as their separate DB's.<br />
<br />
* Hint: install and maintain them all with [[Git_for_Administrators|git]] ... even if you don't prefer/like command line, that is by far the most efficient way to update and/or upgrade a site.<br />
<br />
/var/www/html/moodle27/version.php:$release = '2.7.14 (Build: 20160509)'<br />
/var/www/html/moodle28/version.php:$release = '2.8.12 (Build: 20160509)'<br />
/var/www/html/moodle29/version.php:$release = '2.9.6+ (Build: 20160520)'<br />
/var/www/html/moodle30/version.php:$release = '3.0.4+ (Build: 20160603)'<br />
/var/www/html/moodle31/version.php:$release = '3.1+ (Build: 20160603)'<br />
<br />
* The git -b command locks a site into the version provided with the rest of the git command ... for example, installing the 3.1, which is a long term support version, installed with git -b option. Don't plan on upgrading nor testing upgrades with that one.<br />
<br />
git clone -b MOODLE_31_STABLE git://git.moodle.org/moodle.git moodle31<br />
<br />
* All the other moodles I have on that server have been installed via git <br />
<br />
git clone git://git.moodle.org/moodle.git [nameofdir]<br />
<br />
* then from nameofdir<br />
<br />
git branch --track MOODLE_2#_STABLE origin/MOODLE_2#_STABLE<br />
git checkout MOODLE_2#_STABLE<br />
<br />
* 2# is the version number.<br />
<br />
* That allows one to march that moodle upwards ... higher branch(es). So one can test an upgrade (as opposed to an 'update').<br />
<br />
* This second method 'gits' more code and backups will range in the 5+ Meg range due to all the older version git stuff The 3.1 much less (restricted to 3.1 branch):<br />
<br />
* 545M ./moodle296-code-20160604145012.tar<br />
<br />
* 193M ./moodle31+-code-2016060883737.tar<br />
<br />
<br />
[[es:Guia de instalacion paso-a-paso para Ubuntu 16.04]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=Step-by-step_Installation_Guide_for_Ubuntu&diff=134777Step-by-step Installation Guide for Ubuntu2019-07-15T09:15:49Z<p>Wwycheuk: /* Why we prefer Ubuntu server over Ubuntu desktop */</p>
<hr />
<div>{{Installing Moodle}}<br />
{{Note|This document is about installing Moodle 3.6 in an Ubuntu 18.04 server with PHP 7.2.}}<br />
<br />
==Before you begin==<br />
It is a good idea to write down the passwords (and usernames) you will need to use for Ubuntu and Moodle:<br />
* The Ubuntu root password<br />
* The MySQL username and password that Moodle will use<br />
* The Moodle main admin username and password<br />
* An additional admin Moodle username and password<br />
<br />
== Step 1: Install Ubuntu ==<br />
<br />
===Why we prefer Ubuntu server over Ubuntu desktop===<br />
* Most IT professionals prefer to use a Command Line Interface (CLI) server, because it is safer and less prone to hacking.<br />
* Amateur users might find it easier to use a graphical (desktop) interface.<br />
* If you will only be using your Moodle server for local, experimental purposes, you might prefer to install the desktop (64 bits preferred) version of Ubuntu.<br />
* If you install a CLI only server and later regret it, you can easily add a graphical desktop:<br />
{{Note| Even though it is not recommended by most experts, you could install a Graphical User Interface (desktop) by issuing the command 'sudo tasksel' or 'sudo apt install ubuntu-desktop' to [https://help.ubuntu.com/community/ServerGUI install 'Ubuntu desktop']. BUT USE WITH CAUTION: The GUI may not appear as expected, and may prevent user from getting even the CLI. Try it at test machine first.}}<br />
<br />
===Why we prefer (or don't prefer) Ubuntu 18.04 over Ubuntu 16.04 over Ubuntu 14.04===<br />
* All three are LTS (Long Term Service) releases. <b>amd64 edition preferred.</b> <b>http://www.ubuntu.com/download</b><br />
* Ubuntu Server 18.04 has all the required packages (comes default with Apache2, [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7.2], MySQL 5.7). Ubuntu Server 18.04 has some minor differences from 16.04 and 14.04, mainly PHP. This document has been updated to reflect those changes.<br />
* Moodle 3.0.1 onwards can use [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7.0]. Moodle 3.6 requries PHP 7.0.<br />
* But beware that if you are using external authentication or enrollment plug-ins, please note that at the moment of Moodle 3.0.1 release (December 2015) neither MSSQL nor SQLSRV are available under php7. So, [https://docs.moodle.org/dev/Moodle_and_PHP7#Can_I_use_PHP7_yet.3F anybody using SQL*Server as primary database or remote auth/enrol plugin should not move to PHP 7] at all ! Also, depending of your configuration, some extensions (memcached [https://docs.moodle.org/dev/Moodle_and_PHP7#Manually_installing_Memcached can be installed], redis, mongodb, xmlrpc...) maybe missing or work in progress for your distribution, triple check the exact availability for your OS.<br />
<br />
===Procedure===<br />
*Ubuntu has a well known issue with its automatic updates filling up the /boot directory until automated updates start to fail and automated removal of old kernel files from /boot is impossible. Because of this you should consider installing Ubuntu with a /boot directory of around 5Gb and putting some automated clean up in place. More info can be found here - [https://help.ubuntu.com/community/RemoveOldKernels]<br />
<br />
*You can use either VI (lightweight editor) or VIM (heavyweight editor), however, if you wish to use VIM you will need to install it<br />
<pre>sudo apt-get install vim</pre><br />
<br />
*VI or VIM Commands<br /><br />
To edit a file press "Insert" Key<br /><br />
To finish editing press "Esc" Key<br /><br />
To write the file press ":w"<br /><br />
To Exit the editor press ":q"<br /><br />
You can also write and quit ":wq"<br />
<br />
*In Ubuntu, the standard user, the account you created during the install, does not have rights to install/write to many of the directories. In the below tutorial we will be using the term "sudo" which stands for "super user do" before most of the commands.<br />
<br />
== Step 2: Install Apache/MySQL/PHP ==<br />
{{Note| Moodle 3.0.1 [https://docs.moodle.org/dev/Moodle_3.0.1_release_notes introduced support for PHP 7.0 and we will be using PHP 7.2 in this tutorial]}}<br />
Open up Terminal and install the following;<br />
<br />
<pre>sudo apt install apache2 mysql-client mysql-server php libapache2-mod-php</pre> <br />
<br />
'''Run 'sudo mysql_secure_installation' to set the root password for mysql - please, please my dear friends, WRITE IT DOWN and spare yourself some grief, you will need it in step 6.'''<br />
<br />
== Step 3: Install Additional Software ==<br />
<br />
<pre>sudo apt install graphviz aspell ghostscript clamav php7.2-pspell php7.2-curl php7.2-gd php7.2-intl php7.2-mysql php7.2-xml php7.2-xmlrpc php7.2-ldap php7.2-zip php7.2-soap php7.2-mbstring</pre><br />
<br />
Restart Apache so that the modules are loaded correctly<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
We will be using [[Git]] to install/update the Moodle Core Application<br />
<br />
<pre>sudo apt install git</pre><br />
<br />
== Step 4: Download Moodle ==<br />
<br />
Setup your local repository and download Moodle, We will use /opt for this installation.<br />
<br />
*[[Git]] is what is called a "version control system". By using [[Git|git]] it will much easier down the road to update the moodle core application. Within Step 5 there is a little more detail on why we put the moodle core application code in the /opt directory. <br />
<br />
<pre>cd /opt</pre><br />
<br />
Download the Moodle Code and Index<br />
<br />
<pre>sudo git clone git://git.moodle.org/moodle.git</pre><br />
<br />
Change directory into the downloaded Moodle folder<br />
<br />
<pre>cd moodle</pre><br /><br />
<br />
Retrieve a list of each branch available<br />
<br />
<pre>sudo git branch -a</pre><br />
<br />
Tell [[Git|git]] which branch to track or use<br />
<br />
<pre>sudo git branch --track MOODLE_36_STABLE origin/MOODLE_36_STABLE</pre><br />
<br />
Finally, Check out the Moodle version specified<br />
<br />
<pre>sudo git checkout MOODLE_36_STABLE</pre><br />
<br />
== Step 5: Copy local repository to /var/www/html/ ==<br />
<br />
<pre>sudo cp -R /opt/moodle /var/www/html/</pre><br /><br />
<pre>sudo mkdir /var/moodledata</pre><br /><br />
<pre>sudo chown -R www-data /var/moodledata</pre><br /><br />
<pre>sudo chmod -R 777 /var/moodledata</pre><br /><br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br /><br />
* Explanation:<br />
<br /><br />
Since we setup a local repository in the previous step, you will copy it to your webroot after any updates and making changes. Having your local repository outside of the webroot, like we have in /opt, you will be able to prepare and stage your upgrades in a more efficient manner. For example, you want to make some changes or add some plug-ins, you would download the plugin and copy it to your local moodle repository. After you have added the plug-in and any other changes you might have made you will need to edit the file located in /opt/moodle/.git/info/exclude. Within that file you want to tell [[Git|git]] which files/folders to exclude when it pulls down the updates when you run your next "sudo git pull". An example entry would be the certificate mod located in /opt/moodle/mod/certificate so within the exclude file you want to add "/mod/certificate" below the last comments. You would add additional entries, 1 per line, for each plug-in or file you might have changed. If I were to change the favicon.ico file you would just add "favicon.ico" to the exclude file. Now when you run "sudo git pull" to update moodle to the latest version it will ignore those files and directories and just update the core moodle code. Before copying to your webroot to upgrade you want to make sure and download and copy over the latest versions of the plug-ins you might have added.<br />
<br />
== Step 6: Setup MySQL Server ==<br />
<br />
First we need to change the default storage engine to innodb and change the default file format to Barracuda, this is a new setting compared to previous versions. You also need to set innodb_file_per_table in order for Barracuda to work properly. Ref: https://dev.mysql.com/doc/refman/5.6/en/innodb-compression-usage.html<br />
<br />
*You should not need to make innodb the default storage engine anymore, the latest version of Moodle will select it automatically during install. It is always a good idea to make it default anyway. You do however need to set the default file format!<br />
<br />
*If you chose to use VIM instead please substitute vi for vim<br />
<br />
<pre>sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement. if you want to add you have to press the "insert" button on your keyboard. this is usually above the "delete" button. this allows you to add some text.<br />
<br />
<pre>default_storage_engine = innodb</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_file_format = Barracuda</pre><br />
<br />
In order to save my.cnf using the editor, press the Esc (Escape) key, type the following in sequence which will save :w then close the editor :q<br />
<br />
<pre>:w</pre><br /><br />
<pre>:q</pre><br />
<br />
Restart MySQL Server for changes to take affect<br />
<br />
<pre>sudo service mysql restart</pre><br />
<br />
Now we need to create the Moodle database and the Moodle MySQL User with the correct permissions<br />
<br />
Use the password you created in step 1<br />
<pre>sudo mysql -u root -p</pre><br /><br />
mysql><pre>CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;</pre><br />
<br />
{{Note| Use 'utf8mb4' for full range (4-byte) support of UTF-8, including Emoji ('utf8' only supports 3-byte). You will be compliant by Moodle admin page if you don't use 'utf8mb4' here.}}<br />
<br />
Where it says "moodledude" and "passwordformoodledude" you should change to the username and password of your choosing.<br />
mysql><pre>create user 'moodledude'@'localhost' IDENTIFIED BY 'passwordformoodledude';</pre><br /><br />
mysql><pre>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodledude@localhost IDENTIFIED BY 'passwordformoodledude';</pre><br /><br />
mysql><pre>quit;</pre><br />
<br />
Note - If you are using MySQL 5.6+ and when you issue the create user and get an error about the password hash you need to adjust the password to use the hash value<br />
<br />
You can get this by following the below<br />
<br />
mysql><pre>SELECT password('passwordformoodledude');</pre><br /><br />
<br />
This will print the hash of the password like *AD51BAFB2GD003D3480BCED0DH81AB0BG1712535, you will want to use this in the IDENTIFIED BY ' part<br />
<br />
== Step 7: Complete Setup ==<br />
<br />
*Note - If you are not comfortable using terminal to create the config.php file that needs to be created when going through the installer, you should temporarily make the webroot writable by doing the following:<br />
<br />
<pre>sudo chmod -R 777 /var/www/html/moodle</pre><br />
<br />
After you have ran the installer and you have moodle setup, you NEED to revert permissions so that it is no longer writable using the below command.<br />
<br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br />
Open your browser and go to http://IP.ADDRESS.OF.SERVER/moodle <br />
<br />
Follow the prompts:<br />
<br />
===Change the path for moodledata===<br />
<br />
/var/moodledata<br />
<br />
===Database Type===<br />
<br />
Choose: mysqli<br />
<br />
=== Database Settings ===<br />
<br />
Host server: localhost<br />
<br />
Database: moodle<br />
<br />
User: moodledude (the user you created when setting up the database)<br />
<br />
Password: passwordformoodledude (the password for the user you created)<br />
<br />
Tables Prefix: mdl_<br />
<br />
=== Environment Checks ===<br />
<br />
This will indicate if any elements required to run moodle haven't been installed.<br />
<br />
=== Next next next... ===<br />
follow prompts and confirm installation<br />
<br />
===Create a Site Administrator Account ===<br />
Create your moodle user account which will have site administrator permissions.<br />
<br />
The password you select has to meet certain security requirements.<br />
<br />
===Installation Complete ===<br />
Congrats! You can now start using Moodle!<br />
<br />
===Don't Forget===<br />
If you made the webroot writable, revert permissions<br />
<br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br />
== System Paths After Install==<br />
After installing Moodle you should set the system paths, this will provide better performance VS not setting them. Each entry in Moodle will have it's explanation.<br />
<br />
Navigate, on the moodle webpage, to Site Administration > Server > System Paths<br />
<br />
Input the following;<br />
<br />
Path to du: /usr/bin/du<br />
<br />
Path to apsell: /usr/bin/aspell<br />
<br />
Path to dot: /usr/bin/dot<br />
<br />
Save Changes<br />
<br />
<br />
*Optional if you do not already have an AntiVirus Solution<br />
<br />
We also installed ClamAV in Step 3 so we need to set the path in Moodle<br />
<br />
1st Create the Quarantine Directory<br />
<pre>sudo mkdir /var/quarantine</pre><br />
Change Ownership<br />
<pre>sudo chown -R www-data /var/quarantine</pre><br />
<br />
Navigate to Site Administration > Plugins > Antivirus plugins > Manage antivirus plugins<br />
<br />
Enable ClamAV antivirus<br />
<br />
Click on Settings<br />
<br />
Set the proper settings<br />
<br />
Save changes<br />
<br />
In previous Moodle branches: <br />
Check "Use ClamAV on uploaded files"<br />
ClamAV Path : /usr/bin/clamscan<br />
Quarantine Directory : /var/quarantine<br />
<br />
Save Changes<br />
<br />
== Suggestions: Enable Zend OpCache/Change Document Root==<br />
<br />
*Since we have installed Ubuntu Server 14.04LTS, we can use the built-in PHP OPcache, https://docs.moodle.org/26/en/OPcache<br />
<br />
Within the link above, https://docs.moodle.org/26/en/OPcache add the recommended settings to your 05-opcache.ini file. Again, substitute vi with vim and remember to use the correct key squences from the introduction.<br />
<br />
<pre>sudo vi /etc/php5/apache2/conf.d/05-opcache.ini</pre><br />
<br />
NOTE: In Ubuntu 16.04 opcache.ini is located in:<br />
<br />
<pre>/etc/php/7.0/mods-available/opcache.ini</pre><br />
<br />
Restart Apache for changes to take affect.<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
That's it for the Zend OpCache!<br />
<br />
You can also install a GUI to view the status of your Zend OpCache, not recommended on production servers.<br />
<br />
<pre>cd /var/www/html/moodle/</pre><br />
<br />
Download the PHP Script to your Moodle directory, you should also add this file to /opt/moodle/.git/info/exclude file so it does not get removed when upgrading your installation.<br />
<br />
<pre>sudo wget https://github.com/rlerdorf/opcache-status/blob/master/opcache.php</pre><br />
<br />
Visit http://ip.address.of.server/moodle/opcache.php<br />
<br />
If you do not want your end users to type http://yourserver/moodle and just want them to navigate to http://youserver you will need to edit the site configuration for Apache which will tell Apache to use the /var/www/html/moodle as the root directory and not /var/www/html<br />
<br />
Open up the Apache sites config and change the document root<br />
<br />
<pre>sudo vi /etc/apache2/sites-available/000-default.conf</pre><br />
<br />
On the line where DocumentRoot is;<br />
<br />
<br>Change From: DocumentRoot /var/www/html<br><br />
<br>Change To: DocumentRoot /var/www/html/moodle<br><br />
<br />
<pre>:w</pre><br />
<pre>:q</pre><br />
<br />
Restart Apache for changes to take affect.<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
Important note!<br />
<br />
If you have already installed Moodle then you should make the below changes.<br />
<br />
== Editing config.php for moodle ==<br />
<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the Internet, you will have to change this setting:<br />
<br />
For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php).<br />
If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see masquerading.<br />
<br />
<br />
Edit config.php for Moodle<br />
<br />
cd /var/www/html/moodle<br />
sudo vim config.php<br />
<br />
Hit the "insert" button on your keyboard, make then changes you need to make. Then press "escape" and type the following in to quit and to save changes (excluding quotation marks): ":wq"<br />
<br />
Under $CFG->wwwroot change to http://ip.address.of.server instead of http://ip.address.of.server/moodle<br />
<br />
<br />
==Hosting several Moodle branches in one Ubuntu server==<br />
* This is very useful for the language pack maintainers to test translations in several Moodle branches.<br />
* It is also very useful for developers to test their plugins in different Moodle branches.<br />
* Just create a folder for each instance inside the web folder and that would be enough. <br />
* To access the sites you only need to add the folder to localhost URL: http://localhost/moodle31<br />
* You can have an instance for each version from 1.9 to 3.1 <br />
<br />
* You do need a separate data folder for each instance and a separate database (You can use phpmyadmin to set your database, but that's not necessary), add each instance in its own folder, and carry on as above. You can also host another service (eg, Mahara) in it's separate folder.<br />
<br />
===Example 1===<br />
*So, one example folder tree on one Linux laptop (an actual server would be more) may look something like:<br />
<br />
var<br />
--www<br />
----maharadata<br />
----moodlecleandata<br />
----moodlestabledata<br />
----moodlemasterdata<br />
----moodletestingdata<br />
----uswmoodledata<br />
----html<br />
------mahara<br />
------moodleclean<br />
------moodlestable<br />
------moodlemaster<br />
------moodletesting<br />
------uswmoodle<br />
<br />
===Example 2===<br />
* Have several sandboxed Moodles on a single (CentOS X) server all of different versions .. only the ones that are supported for security fixes and above - 2.7,2.8,2.9,3.0, and now a 3.1. Pretty much 'stock' Moodles with only occasional addons, etc. for testing.<br />
* All have their separate code and data directories as well as their separate DB's.<br />
<br />
* Hint: install and maintain them all with [[Git_for_Administrators|git]] ... even if you don't prefer/like command line, that is by far the most efficient way to update and/or upgrade a site.<br />
<br />
/var/www/html/moodle27/version.php:$release = '2.7.14 (Build: 20160509)'<br />
/var/www/html/moodle28/version.php:$release = '2.8.12 (Build: 20160509)'<br />
/var/www/html/moodle29/version.php:$release = '2.9.6+ (Build: 20160520)'<br />
/var/www/html/moodle30/version.php:$release = '3.0.4+ (Build: 20160603)'<br />
/var/www/html/moodle31/version.php:$release = '3.1+ (Build: 20160603)'<br />
<br />
* The git -b command locks a site into the version provided with the rest of the git command ... for example, installing the 3.1, which is a long term support version, installed with git -b option. Don't plan on upgrading nor testing upgrades with that one.<br />
<br />
git clone -b MOODLE_31_STABLE git://git.moodle.org/moodle.git moodle31<br />
<br />
* All the other moodles I have on that server have been installed via git <br />
<br />
git clone git://git.moodle.org/moodle.git [nameofdir]<br />
<br />
* then from nameofdir<br />
<br />
git branch --track MOODLE_2#_STABLE origin/MOODLE_2#_STABLE<br />
git checkout MOODLE_2#_STABLE<br />
<br />
* 2# is the version number.<br />
<br />
* That allows one to march that moodle upwards ... higher branch(es). So one can test an upgrade (as opposed to an 'update').<br />
<br />
* This second method 'gits' more code and backups will range in the 5+ Meg range due to all the older version git stuff The 3.1 much less (restricted to 3.1 branch):<br />
<br />
* 545M ./moodle296-code-20160604145012.tar<br />
<br />
* 193M ./moodle31+-code-2016060883737.tar<br />
<br />
<br />
[[es:Guia de instalacion paso-a-paso para Ubuntu 16.04]]</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=134748RedHat Linux installation2019-07-11T07:02:59Z<p>Wwycheuk: /* Download Moodle */</p>
<hr />
<div>Note : These instructions apply to RedHat version 8. They have also been found to work for RedHat 9.0 and for Fedora Core 1 and 2. '''Fedora Core 3 requires the php-gd package in addition to php.''' I see no reason why they should not work for later versions. In addition, later distributions of Fedora (after 7) contain a moodle yum package. Installation is as easy as '''yum install moodle'''.<br />
<br />
Redhat installation considerations: There are many installation options available when installing Redhat. I assume that you are installing on a server and will have selected a Server type install. There is however no reason why this should not work on a desktop or Workstation installation.<br />
<br />
== Make sure you have installed the following packages ==<br />
(You will need to select the option to customize the default set of packages on installation OR bring up the package manager by putting disk 1 back in the drive for an existing system):<br />
<br />
* X Windows System (not vital but easier)<br />
* Gnome or KDE desktop environment (as above)<br />
* Server Configuration Tools<br />
* Web Server<br />
** Click "Details" and make sure all PHP modules are ticked (except ODBC and PGSQL, they're not neccesary)<br />
** make sure not to miss the MYSQL-PHP module (not installed by default)<br />
* SQL Database<br />
** Click "Details" and tick MySQL server box<br />
* Also make sure you set up the firewall. You probably only need to enable HTTP (and perhaps FTP and SSH) access to your server machine, unless you know different.<br />
<br />
If you want a minimal system, startging with RHEL6 (and clones) there is the possiblity of installing a minimal system.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== A word about SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to enforcing. If you are not used to SELinux and setting permissions it's (maybe less secure but) often easier to lower the SELinux level to permissive, see the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== A word about the PHP packages in RHEL ==<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Download Moodle==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file. See [https://docs.moodle.org/37/en/Git_for_Administrators Git_for_Administrators] for details.<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file.<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
== Unpack and set file permission etc ==<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
== Setup config.php ==<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mysqli"<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Setup MySQL ==<br />
<br />
* First you need to get the MySQL daemon running, it is not running by default.<br />
** On the Desktop find and launch "Services" (on KDE and Gnome it's under System Settings=>Server Settings=>Services, but you might have to hunt around).<br />
** Tick the box for MySQL and (with it selected) press the Start icon - ensure it starts up<br />
** Choose "Save Changes" from the menu, and exit the program.<br />
* If you haven't yet, as root, change the MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** (the name 'mymoodle' is the same name as the database from Step 4)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' are from Step 4)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Apache ==<br />
<br />
* Edit the Apache configuration file at /etc/httpd/conf/httpd.conf<br />
* Right at the end of the file add the following lines: (once again 'mymoodle' as from Step 3)<br />
** <Directory "/usr/moodle/mymoodle"><br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Reference ==<br />
Please also see these discussion for GD:</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=134735RedHat Linux installation2019-07-10T08:27:09Z<p>Wwycheuk: /* Setup MySQL */</p>
<hr />
<div>Note : These instructions apply to RedHat version 8. They have also been found to work for RedHat 9.0 and for Fedora Core 1 and 2. '''Fedora Core 3 requires the php-gd package in addition to php.''' I see no reason why they should not work for later versions. In addition, later distributions of Fedora (after 7) contain a moodle yum package. Installation is as easy as '''yum install moodle'''.<br />
<br />
Redhat installation considerations: There are many installation options available when installing Redhat. I assume that you are installing on a server and will have selected a Server type install. There is however no reason why this should not work on a desktop or Workstation installation.<br />
<br />
== Make sure you have installed the following packages ==<br />
(You will need to select the option to customize the default set of packages on installation OR bring up the package manager by putting disk 1 back in the drive for an existing system):<br />
<br />
* X Windows System (not vital but easier)<br />
* Gnome or KDE desktop environment (as above)<br />
* Server Configuration Tools<br />
* Web Server<br />
** Click "Details" and make sure all PHP modules are ticked (except ODBC and PGSQL, they're not neccesary)<br />
** make sure not to miss the MYSQL-PHP module (not installed by default)<br />
* SQL Database<br />
** Click "Details" and tick MySQL server box<br />
* Also make sure you set up the firewall. You probably only need to enable HTTP (and perhaps FTP and SSH) access to your server machine, unless you know different.<br />
<br />
If you want a minimal system, startging with RHEL6 (and clones) there is the possiblity of installing a minimal system.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== A word about SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to enforcing. If you are not used to SELinux and setting permissions it's (maybe less secure but) often easier to lower the SELinux level to permissive, see the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== A word about the PHP packages in RHEL ==<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Download Moodle==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file..<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file..<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
== Unpack and set file permission etc ==<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
== Setup config.php ==<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mysqli"<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Setup MySQL ==<br />
<br />
* First you need to get the MySQL daemon running, it is not running by default.<br />
** On the Desktop find and launch "Services" (on KDE and Gnome it's under System Settings=>Server Settings=>Services, but you might have to hunt around).<br />
** Tick the box for MySQL and (with it selected) press the Start icon - ensure it starts up<br />
** Choose "Save Changes" from the menu, and exit the program.<br />
* If you haven't yet, as root, change the MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** (the name 'mymoodle' is the same name as the database from Step 4)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON mymoodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** (as above, 'mymoodle', 'moodleuser' and 'moodlepass' are from Step 4)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Apache ==<br />
<br />
* Edit the Apache configuration file at /etc/httpd/conf/httpd.conf<br />
* Right at the end of the file add the following lines: (once again 'mymoodle' as from Step 3)<br />
** <Directory "/usr/moodle/mymoodle"><br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Reference ==<br />
Please also see these discussion for GD:</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=RedHat_Linux_installation&diff=134733RedHat Linux installation2019-07-10T08:07:28Z<p>Wwycheuk: /* Download Moodle */</p>
<hr />
<div>Note : These instructions apply to RedHat version 8. They have also been found to work for RedHat 9.0 and for Fedora Core 1 and 2. '''Fedora Core 3 requires the php-gd package in addition to php.''' I see no reason why they should not work for later versions. In addition, later distributions of Fedora (after 7) contain a moodle yum package. Installation is as easy as '''yum install moodle'''.<br />
<br />
Redhat installation considerations: There are many installation options available when installing Redhat. I assume that you are installing on a server and will have selected a Server type install. There is however no reason why this should not work on a desktop or Workstation installation.<br />
<br />
== Make sure you have installed the following packages ==<br />
(You will need to select the option to customize the default set of packages on installation OR bring up the package manager by putting disk 1 back in the drive for an existing system):<br />
<br />
* X Windows System (not vital but easier)<br />
* Gnome or KDE desktop environment (as above)<br />
* Server Configuration Tools<br />
* Web Server<br />
** Click "Details" and make sure all PHP modules are ticked (except ODBC and PGSQL, they're not neccesary)<br />
** make sure not to miss the MYSQL-PHP module (not installed by default)<br />
* SQL Database<br />
** Click "Details" and tick MySQL server box<br />
* Also make sure you set up the firewall. You probably only need to enable HTTP (and perhaps FTP and SSH) access to your server machine, unless you know different.<br />
<br />
If you want a minimal system, startging with RHEL6 (and clones) there is the possiblity of installing a minimal system.<br />
<br />
== Configure hostname and domain name==<br />
<br />
Type system-config-network to open the GUI editor. Click on the DNS tab. In the "DNS Search Path" fill in your domain name for example myuniversity.edu. Now ensure the "Hostname" contains the computer name you will use and click activate to make changes<br />
<br />
== A word about SELinux ==<br />
Default RedHat Enterprise Linux comes with SELinux set to enforcing. If you are not used to SELinux and setting permissions it's (maybe less secure but) often easier to lower the SELinux level to permissive, see the CentOS [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Changing_SELinux_Modes.html]<br />
<br />
== A word about the PHP packages in RHEL ==<br />
RedHat EL - or 'the upstream vendor' if you are using a clone - will not introduce newer PHP packages unless there is an exception (php53 in EL5.6+). Moodle has quite a some PHP dependencies which cannot be fullfilled solely by installing all RHEL-provided packages.<br />
<br />
You have therefore to make a choice:<br />
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own<br />
* Install the whole (latest) PHP from source on your own (and maintain it)<br />
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):<br />
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)<br />
** RPMFusion and others also have newer PHP packages<br />
<br />
== Download Moodle==<br />
(I will install under /usr/moodle, data in /usr/moodle_data)<br />
<br />
* Download your favourite version of Moodle from moodle.org (.zip archive is easiest)<br />
* as Root create folder under /usr and copy zip<br />
** su<br />
** mkdir /usr/moodle<br />
** mkdir /usr/moodle_data<br />
** cp moodle_111.zip /usr/moodle<br />
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file..<br />
** cd /usr<br />
** git clone git://git.moodle.org/moodle.git<br />
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file..<br />
** cd /usr/moodle<br />
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login<br />
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle<br />
<br />
== Unpack and set file permission etc ==<br />
<br />
* Still as root we unpack moodle and rename to something appropiate (I have multiple moodle installs, hence this setup). I will call this install mymoodle.<br />
** cd /usr/moodle<br />
** unzip moodle_xxx.zip<br />
** mv moodle mymoodle<br />
*** (optional step - I have more than one install under /usr/moodle)<br />
** mkdir /usr/moodle_data/mymoodle<br />
*** (same name as the moodle install above)<br />
** chown -R apache:apache /usr/moodle<br />
*** (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)<br />
** chown -R apache:apache /usr/moodle_data<br />
<br />
== Setup config.php ==<br />
<br />
* Still as root copy and edit the config file, you should know the host/domain name for your server<br />
** cd /usr/moodle/mymoodle<br />
** cp config-dist.php config.php<br />
** vi config.php (or whatever your favourite editor is!)<br />
* Your config.php settings should be something like...<br />
** dbtype = "mysqli"<br />
** dbhost = "localhost"<br />
** dbname = "mymoodle"<br />
** dbuser = "moodleuser"<br />
** dbpass = "moodlepass" (<-- better make this something of your own)<br />
** prefix = ""<br />
*** (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)<br />
** wwwroot = "http://myhost.mydomain/mymoodle"<br />
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")<br />
** dirroot = '/usr/moodle/mymoodle'<br />
** dataroot = '/usr/moodle_data/mymoodle'<br />
* Save your changes and exit from the editor<br />
<br />
== Setup MySQL ==<br />
<br />
* First you need to get the MySQL daemon running, it is not running by default.<br />
** On the Desktop find and launch "Services" (on KDE and Gnome it's under System Settings=>Server Settings=>Services, but you might have to hunt around).<br />
** Tick the box for MySQL and (with it selected) press the Start icon - ensure it starts up<br />
** Choose "Save Changes" from the menu, and exit the program.<br />
* If you haven't yet, as root, change the MySQL root password<br />
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)<br />
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)<br />
* Launch MySQL as root<br />
** mysql -u root -p<br />
*** (at the password prompt, enter the password from above)<br />
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')<br />
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';<br />
*** (the name 'mymoodle' is the same name as the database from Step 4)<br />
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON mymoodle.*<br />
*** (as above, 'mymoodle' is from Step 4)<br />
** TO moodleuser@localhost IDENTIFIED BY 'moodlepass';<br />
*** ('moodleuser' and 'moodlepass' are from Step 4)<br />
** flush privileges;<br />
** quit<br />
* (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)<br />
<br />
== Setup Apache ==<br />
<br />
* Edit the Apache configuration file at /etc/httpd/conf/httpd.conf<br />
* Right at the end of the file add the following lines: (once again 'mymoodle' as from Step 3)<br />
** <Directory "/usr/moodle/mymoodle"><br />
** DirectoryIndex index.php<br />
** AcceptPathInfo on<br />
** AllowOverride None<br />
** Options None<br />
** Order allow,deny<br />
** Allow from all<br />
** </Directory><br />
** Alias /mymoodle "/usr/moodle/mymoodle"<br />
* Don't insert a space in "allow,deny" (common mistake!)<br />
* You might also want to run through the rest of the config file and make some other (obvious) changes - administrator email and suchlike. Not vital though.<br />
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.<br />
<br />
== Set up the cron job ==<br />
<br />
As root user edit the /etc/crontab file using vi (or another editor) OR you can add a line to the root user's "personal" crontab (don't do both!).<br />
<br />
* If you wish to place an entry in your root user's crontab use:<br />
** crontab -e<br />
** Add the following line:<br />
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
**** (change the URL as appropriate for your site)<br />
---<br />
* If you wish to add an entry in /etc/crontab:<br />
* Open the /etc/crontab file in an editor (vi).<br />
* Add the following line:<br />
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php<br />
*** (change the URL as appropriate for your site)<br />
---<br />
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')<br />
<br />
== Try your new installation ==<br />
<br />
http://myhost.mydomain/mymoodle/admin<br />
<br />
or, if you are running the browser on the same machine<br />
<br />
http://localhost/mymoodle/admin<br />
<br />
[[Category:Administrator]]<br />
[[Category:Installation]]<br />
[[pl:Instalacja_w_RedHat]]<br />
<br />
== Reference ==<br />
Please also see these discussion for GD:</div>Wwycheukhttps://docs.moodle.org/37/en/index.php?title=Step-by-step_Installation_Guide_for_Ubuntu&diff=134583Step-by-step Installation Guide for Ubuntu2019-06-25T03:31:57Z<p>Wwycheuk: /* Step 6: Setup MySQL Server */</p>
<hr />
<div>{{Installing Moodle}}<br />
{{Note|This document is about installing Moodle 3.6 in an Ubuntu 18.04 server with PHP 7.2.}}<br />
<br />
==Before you begin==<br />
It is a good idea to write down the passwords (and usernames) you will need to use for Ubuntu and Moodle:<br />
* The Ubuntu root password<br />
* The MySQL username and password that Moodle will use<br />
* The Moodle main admin username and password<br />
* An additional admin Moodle username and password<br />
<br />
== Step 1: Install Ubuntu ==<br />
<br />
===Why we prefer Ubuntu server over Ubuntu desktop===<br />
* Most IT professionals prefer to use a Command Line Interface (CLI) server, because it is safer and less prone to hacking.<br />
* Amateur users might find it easier to use a graphical (desktop) interface.<br />
* If you will only be using your Moodle server for local, experimental purposes, you might prefer to install the desktop (64 bits preferred) version of Ubuntu.<br />
* If you install a CLI only server and later regret it, you can easily add a graphical desktop:<br />
{{Note| Even though it is not recommended by most experts, you could install a Graphical User Interface (desktop) by issuing the command 'sudo apt install ubuntu-desktop' to [https://help.ubuntu.com/community/ServerGUI install 'Ubuntu desktop']. BUT USE WITH CAUTION: The GUI may not appear as expected, and may prevent user from getting even the CLI. Try it at test machine first.}}<br />
<br />
===Why we prefer (or don't prefer) Ubuntu 18.04 over Ubuntu 16.04 over Ubuntu 14.04===<br />
* All three are LTS (Long Term Service) releases. <b>amd64 edition preferred.</b> <b>http://www.ubuntu.com/download</b><br />
* Ubuntu Server 18.04 has all the required packages (comes default with Apache2, [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7.2], MySQL 5.7). Ubuntu Server 18.04 has some minor differences from 16.04 and 14.04, mainly PHP. This document has been updated to reflect those changes.<br />
* Moodle 3.0.1 onwards can use [https://docs.moodle.org/dev/Moodle_and_PHP7 PHP 7.0]. Moodle 3.6 requries PHP 7.0.<br />
* But beware that if you are using external authentication or enrollment plug-ins, please note that at the moment of Moodle 3.0.1 release (December 2015) neither MSSQL nor SQLSRV are available under php7. So, [https://docs.moodle.org/dev/Moodle_and_PHP7#Can_I_use_PHP7_yet.3F anybody using SQL*Server as primary database or remote auth/enrol plugin should not move to PHP 7] at all ! Also, depending of your configuration, some extensions (memcached [https://docs.moodle.org/dev/Moodle_and_PHP7#Manually_installing_Memcached can be installed], redis, mongodb, xmlrpc...) maybe missing or work in progress for your distribution, triple check the exact availability for your OS.<br />
<br />
===Procedure===<br />
*Ubuntu has a well known issue with its automatic updates filling up the /boot directory until automated updates start to fail and automated removal of old kernel files from /boot is impossible. Because of this you should consider installing Ubuntu with a /boot directory of around 5Gb and putting some automated clean up in place. More info can be found here - [https://help.ubuntu.com/community/RemoveOldKernels]<br />
<br />
*You can use either VI (lightweight editor) or VIM (heavyweight editor), however, if you wish to use VIM you will need to install it<br />
<pre>sudo apt-get install vim</pre><br />
<br />
*VI or VIM Commands<br /><br />
To edit a file press "Insert" Key<br /><br />
To finish editing press "Esc" Key<br /><br />
To write the file press ":w"<br /><br />
To Exit the editor press ":q"<br /><br />
You can also write and quit ":wq"<br />
<br />
*In Ubuntu, the standard user, the account you created during the install, does not have rights to install/write to many of the directories. In the below tutorial we will be using the term "sudo" which stands for "super user do" before most of the commands.<br />
<br />
== Step 2: Install Apache/MySQL/PHP ==<br />
{{Note| Moodle 3.0.1 [https://docs.moodle.org/dev/Moodle_3.0.1_release_notes introduced support for PHP 7.0 and we will be using PHP 7.2 in this tutorial]}}<br />
Open up Terminal and install the following;<br />
<br />
<pre>sudo apt install apache2 mysql-client mysql-server php libapache2-mod-php</pre> <br />
<br />
'''Run 'sudo mysql_secure_installation' to set the root password for mysql - please, please my dear friends, WRITE IT DOWN and spare yourself some grief, you will need it in step 6.'''<br />
<br />
== Step 3: Install Additional Software ==<br />
<br />
<pre>sudo apt install graphviz aspell ghostscript clamav php7.2-pspell php7.2-curl php7.2-gd php7.2-intl php7.2-mysql php7.2-xml php7.2-xmlrpc php7.2-ldap php7.2-zip php7.2-soap php7.2-mbstring</pre><br />
<br />
Restart Apache so that the modules are loaded correctly<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
We will be using [[Git]] to install/update the Moodle Core Application<br />
<br />
<pre>sudo apt install git</pre><br />
<br />
== Step 4: Download Moodle ==<br />
<br />
Setup your local repository and download Moodle, We will use /opt for this installation.<br />
<br />
*[[Git]] is what is called a "version control system". By using [[Git|git]] it will much easier down the road to update the moodle core application. Within Step 5 there is a little more detail on why we put the moodle core application code in the /opt directory. <br />
<br />
<pre>cd /opt</pre><br />
<br />
Download the Moodle Code and Index<br />
<br />
<pre>sudo git clone git://git.moodle.org/moodle.git</pre><br />
<br />
Change directory into the downloaded Moodle folder<br />
<br />
<pre>cd moodle</pre><br /><br />
<br />
Retrieve a list of each branch available<br />
<br />
<pre>sudo git branch -a</pre><br />
<br />
Tell [[Git|git]] which branch to track or use<br />
<br />
<pre>sudo git branch --track MOODLE_36_STABLE origin/MOODLE_36_STABLE</pre><br />
<br />
Finally, Check out the Moodle version specified<br />
<br />
<pre>sudo git checkout MOODLE_36_STABLE</pre><br />
<br />
== Step 5: Copy local repository to /var/www/html/ ==<br />
<br />
<pre>sudo cp -R /opt/moodle /var/www/html/</pre><br /><br />
<pre>sudo mkdir /var/moodledata</pre><br /><br />
<pre>sudo chown -R www-data /var/moodledata</pre><br /><br />
<pre>sudo chmod -R 777 /var/moodledata</pre><br /><br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br /><br />
* Explanation:<br />
<br /><br />
Since we setup a local repository in the previous step, you will copy it to your webroot after any updates and making changes. Having your local repository outside of the webroot, like we have in /opt, you will be able to prepare and stage your upgrades in a more efficient manner. For example, you want to make some changes or add some plug-ins, you would download the plugin and copy it to your local moodle repository. After you have added the plug-in and any other changes you might have made you will need to edit the file located in /opt/moodle/.git/info/exclude. Within that file you want to tell [[Git|git]] which files/folders to exclude when it pulls down the updates when you run your next "sudo git pull". An example entry would be the certificate mod located in /opt/moodle/mod/certificate so within the exclude file you want to add "/mod/certificate" below the last comments. You would add additional entries, 1 per line, for each plug-in or file you might have changed. If I were to change the favicon.ico file you would just add "favicon.ico" to the exclude file. Now when you run "sudo git pull" to update moodle to the latest version it will ignore those files and directories and just update the core moodle code. Before copying to your webroot to upgrade you want to make sure and download and copy over the latest versions of the plug-ins you might have added.<br />
<br />
== Step 6: Setup MySQL Server ==<br />
<br />
First we need to change the default storage engine to innodb and change the default file format to Barracuda, this is a new setting compared to previous versions. You also need to set innodb_file_per_table in order for Barracuda to work properly. Ref: https://dev.mysql.com/doc/refman/5.6/en/innodb-compression-usage.html<br />
<br />
*You should not need to make innodb the default storage engine anymore, the latest version of Moodle will select it automatically during install. It is always a good idea to make it default anyway. You do however need to set the default file format!<br />
<br />
*If you chose to use VIM instead please substitute vi for vim<br />
<br />
<pre>sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf</pre><br />
<br />
Scroll down to the [mysqld] section and under Basic Settings add the following line under the last statement. if you want to add you have to press the "insert" button on your keyboard. this is usually above the "delete" button. this allows you to add some text.<br />
<br />
<pre>default_storage_engine = innodb</pre><br /><br />
<pre>innodb_file_per_table = 1</pre><br /><br />
<pre>innodb_file_format = Barracuda</pre><br />
<br />
In order to save my.cnf using the editor, press the Esc (Escape) key, type the following in sequence which will save :w then close the editor :q<br />
<br />
<pre>:w</pre><br /><br />
<pre>:q</pre><br />
<br />
Restart MySQL Server for changes to take affect<br />
<br />
<pre>sudo service mysql restart</pre><br />
<br />
Now we need to create the Moodle database and the Moodle MySQL User with the correct permissions<br />
<br />
Use the password you created in step 1<br />
<pre>sudo mysql -u root -p</pre><br /><br />
mysql><pre>CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;</pre><br />
<br />
{{Note| Use 'utf8mb4' for full range (4-byte) support of UTF-8, including Emoji ('utf8' only supports 3-byte). You will be compliant by Moodle admin page if you don't use 'utf8mb4' here.}}<br />
<br />
Where it says "moodledude" and "passwordformoodledude" you should change to the username and password of your choosing.<br />
mysql><pre>create user 'moodledude'@'localhost' IDENTIFIED BY 'passwordformoodledude';</pre><br /><br />
mysql><pre>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodledude@localhost IDENTIFIED BY 'passwordformoodledude';</pre><br /><br />
mysql><pre>quit;</pre><br />
<br />
Note - If you are using MySQL 5.6+ and when you issue the create user and get an error about the password hash you need to adjust the password to use the hash value<br />
<br />
You can get this by following the below<br />
<br />
mysql><pre>SELECT password('passwordformoodledude');</pre><br /><br />
<br />
This will print the hash of the password like *AD51BAFB2GD003D3480BCED0DH81AB0BG1712535, you will want to use this in the IDENTIFIED BY ' part<br />
<br />
== Step 7: Complete Setup ==<br />
<br />
*Note - If you are not comfortable using terminal to create the config.php file that needs to be created when going through the installer, you should temporarily make the webroot writable by doing the following:<br />
<br />
<pre>sudo chmod -R 777 /var/www/html/moodle</pre><br />
<br />
After you have ran the installer and you have moodle setup, you NEED to revert permissions so that it is no longer writable using the below command.<br />
<br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br />
Open your browser and go to http://IP.ADDRESS.OF.SERVER/moodle <br />
<br />
Follow the prompts:<br />
<br />
===Change the path for moodledata===<br />
<br />
/var/moodledata<br />
<br />
===Database Type===<br />
<br />
Choose: mysqli<br />
<br />
=== Database Settings ===<br />
<br />
Host server: localhost<br />
<br />
Database: moodle<br />
<br />
User: moodledude (the user you created when setting up the database)<br />
<br />
Password: passwordformoodledude (the password for the user you created)<br />
<br />
Tables Prefix: mdl_<br />
<br />
=== Environment Checks ===<br />
<br />
This will indicate if any elements required to run moodle haven't been installed.<br />
<br />
=== Next next next... ===<br />
follow prompts and confirm installation<br />
<br />
===Create a Site Administrator Account ===<br />
Create your moodle user account which will have site administrator permissions.<br />
<br />
The password you select has to meet certain security requirements.<br />
<br />
===Installation Complete ===<br />
Congrats! You can now start using Moodle!<br />
<br />
===Don't Forget===<br />
If you made the webroot writable, revert permissions<br />
<br />
<pre>sudo chmod -R 0755 /var/www/html/moodle</pre><br />
<br />
== System Paths After Install==<br />
After installing Moodle you should set the system paths, this will provide better performance VS not setting them. Each entry in Moodle will have it's explanation.<br />
<br />
Navigate, on the moodle webpage, to Site Administration > Server > System Paths<br />
<br />
Input the following;<br />
<br />
Path to du: /usr/bin/du<br />
<br />
Path to apsell: /usr/bin/aspell<br />
<br />
Path to dot: /usr/bin/dot<br />
<br />
Save Changes<br />
<br />
<br />
*Optional if you do not already have an AntiVirus Solution<br />
<br />
We also installed ClamAV in Step 3 so we need to set the path in Moodle<br />
<br />
1st Create the Quarantine Directory<br />
<pre>sudo mkdir /var/quarantine</pre><br />
Change Ownership<br />
<pre>sudo chown -R www-data /var/quarantine</pre><br />
<br />
Navigate to Site Administration > Plugins > Antivirus plugins > Manage antivirus plugins<br />
<br />
Enable ClamAV antivirus<br />
<br />
Click on Settings<br />
<br />
Set the proper settings<br />
<br />
Save changes<br />
<br />
In previous Moodle branches: <br />
Check "Use ClamAV on uploaded files"<br />
ClamAV Path : /usr/bin/clamscan<br />
Quarantine Directory : /var/quarantine<br />
<br />
Save Changes<br />
<br />
== Suggestions: Enable Zend OpCache/Change Document Root==<br />
<br />
*Since we have installed Ubuntu Server 14.04LTS, we can use the built-in PHP OPcache, https://docs.moodle.org/26/en/OPcache<br />
<br />
Within the link above, https://docs.moodle.org/26/en/OPcache add the recommended settings to your 05-opcache.ini file. Again, substitute vi with vim and remember to use the correct key squences from the introduction.<br />
<br />
<pre>sudo vi /etc/php5/apache2/conf.d/05-opcache.ini</pre><br />
<br />
NOTE: In Ubuntu 16.04 opcache.ini is located in:<br />
<br />
<pre>/etc/php/7.0/mods-available/opcache.ini</pre><br />
<br />
Restart Apache for changes to take affect.<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
That's it for the Zend OpCache!<br />
<br />
You can also install a GUI to view the status of your Zend OpCache, not recommended on production servers.<br />
<br />
<pre>cd /var/www/html/moodle/</pre><br />
<br />
Download the PHP Script to your Moodle directory, you should also add this file to /opt/moodle/.git/info/exclude file so it does not get removed when upgrading your installation.<br />
<br />
<pre>sudo wget https://github.com/rlerdorf/opcache-status/blob/master/opcache.php</pre><br />
<br />
Visit http://ip.address.of.server/moodle/opcache.php<br />
<br />
If you do not want your end users to type http://yourserver/moodle and just want them to navigate to http://youserver you will need to edit the site configuration for Apache which will tell Apache to use the /var/www/html/moodle as the root directory and not /var/www/html<br />
<br />
Open up the Apache sites config and change the document root<br />
<br />
<pre>sudo vi /etc/apache2/sites-available/000-default.conf</pre><br />
<br />
On the line where DocumentRoot is;<br />
<br />
<br>Change From: DocumentRoot /var/www/html<br><br />
<br>Change To: DocumentRoot /var/www/html/moodle<br><br />
<br />
<pre>:w</pre><br />
<pre>:q</pre><br />
<br />
Restart Apache for changes to take affect.<br />
<br />
<pre>sudo service apache2 restart</pre><br />
<br />
Important note!<br />
<br />
If you have already installed Moodle then you should make the below changes.<br />
<br />
== Editing config.php for moodle ==<br />
<br />
In the installation instructions, one of the suggested settings for 'webroot' is 'localhost'. This is fine if all you want to do is some local testing of your new Moodle installation. If, however, you want to view your new installation from another machine on the same local area network, or view your site on the Internet, you will have to change this setting:<br />
<br />
For local testing, 'localhost' is fine for the webroot ($CFG->wwwroot in config.php).<br />
If you want to test your site from other machines on the same local area network (LAN), then you will have to use the private ip address of the serving machine, (e.g. 192.168.1.2/moodle) or the network name of the serving computer (e.g. network_name_of_serving_machine/moodle) as the web root. Depending on your LAN setup, it may be better to use the network name of the computer rather than its (private) ip address, because the ip address can and will change from time to time. If you don't want to use the network name, then you will have to speak to your network administrator and have them assign a permanent ip address to the serving machine.<br />
Finally, if you want to test your new installation across the internet, you will have to use either a domain name or a permanent (public) ip address/moodle as your web root. To handle both types of access, see masquerading.<br />
<br />
<br />
Edit config.php for Moodle<br />
<br />
cd /var/www/html/moodle<br />
sudo vim config.php<br />
<br />
Hit the "insert" button on your keyboard, make then changes you need to make. Then press "escape" and type the following in to quit and to save changes (excluding quotation marks): ":wq"<br />
<br />
Under $CFG->wwwroot change to http://ip.address.of.server instead of http://ip.address.of.server/moodle<br />
<br />
<br />
==Hosting several Moodle branches in one Ubuntu server==<br />
* This is very useful for the language pack maintainers to test translations in several Moodle branches.<br />
* It is also very useful for developers to test their plugins in different Moodle branches.<br />
* Just create a folder for each instance inside the web folder and that would be enough. <br />
* To access the sites you only need to add the folder to localhost URL: http://localhost/moodle31<br />
* You can have an instance for each version from 1.9 to 3.1 <br />
<br />
* You do need a separate data folder for each instance and a separate database (You can use phpmyadmin to set your database, but that's not necessary), add each instance in its own folder, and carry on as above. You can also host another service (eg, Mahara) in it's separate folder.<br />
<br />
===Example 1===<br />
*So, one example folder tree on one Linux laptop (an actual server would be more) may look something like:<br />
<br />
var<br />
--www<br />
----maharadata<br />
----moodlecleandata<br />
----moodlestabledata<br />
----moodlemasterdata<br />
----moodletestingdata<br />
----uswmoodledata<br />
----html<br />
------mahara<br />
------moodleclean<br />
------moodlestable<br />
------moodlemaster<br />
------moodletesting<br />
------uswmoodle<br />
<br />
===Example 2===<br />
* Have several sandboxed Moodles on a single (CentOS X) server all of different versions .. only the ones that are supported for security fixes and above - 2.7,2.8,2.9,3.0, and now a 3.1. Pretty much 'stock' Moodles with only occasional addons, etc. for testing.<br />
* All have their separate code and data directories as well as their separate DB's.<br />
<br />
* Hint: install and maintain them all with [[Git_for_Administrators|git]] ... even if you don't prefer/like command line, that is by far the most efficient way to update and/or upgrade a site.<br />
<br />
/var/www/html/moodle27/version.php:$release = '2.7.14 (Build: 20160509)'<br />
/var/www/html/moodle28/version.php:$release = '2.8.12 (Build: 20160509)'<br />
/var/www/html/moodle29/version.php:$release = '2.9.6+ (Build: 20160520)'<br />
/var/www/html/moodle30/version.php:$release = '3.0.4+ (Build: 20160603)'<br />
/var/www/html/moodle31/version.php:$release = '3.1+ (Build: 20160603)'<br />
<br />
* The git -b command locks a site into the version provided with the rest of the git command ... for example, installing the 3.1, which is a long term support version, installed with git -b option. Don't plan on upgrading nor testing upgrades with that one.<br />
<br />
git clone -b MOODLE_31_STABLE git://git.moodle.org/moodle.git moodle31<br />
<br />
* All the other moodles I have on that server have been installed via git <br />
<br />
git clone git://git.moodle.org/moodle.git [nameofdir]<br />
<br />
* then from nameofdir<br />
<br />
git branch --track MOODLE_2#_STABLE origin/MOODLE_2#_STABLE<br />
git checkout MOODLE_2#_STABLE<br />
<br />
* 2# is the version number.<br />
<br />
* That allows one to march that moodle upwards ... higher branch(es). So one can test an upgrade (as opposed to an 'update').<br />
<br />
* This second method 'gits' more code and backups will range in the 5+ Meg range due to all the older version git stuff The 3.1 much less (restricted to 3.1 branch):<br />
<br />
* 545M ./moodle296-code-20160604145012.tar<br />
<br />
* 193M ./moodle31+-code-2016060883737.tar<br />
<br />
<br />
[[es:Guia de instalacion paso-a-paso para Ubuntu 16.04]]</div>Wwycheuk