RedHat Linux installation: Difference between revisions

From MoodleDocs
 
(32 intermediate revisions by 20 users not shown)
Line 1: Line 1:
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, but....
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'''.
 
FIRST: RTFM!! Please read carefully the Moodle installation documentation at http://moodle.org/doc/?file=install.html


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.
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.


==STEP 1: Make sure you have installed the following packages.==
== Make sure you have installed the following packages ==
(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):
(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):


Line 18: Line 16:
* 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.
* 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.


==STEP 2: Download Moodle...==
If you want a minimal system, startging with RHEL6 (and clones) there is the possiblity of installing a minimal system.
 
== Configure hostname and domain name==
 
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
 
== A word about SELinux ==
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]
 
== A word about the PHP packages in RHEL ==
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.
 
You have therefore to make a choice:
* Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own
* Install the whole (latest) PHP from source on your own (and maintain it)
* Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):
** [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)
** RPMFusion and others also have newer PHP packages
 
== Download Moodle==
(I will install under /usr/moodle, data in /usr/moodle_data)
(I will install under /usr/moodle, data in /usr/moodle_data)


Line 27: Line 44:
** mkdir /usr/moodle_data
** mkdir /usr/moodle_data
** cp moodle_111.zip /usr/moodle
** cp moodle_111.zip /usr/moodle
* If you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file..
* If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file..
** cd /usr/moodle
** cd /usr/moodle
** cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/moodle login
** git clone git://git.moodle.org/moodle.git
** cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/moodle co moodle
* Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file..
** cd /usr/moodle
** cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login
** cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle


==STEP 3: Unpack and set file permission etc.==
== Unpack and set file permission etc ==


* 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.
* 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.
** cd /usr/moodle
** cd /usr/moodle
** unzip moodle_111.zip
** unzip moodle_xxx.zip
** mv moodle mymoodle
** mv moodle mymoodle
*** (optional step - I have more than one install under /usr/moodle)
*** (optional step - I have more than one install under /usr/moodle)
Line 45: Line 65:
** chown -R apache:apache /usr/moodle_data
** chown -R apache:apache /usr/moodle_data


==STEP 4: Setup config.php==
== Setup config.php ==


* Still as root copy and edit the config file, you should know the host/domain name for your server
* Still as root copy and edit the config file, you should know the host/domain name for your server
Line 52: Line 72:
** vi config.php (or whatever your favourite editor is!)
** vi config.php (or whatever your favourite editor is!)
* Your config.php settings should be something like...
* Your config.php settings should be something like...
** dbtype = "mysql"
** dbtype = "mysqli"
** dbhost = "localhost"
** dbhost = "localhost"
** dbname = "mymoodle"
** dbname = "mymoodle"
Line 61: Line 81:
** wwwroot = "http://myhost.mydomain/mymoodle"
** wwwroot = "http://myhost.mydomain/mymoodle"
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")
*** (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")
** dirroot = "/usr/moodle/mymoodle"
** dirroot = '/usr/moodle/mymoodle'
** dataroot = "/usr/moodle_data/mymoodle"
** dataroot = '/usr/moodle_data/mymoodle'
* Save your changes and exit from the editor
* Save your changes and exit from the editor


==STEP 5: Setup MySQL==
== Setup MySQL ==


* First you need to get the MySQL daemon running, it is not running by default.
* First you need to get the MySQL daemon running, it is not running by default.
Line 73: Line 93:
* If you haven't yet, as root, change the MySQL root password
* If you haven't yet, as root, change the MySQL root password
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)
** mysqladmin -u root password mysqlpass (<-- should change this to something of your own)
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#database for more details)
* Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)
* Launch MySQL as root
* Launch MySQL as root
** mysql -u root -p
** mysql -u root -p
*** (at the password prompt, enter the password from above)
*** (at the password prompt, enter the password from above)
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')
* At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')
** CREATE DATABASE mymoodle;
** CREATE DATABASE mymoodle CHARSET 'utf8mb4';
*** (the name 'mymoodle' is the same name as the database from Step 4)
*** (the name 'mymoodle' is the same name as the database from Step 4)
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON mymoodle.*
** GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON mymoodle.*
Line 84: Line 104:
** TO moodleuser@localhost IDENTIFIED BY 'moodlepass';
** TO moodleuser@localhost IDENTIFIED BY 'moodlepass';
*** ('moodleuser' and 'moodlepass' are from Step 4)
*** ('moodleuser' and 'moodlepass' are from Step 4)
** flush privileges;
** quit
** quit
* Still as root, reload MySQL
** mysqladmin -p reload
* (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)
* (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)
== Setup Apache ==
* Edit the Apache configuration file at /etc/httpd/conf/httpd.conf
* Right at the end of the file add the following lines: (once again 'mymoodle' as from Step 3)
** <Directory "/usr/moodle/mymoodle">
** DirectoryIndex index.php
** AcceptPathInfo on
** AllowOverride None
** Options None
** Order allow,deny
** Allow from all
** </Directory>
** Alias /mymoodle "/usr/moodle/mymoodle"
* Don't insert a space in "allow,deny" (common mistake!)
* 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.
* Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.
== Set up the cron job ==
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!).
* If you wish to place an entry in your root user's crontab use:
** crontab -e
** Add the following line:
*** */5 * * * * /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php
**** (change the URL as appropriate for your site)
---
* If you wish to add an entry in /etc/crontab:
* Open the /etc/crontab file in an editor (vi).
* Add the following line:
** */5 * * * * root /usr/bin/wget -O /dev/null http://localhost/mymoodle/admin/cron.php
*** (change the URL as appropriate for your site)
---
* In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')
== Try your new installation ==
http://myhost.mydomain/mymoodle/admin
or, if you are running the browser on the same machine
http://localhost/mymoodle/admin
[[Category:Administrator]]
[[Category:Installation]]
[[pl:Instalacja_w_RedHat]]
== Reference ==
Please also see these discussion for GD:

Latest revision as of 01:25, 8 May 2017

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.

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.

Make sure you have installed the following packages

(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):

  • X Windows System (not vital but easier)
  • Gnome or KDE desktop environment (as above)
  • Server Configuration Tools
  • Web Server
    • Click "Details" and make sure all PHP modules are ticked (except ODBC and PGSQL, they're not neccesary)
    • make sure not to miss the MYSQL-PHP module (not installed by default)
  • SQL Database
    • Click "Details" and tick MySQL server box
  • 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.

If you want a minimal system, startging with RHEL6 (and clones) there is the possiblity of installing a minimal system.

Configure hostname and domain name

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

A word about SELinux

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 [1]

A word about the PHP packages in RHEL

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.

You have therefore to make a choice:

  • Use RH and pay attention your Moodle version supports it + PHP modules from and maintain them on your own
  • Install the whole (latest) PHP from source on your own (and maintain it)
  • Install PHP packages from a third party repo (but you won't get support from Redhat if you run into problems):
    • [rpms.famillecollet.com] Maintains recent MySQL and PHP packages for supported EL version (a EPEL contributor)
    • RPMFusion and others also have newer PHP packages

Download Moodle

(I will install under /usr/moodle, data in /usr/moodle_data)

  • Download your favourite version of Moodle from moodle.org (.zip archive is easiest)
  • as Root create folder under /usr and copy zip
    • su
    • mkdir /usr/moodle
    • mkdir /usr/moodle_data
    • cp moodle_111.zip /usr/moodle
  • If you prefer you can install the GIT version directly for all the latest features. Instead of downloading and copying the zip file..
  • Or if you prefer you can install the CVS version directly for all the latest features. Instead of downloading and copying the zip file..
    • cd /usr/moodle
    • cvs -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle login
    • cvs -z3 -d:pserver:anonymous@uk.cvs.moodle.org:/cvsroot/moodle co moodle

Unpack and set file permission etc

  • 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.
    • cd /usr/moodle
    • unzip moodle_xxx.zip
    • mv moodle mymoodle
      • (optional step - I have more than one install under /usr/moodle)
    • mkdir /usr/moodle_data/mymoodle
      • (same name as the moodle install above)
    • chown -R apache:apache /usr/moodle
      • (! Giving Apache full rights to your Moodle programs is not secure. Check out the forums for recomendations on how to secure a production environment.)
    • chown -R apache:apache /usr/moodle_data

Setup config.php

  • Still as root copy and edit the config file, you should know the host/domain name for your server
    • cd /usr/moodle/mymoodle
    • cp config-dist.php config.php
    • vi config.php (or whatever your favourite editor is!)
  • Your config.php settings should be something like...
    • dbtype = "mysqli"
    • dbhost = "localhost"
    • dbname = "mymoodle"
    • dbuser = "moodleuser"
    • dbpass = "moodlepass" (<-- better make this something of your own)
    • prefix = ""
      • (keep the default 'mdl_' prefix if you plan on sharing the database with other applications)
    • wwwroot = "http://myhost.mydomain/mymoodle"
      • (If you only want to try moodle out and will not be accessing it from other machines you can use "http://localhost/mymoodle")
    • dirroot = '/usr/moodle/mymoodle'
    • dataroot = '/usr/moodle_data/mymoodle'
  • Save your changes and exit from the editor

Setup MySQL

  • First you need to get the MySQL daemon running, it is not running by default.
    • 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).
    • Tick the box for MySQL and (with it selected) press the Start icon - ensure it starts up
    • Choose "Save Changes" from the menu, and exit the program.
  • If you haven't yet, as root, change the MySQL root password
    • mysqladmin -u root password mysqlpass (<-- should change this to something of your own)
  • Next, set up the MySQL database (see http://moodle.org/doc/?file=install.html#Database for more details)
  • Launch MySQL as root
    • mysql -u root -p
      • (at the password prompt, enter the password from above)
  • At the '>' MySQL prompt, enter the following commands (MySQL commands are ended with a ';')
    • CREATE DATABASE mymoodle CHARSET 'utf8mb4';
      • (the name 'mymoodle' is the same name as the database from Step 4)
    • GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON mymoodle.*
      • (as above, 'mymoodle' is from Step 4)
    • TO moodleuser@localhost IDENTIFIED BY 'moodlepass';
      • ('moodleuser' and 'moodlepass' are from Step 4)
    • flush privileges;
    • quit
  • (! Consider MySQL security - not covered here. If you run a firewall, you don't have too much to worry about.)

Setup Apache

  • Edit the Apache configuration file at /etc/httpd/conf/httpd.conf
  • Right at the end of the file add the following lines: (once again 'mymoodle' as from Step 3)
    • <Directory "/usr/moodle/mymoodle">
    • DirectoryIndex index.php
    • AcceptPathInfo on
    • AllowOverride None
    • Options None
    • Order allow,deny
    • Allow from all
    • </Directory>
    • Alias /mymoodle "/usr/moodle/mymoodle"
  • Don't insert a space in "allow,deny" (common mistake!)
  • 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.
  • Run the Services application (same as for Mysql) - tick and start "httpd", then save changes and exit.

Set up the cron job

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!).

  • If you wish to place an entry in your root user's crontab use:

---

  • If you wish to add an entry in /etc/crontab:
  • Open the /etc/crontab file in an editor (vi).
  • Add the following line:

---

  • In either case, don't forget to save the file and exit (in vi that is <Esc>, then ':wq')

Try your new installation

http://myhost.mydomain/mymoodle/admin

or, if you are running the browser on the same machine

http://localhost/mymoodle/admin

Reference

Please also see these discussion for GD: