Moodle 3.0.3 installation on fedora 23

Moodle 3.0.3 installation on fedora 23

by Johan Bester -
Number of replies: 4

Hi


I have installed moodle on windows before with out any problems but i am having issues with this setup. It will only be available locally.

PHP version. 5.6.20

Mysql Comunity Server 5.7.12

Apache 2.4.18


Config.php


<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = '***';
$CFG->dbpass    = '***';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
);

$CFG->wwwroot   = 'http://192.168.40.251';
$CFG->dirroot   = '/var/www/html';
$CFG->dataroot  = '/home/moodledata/moodledata/';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

require_once(dirname(__FILE__) . '/lib/setup.php');

// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!


My Problem:


The server installs just fine to the license agreement. Once I click on continue it take me to a blank page.

The License page has this url

http://192.168.40.251/admin/index.php?cache=0&lang=en&agreelicense=0

and the blank page this url

http://192.168.40.251/admin/index.php?cache=0&lang=en&agreelicense=1

Any help will be great appreciated


Average of ratings: -
In reply to Johan Bester

Re: Moodle 3.0.3 installation on fedora 23

by Ken Task -
Picture of Particularly helpful Moodlers

First, have to ask ... why Fedora?   Thought Fedora was the 'community version' for RedHat and not a 'long term support' distro as well.   Meaning ... within a year or two, Fedora will not be getting any updates/fixes/patches.   Even if the server not to be accessible to the outside internet, there is and there has always been the easier attack vector of 'inside'.

CentOS provides a verion 6 and a version 7 now that is long term support ... for many years.

Ok, now that I've that off my chest ...

The config file for Apache is in /etc/httpd/conf/ and is called httpd.conf

Check in there and think you'll see that /var/www/ is the apache users space.

Docuement root is: /var/www/html/ (moodle code goes here)

This to suggest that moodledata could/should reside in /var/www/ rather than /home/moodledata/moodledata ... UNLESS the OS has partitioned the drive such that /home is the largest and one doesn't have or won't have enough room/space available for the data moodle will create/hold.

For issues on blank screens ... check apache error logs ... /var/log/httpd/error_log for clues.

Consider removing the *contents* of moodledata/cache and moodledata/localcache manually.

Then hit http://site/ ... which  should throw you back into the installation.

OR ...

use the command line to install ... as root user ...

cd /pathtomoodlecode/admin/cli/

php install.php

This takes apache out of the loop - just php and MySQL are involved then.

You will be prompted for the same things one would see via browser when installing.

Know things like DB name, DB host, DB user, DB password, site URL, paths to moodledata etc..

When you get to the first user config, make sure you jot down on paper the password you give the initial 'admin' user.

Once it's installed via command line, the config.php file has been tagged as belonging to 'root' user.   Use chown apache:apache * -R to tag all flies/diretories as belonging to apache user, apache group.

If you don't do that, the first attempt to access via browser will show a blank screen.

Also, think Fedora might still use seLinux.

As root user, issue: /usr/sbin/sestatus

If you see 'enforcing' this will present issues in installing/running Moodle

Change to 'permissive' or 'disabled' ... I'd set to 'permissive' ...

As root user:

cd /etc/selinux

nano config

change SELINUX=enforcing to SELINUX=permissive

Save the file.

Setting it to permissive means selinux will 'complain' in apache error_logs but you will see the issues and if one follows up on fixing those, eventually, there will be no complaints, and one could switch seLinux back to enforcing ... and thus have a pretty secure box.

Reboot the box after changing config for seLinux.  Watch for errors on reboot.

https://docs.fedoraproject.org/en-US/Fedora/11/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Enabling_and_Disabling_SELinux.html

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.0.3 installation on fedora 23

by Albert Ramsbottom -

Check your Apache.conf

your moodle data folder should be moved to /var/www/moodledata and your 

$CFG->dataroot  = '/var/www/moodledata';

Then go from there!!


Check logs and permissions

Albert

In reply to Ken Task

Re: Moodle 3.0.3 installation on fedora 23

by Johan Bester -

Hi Ken


Thanks for the advice and about the fedora thing i am only sesting up a beta server at the moment to test moodle in our environment so i will not be using it for long and the only reason i choose fedora as well is that it has been ages since i last worked in the linux environment and i learned linux on a fedora box so just though about getting in touch with my roots again while beta testing. lol


I have made all the changes, deleted the chache and set the perms and owners for the files. I even went so far as to add Apache user to the entire /var folder including sub folders with full read,write and execute perms. When that did not work made the Apache the owner of the entire /var folder including sub folders same blank result. I also dit set the box to permissive and did do the reboot.  I looked at the Apache logs and i see no errors there.

Here is the log after the reboot:

[Thu Apr 14 11:46:23.039292 2016] [core:notice] [pid 1634] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Thu Apr 14 11:46:23.093335 2016] [suexec:notice] [pid 1634] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[Thu Apr 14 11:46:23.147846 2016] [auth_digest:notice] [pid 1634] AH01757: generating secret for digest authentication ...
[Thu Apr 14 11:46:23.149975 2016] [lbmethod_heartbeat:notice] [pid 1634] AH02282: No slotmem from mod_heartmonitor
[Thu Apr 14 11:46:23.415760 2016] [mpm_prefork:notice] [pid 1634] AH00163: Apache/2.4.18 (Fedora) OpenSSL/1.0.2g-fips PHP/5.6.20 mod_perl/2.0.9 Perl/v5.22.1 configured -- resuming normal operations
[Thu Apr 14 11:46:23.415805 2016] [core:notice] [pid 1634] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'


That was my log file after i deleted to cache in both locations, deleted the config.php file again. Restarted the whole installation process and it sill come to the same place then blank screen.


I did set the owner correct after moodle made the config.php.


The new config.php


<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = '***';
$CFG->dbpass    = '***;
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
);

$CFG->wwwroot   = 'http://192.168.40.251';
$CFG->dirroot   = '/var/www/html'; //I added this one in manually as it was not in, did make a diffrence
$CFG->dataroot  = '/var/www/moodledata';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

require_once(dirname(__FILE__) . '/lib/setup.php');

// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!


Will it wise to just scrap this install then move to CentOS directly?

In reply to Johan Bester

Re: Moodle 3.0.3 installation on fedora 23

by Ken Task -
Picture of Particularly helpful Moodlers

Will address the last question first ...

*IF* there is a chance you will go into production with Moodle, why not start with a LTS version even if running in a private network?    There is enough difference between Fedora and CentOS that would/will facilitate moving to production quickly cause you've tackled the issues with CentOS already.  Production becomes 'childs play', so to speak.

Permissions are now too liberal and ill advised.  Unless you saw a log that said 'permission denied' - which you haven't yet, cause not looking in the right place! smile   Now the task is to revert those very liberal and potentially dangerous permissions on /var ... plus the subdirectories.

On a CentOS boxen (similar to Fedora) here's what you just opened to the globe:

[root@sos var]# ls
account  cvs    ftp    lib    log    nfs  preserve  run      tmp  yp
cache     db    games  local  mail    nis  racoon    spool      tux
crash     empty    gdm    lock   net-snmp    opt  rails     streaming  www

nfs, for example should have nobody, gdm should have root:gdm, cups should have root:lp, streaming should have drwx------, etc. and so forth.   Box shouldn't ever be accessible to outside world and probably need not be used even on a private network ... unless you plan on making it a 'honey pot' ... cause that's what it is now.

The directory that one should have focused upon was 'www'.  Inspection of the config file for apache ... /etc/httpd/conf/httpd.conf would have given you clues as to where to concentrate your efforts in resolution of the problem.

Log for apache ... all are notices ... not errors.

The log to check ... is the apache *error* log - which is probably in /var/log/httpd/ ... error_log

If PHP configured to log errors, there could be a php_error.log in /var/log/

I sometimes install and use a text based browser on the server:

yum -y install lynx

After installation, from command line:

lynx http://192.168.40.251/ to test.  It will show errors not seen via browser.

MySQL/MariaDB running?  Has login password set?   Has a database been created for moodle - character set utf8 collate utf8_general_ci?

ps aux |grep mysqld

PHP has all that it needs?

php -m (shows mods for php loaded)

Blank screens indicate issues ... obviously ... clear workstation cookies and history to site.   Clear/purge caches of Moodle (php /pathtomoodlecode/admin/cli/purge_caches.php

Before making the next attempt, turn on debugging via config.php file.

Lines in config-dist.php file to place into config.php

// Force a debugging mode regardless the settings in the site administration
// @error_reporting(E_ALL | E_STRICT); // NOT FOR PRODUCTION SERVERS!
// @ini_set('display_errors', '1');    // NOT FOR PRODUCTION SERVERS!
// $CFG->debug = (E_ALL | E_STRICT);   // === DEBUG_DEVELOPER - NOT FOR PRODUCTION SERVERS!
// $CFG->debugdisplay = 1;             // NOT FOR PRODUCTION SERVERS!

un-commented of course.

And after resolution of problems, advise leaving the lines in config.php and commenting them out again.

So ... how about we stop now .... and see what we get.

'spirit of sharing', Ken