Post-install questions and Installation guides confusion

Post-install questions and Installation guides confusion

by tasty minerals -
Number of replies: 21

This is my first time setting up a Moodle site.

I have a server machine with Debian 3.2 and need to install Moodle on it to create a class for students.

After completing the Moodle installation and configuration steps I still have some questions.

https://docs.moodle.org/31/en/Installing_Moodle

https://docs.moodle.org/31/en/Installation_quick_guide

I started with a quick guide but then jumped to full guide, then back to quick guide. I was jumping back and forth in order to be able to understand all the steps properly and yet I still do not know why do we have to move "moodle code" to "/var/www/moodle" dir when the first guide does not even mention this. So, I have copied them to "/var/www/moodle" just in case. I have set the postgresql database and finished the Moodle cli installation script. I get to the bottom of the installation guide and it tells me that I can now add a course but how can I add a course if I am working over ssh in shell? I do not even know if my Moodle web site is up and running. 

How do I actually proceed from where I got? 

Average of ratings: -
In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I changed the wording...

"Create a new course: You can now access Moodle through your web browser (using the same URL as you set during the install process), log in as your admin user and create a new course. See create a new course."

The "quick start", kicks off with the comment "This page is intended for administrators who are experienced with installing web server applications". Is this you? At the end of the day, you have to have a vague idea about adding web applications to a Debian server. Installing PHP applications with the Apache web server and a backend database is probably one of the most common admin tasks. If you are struggling with this then you are definitely going to struggling maintaining a secure reliable server. I say this not to insult you or to put you off rather to caution you about possible troubles ahead. 

Having said that, there's tons of online documentation and none if it is "rocket science". 

You need to know where your web server needs your web-server files to go for them to work. Or, you need to know how to configure that. The default is normally *something like* /var/www or /var/www/html but you will need to find out for your particular distro/configuration. Putting Moodle in a sub-directory called 'moodle' is "safe" advice because you won't accidentally overwrite anything else. That gives you a URL of (something like) http://www.tastyminerals.com/moodle. But, exactly how you do that is up to you. 

PS. It's better if you use your real name for your moodle.org account. Then we know who we are talking to. If there's more than one of you, you can each have your own account wink


In reply to Howard Miller

Re: Post-install questions and Installation guides confusion

by tasty minerals -

Some clarification.

I have downloaded the necessary Moodle dependencies.

First, I have set and configured postgresql, I created an empty database and checked that it exists.

Now, that I've read about "/var/www/" dir, I assume putting the "moodle" code files there is what should be done in order for apache to start using them. So, after I ran Moodle php config script in ~/moodle/admin/cli, I copied this  dir to "/var/www/". I created a cron job, as was required in the guide and remote restarted the machine. Here is my config.php file:


unset($CFG);

global $CFG;

$CFG = new stdClass();

$CFG->dbtype    = 'pgsql';

$CFG->dblibrary = 'native';

$CFG->dbhost    = 'localhost';

$CFG->dbname    = 'moodle';

$CFG->dbuser    = 'moodleuser';

$CFG->dbpass    = 'moodpostgres';

$CFG->prefix    = 'mdl_';

$CFG->dboptions = array (

  'dbpersist' => 0,

  'dbport' => '',

  'dbsocket' => '',

);

$CFG->wwwroot   = 'http://lsd.test.de/moodle';

$CFG->dataroot  = '/home/lsd/moodledata';

$CFG->admin     = 'admin';

$CFG->directorypermissions = 02777;

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


So, here goes my next step I did. I opened firefox and attempted to open "http://lsd.test.de/moodle". Of course the site didn't open and here my knowledge of what to do next ends. As I mentioned before, I am working via ssh in shell. I have no X, no browser installed on the remote machine, this is just a server. So, how can I open the Moodle web site I've just set up, if I did everything according to the guide?

In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You need to put the Moodle code in the right place and *then* run the installation script. You do not move it afterwards. Which bit of the documentation made you think you should do that? If it's unclear we can try to make it better. 

I hope you don't mean debian 3.2 as that is ancient history. I assume you mean 8.2.

As far as I can tell, if you don't touch the apache configuration your document root should be /var/www/html. So, if you put Moodle in /var/www/html (such that the html directory contains config.php) you should find Moodle at http://lsd.test.de/ . If you put the Moodle directory beneath that, so you have /var/www/html/moodle you will find it at http://lsd.test.de/moodle.

In reply to Howard Miller

Re: Post-install questions and Installation guides confusion

by tasty minerals -

I have put the moodle dir into "/var/www/html/moodle", removed "config.php" and rerun the configuration again.

type y (means yes) or n (means no)
: y
Database tables already present, cli installation can not continue.
lsd@lsd:/var/www/html/moodle$

Then I open a web browser and enter "http://lsd.test.de/moodle" and it says "server no found".

I feel that I need to redo everything again from scratch?

This is an old Debian machine

lsd@lsd:~$ uname -a
Linux lsd 3.2.0-4-amd64 #1 SMP Debian 3.2.82-1 x86_64 GNU/Linux
In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

It sounds like apache is not running.  I am presuming that you have downloaded apache.  Try service apache2 restart and see if that fires something up.  Then you need to adjust the sites-available default file to point to your moodle.  Actually switch that around - restart apache after fixed the default file.

I use Debian - in fact, I rewrote the debian install page so that when I rebuild a server, I can just use it as my guide (am open to criticism if you need something clearer!).  If you make sure you have done everything according to that, you should be able to get up and running.  

So check the apache sites available section and the php.ini section on this page - https://docs.moodle.org/31/en/Installing_Moodle_on_Debian_based_distributions

 

In reply to Emma Richardson

Re: Post-install questions and Installation guides confusion

by tasty minerals -

I also followed your instructions for Debian, installed the deps and modified the apache2 configs accordingly.

My installed moodle files are in "/var/www/html/moodle/".

Apache service restarted without warnings, so it found the files in place.

The website is however still not available from outside, but I guess that might me some unrelated access issues.

I tried to load the pages using text browsers (from the server machine itself) such as w3m, links, lynx but none worked. I am getting either "unable to connect to remote host" or "Object not found 404 error". I tried.

lsd@lsd$ links http://lsd.test.de/moodle
lsd@lsd$ links http://localhost/moodle
lsd@lsd$ links http://localhost/phpinfo

This is frustrating. If it wasn't the Moodle I was asked to install, I would have already ditched the affair.

In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

What version of PHP is running on this machine? If it's the version that came with the distribution then you have no hope of running Moodle. 

In reply to Howard Miller

Re: Post-install questions and Installation guides confusion

by tasty minerals -

php 5.4.4

In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

PHP version should be fine.  What happens when you open a browser and just go to localhost?  This has to be something simple..but it appears to be a server setup issue somewhere.  Without seeing it for myself and no detailed error, it is hard to diagnose.

In reply to Emma Richardson

Re: Post-install questions and Installation guides confusion

by tasty minerals -

I am working via ssh, on a machine without any desktop environment. So, the only way I can open a browser is to use a text browser like links or w3m. I tried them both, here is what links reports:

lsd@lsd:~$ links 127.0.0.1
Error loading http://lsd.test.de
Host not found


So, it does look for correct "lsd.test.de" web page I set via "install.php" script at least.

In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Ken Task -
Picture of Particularly helpful Moodlers

Don't run Debian ... but even old other Linux versions did have to use host file and DNS to function on the internet ... especially IF attempting to run an Apache server to be accessed by others not on the system.

Apache likes to be able to find it's FQDN when it launches.   So how do you have apache configured ... listen on port only? or FQDN:port or  not at all?

Do you have an /etc/hosts file?

What does it contain?

The links command you used ... I see it auto'd http:// in front of 127.0.0.1 but note it says host not found.  Ok how could a server app pointed to itself NOT find it self?

Host file.

Example using your FQDN: lsd.test.de

cat /etc/hosts (from a CentOS server, but like I said, would think that even older linuxes used same)

# Do not remove the following line, or various programs
# that require network functionality will fail.

127.0.0.1    localhost.localdomain    localhost

127.0.0.1    lsd.test.de lsd

PUBLICIPADDRESS  lsd.test.de lsd

Save the file.  The try your command line text based browser again.

'spirit of sharing', Ken


In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Well that's a start.  Can you post your sites-available/default config file?

Then can you do a ls -l on your www folder and post those?

Same for your moodle folder inside www?

In reply to Emma Richardson

Re: Post-install questions and Installation guides confusion

by tasty minerals -

apache2 default:

$sudo cat /etc/apache2/sites-available/default
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/moodle
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html/moodle>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

listing /var/www

$ ls -l /var/www
total 12
drwxr-xr-x 3 root root 4096 Oct 29 01:05 html
-rw-r--r-- 1 root root  177 Oct 28 13:07 index.html
-rw-r--r-- 1 lsd  lsd    14 Oct 29 11:27 phpinfo.php

listing moodle

$ ls -l /var/www/html/moodle
total 540
drwxr-xr-x 11 root     lsd       4096 Sep 10 22:50 admin
drwxr-xr-x 21 root     lsd       4096 Sep 10 22:50 auth
drwxr-xr-x  6 root     lsd       4096 Sep 10 22:50 availability
drwxr-xr-x  7 root     lsd       4096 Sep 10 22:50 backup
drwxr-xr-x  6 root     lsd       4096 Sep 10 22:50 badges
-rw-r--r--  1 root     lsd        302 Sep 10 22:50 behat.yml.dist
drwxr-xr-x 45 root     lsd       4096 Sep 10 22:50 blocks
drwxr-xr-x  3 root     lsd       4096 Sep 10 22:50 blog
-rw-r--r--  1 root     lsd       1162 Sep 10 22:50 brokenfile.php
drwxr-xr-x  6 root     lsd       4096 Sep 10 22:50 cache
drwxr-xr-x  6 root     lsd       4096 Sep 10 22:50 calendar
drwxr-xr-x  4 root     lsd       4096 Sep 10 22:50 cohort
drwxr-xr-x  4 root     lsd       4096 Sep 10 22:50 comment
drwxr-xr-x  4 root     lsd       4096 Sep 10 22:50 competency
drwxr-xr-x  5 root     lsd       4096 Sep 10 22:50 completion
-rw-r--r--  1 root     lsd        147 Sep 10 22:50 composer.json
-rw-r--r--  1 root     lsd      89833 Sep 10 22:50 composer.lock
-rw-r--r--  1 root     lsd      43554 Sep 10 22:50 config-dist.php
-rw-r-----  1 www-data www-data   701 Oct 29 01:46 config.php
-rw-r--r--  1 root     lsd       2356 Sep 10 22:50 CONTRIBUTING.txt
-rw-r--r--  1 root     lsd      35147 Sep 10 22:50 COPYING.txt
drwxr-xr-x  9 root     lsd       4096 Sep 10 22:50 course
drwxr-xr-x  7 root     lsd       4096 Sep 10 22:50 dataformat
-rw-r--r--  1 root     lsd       2595 Sep 10 22:50 draftfile.php
drwxr-xr-x 17 root     lsd       4096 Sep 10 22:50 enrol
drwxr-xr-x  2 root     lsd       4096 Sep 10 22:50 error
-rw-r--r--  1 root     lsd       3836 Sep 10 22:50 file.php
drwxr-xr-x  3 root     lsd       4096 Sep 10 22:50 files
drwxr-xr-x 15 root     lsd       4096 Sep 10 22:50 filter
-rw-r--r--  1 root     lsd        953 Sep 11 02:11 githash.php
drwxr-xr-x  8 root     lsd       4096 Sep 10 22:50 grade
drwxr-xr-x  3 root     lsd       4096 Sep 10 22:50 group
-rw-r--r--  1 root     lsd       9394 Sep 10 22:50 Gruntfile.js
-rw-r--r--  1 root     lsd       1423 Sep 10 22:50 help_ajax.php
-rw-r--r--  1 root     lsd       1882 Sep 10 22:50 help.php
-rw-r--r--  1 root     lsd      13533 Sep 10 22:50 index.php
drwxr-xr-x  3 root     lsd       4096 Sep 10 22:50 install
-rw-r--r--  1 root     lsd      25372 Sep 10 22:50 install.php
-rw-r--r--  1 root     lsd        664 Sep 10 22:50 INSTALL.txt
drwxr-xr-x  3 root     lsd       4096 Sep 10 22:50 iplookup
drwxr-xr-x  3 root     lsd       4096 Sep 10 22:50 lang
drwxr-xr-x 50 root     lsd       4096 Sep 10 22:50 lib
drwxr-xr-x  2 root     lsd       4096 Sep 10 22:50 local
drwxr-xr-x  3 root     lsd       4096 Sep 10 22:50 login
drwxr-xr-x  5 root     lsd       4096 Sep 10 22:50 message
drwxr-xr-x  5 root     lsd       4096 Sep 10 22:50 mnet
drwxr-xr-x 24 root     lsd       4096 Sep 10 22:50 mod
drwxr-xr-x  3 root     lsd       4096 Sep 10 22:50 my
drwxr-xr-x  3 root     lsd       4096 Sep 10 22:50 notes
-rw-r--r--  1 root     lsd      52478 Sep 10 22:50 npm-shrinkwrap.json
-rw-r--r--  1 root     lsd        350 Sep 10 22:50 package.json
-rw-r--r--  1 root     lsd       7340 Sep 10 22:50 phpunit.xml.dist
drwxr-xr-x 14 root     lsd       4096 Sep 10 22:50 pix
drwxr-xr-x  2 root     lsd       4096 Sep 10 22:50 plagiarism
-rw-r--r--  1 root     lsd       1312 Sep 10 22:50 pluginfile.php
drwxr-xr-x  8 root     lsd       4096 Sep 10 22:50 portfolio
-rw-r--r--  1 root     lsd        266 Sep 10 22:50 PULL_REQUEST_TEMPLATE.txt
drwxr-xr-x  9 root     lsd       4096 Sep 10 22:50 question
drwxr-xr-x  4 root     lsd       4096 Sep 10 22:50 rating
-rw-r--r--  1 root     lsd       1176 Sep 10 22:50 README.txt
drwxr-xr-x 19 root     lsd       4096 Sep 10 22:50 report
drwxr-xr-x 25 root     lsd       4096 Sep 10 22:50 repository
drwxr-xr-x  2 root     lsd       4096 Sep 10 22:50 rss
drwxr-xr-x  7 root     lsd       4096 Sep 10 22:50 search
drwxr-xr-x  5 root     lsd       4096 Sep 10 22:50 tag
-rw-r--r--  1 root     lsd        615 Sep 10 22:50 tags.txt
drwxr-xr-x  7 root     lsd       4096 Sep 10 22:50 theme
-rw-r--r--  1 root     lsd       2191 Sep 10 22:50 TRADEMARK.txt
drwxr-xr-x  7 root     lsd       4096 Sep 10 22:50 user
drwxr-xr-x  2 root     lsd       4096 Sep 10 22:50 userpix
-rw-r--r--  1 root     lsd       1638 Sep 10 22:50 version.php
drwxr-xr-x  6 root     lsd       4096 Sep 10 22:50 webservice
In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Ken Task -
Picture of Particularly helpful Moodlers

DocumentRoot is /var/www/html/moodle/

Put your phpinfo.php file inside that directory and see if your text based browser app can see it?

IF you don't see a php generated page, then you know it's a php config issue.

Have to have a handler for .php scripts.   Google that for Debian based servers.

'spirit of sharing', Ken


In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Ok:

Start by running:  chown -R www-data:www-data /var/www/html

Then: chmod -R 755 /var/www/html

See if that changes anything.  I am checking to see how my apache config file matches up...

Add a slash at the end of your Directory address

<Directory /var/www/html/moodle/>
So it looks like this
In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Ken Task -
Picture of Particularly helpful Moodlers

One other thing ... what is DocumentRoot set to in Apache config?

Should apply to all linuxes IF one knows the main config file for apache.   In Debian based boxen that's apache2.conf?

Find that file.

find / -name apache2.conf

That will search your entire HD looking for the location of that .conf file.  It will take a long time.  When it completes it will show the full path to that file.

Then do this:

fgrep 'DocumentRoot' /path/to/apache2.conf

The DocumentRoot variable shows where apache is going to look to server out anything ... static web pages, images, and even php based apps.

On a CentOS box that host multiple virtual apache sites the above command looks like

[root@host]# fgrep 'DocumentRoot' /etc/httpd/conf/httpd.conf
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/var/www/html"  *
# This should be changed to whatever you set DocumentRoot to.
#    DocumentRoot /www/docs/dummy-host.example.com
    DocumentRoot /var/www/html
    DocumentRoot /home/campsig/html
    DocumentRoot /home/geosig/html
    DocumentRoot /home/vlsig/html
    DocumentRoot /home/testsite/
    DocumentRoot /home/elearn/html
    DocumentRoot /home/foresig/html

* see that line?   That's where Moodle code would go for the main site ... in your case, the only one you are attempting to use and install Moodle code into.

'spirit of sharing', Ken


In reply to Ken Task

Re: Post-install questions and Installation guides confusion

by tasty minerals -

After modifying the /etc/hosts file as you proposed I was finally able to reach 127.0.0.1

So, now, if I try 

w3m 127.0.0.1

as well as 

w3m http://lsd.test.de 

I am able to access the moodle page.

Here is the contents of my /etc/hosts file.

127.0.0.1	localhost
127.0.1.1 lsd.test.de lsd
PUBLICADDRESS lsd.test.de lsd


As for /etc/apache2/apache.conf file, looks like it is autogenerated (by admin software) and modifying it won't make sense, besides there is no "DocumentRoot" in it.

One thing though, how can I make it available from outside, say my current laptop? Obviously something like firefox http://lsd.test.de won't work. 

In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Ken Task -
Picture of Particularly helpful Moodlers

You are close ...

Where is moodledata directory?

From what you've shown I'd advise manually creating a moodledata directory in /var/www/

That's Apache app root (kinda like a users home directory) that runs under www-data user/group.

cd /var/www/

mkdir moodledata

chown www-data:www-data moodledata

chmod ugo+rwx moodledata -R

Then in the config.php file for Moodle, point the path to

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

IF you run the installer right now using http://localhost/ or http://PRIVATEIP/ Moodle will use that in serveral tables of the DB so when attempting to get the public internet to see it and work, one will have to run the search and replace in Moodle.

Found it best to actually begin the entire process by getting a true DNS entry for the Moodle server.

That can be cheated upon by using the host file.

Thus from a browser ON the server, http://FQDN/

Can't use a workstation unless to edit it's host file and add the IP address -> FQDN Shortname to the workstations host file.

The host file edits you made ... did you literally use "PUBLICIPADDRESS" or did you use a true IP address 192.168.0.20 or what it will be as seen on the local private lan OR what the public IP to private IP address firewall mapping will be?

For this moodle to be seen by the FQDN you've chosen: lsd.test.de

test.de is a domain you own?

Thus you could in DNS add a host lsd.test.de.

Right now I see:

test.de.        600    IN    A    104.45.6.189

which is a domain/IP address owned by Microsoft.   You work for Microsoft?

'spirit of sharing', Ken


In reply to Ken Task

Re: Post-install questions and Installation guides confusion

by tasty minerals -

First, I don't work for Microsoft, "lsd.test.de" is something I use as an example here, because the real URL is different.

Yes, I literally used PUBLICADDRESS in hosts, as I said, I have no idea what this means because I have pretty limited knowledge of the server side business.

My task is, asap set up a Moodle web site for the person who runs the course. The students should be able to access the site and submit homework only, pretty simple. I found the Moodle docs here and attempted to set up a Moodle web site.

My moodledata is in "/home/lsd/moodledata", I don't own any domains and use a machine provided by the institution admins the way they set it up. If making the Moodle site accessible for students requires owing a domain name, then this is certainly out of my jurisdiction. I am just asking because I naively thought that setting up Moodle server and giving it an arbitrary website name would work. 

In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by Ken Task -
Picture of Particularly helpful Moodlers

Understood.   Sometimes, using fake names, IP adresses , etc. are necessary.  But suggest, next time, mention that up front.   I'll make sure the next time, I also warn that things like PUBLICADDRESS are explained.   Would xxx.xxx.xxx.xxx have been better if I had said that the 'x's' are the IP address numbers?

Now about the location of moodledata ... that's outside of apache root.   While that could be done that way, is there a reason to do so?   Is there going to be an 'lsd' user whose home directory is /home/lsd/?

If so, advise not.   moodledata will contain filedir which is Moodles new file system and according to the readme.txt file found in that directory after installation, it warns NOT to mess with anything in there.  If one does, better know what one is doing.

So ... still suggest moving moodledata to apache root and setting ownerships/permissions on it and all it's contents to www-data:www-data.

Yep,  before installing suggest getting whomever is going to use it, to setup a true fully qualified domain name for the server.   It will make installation and first usage/development of courses, etc. sooooo much easier when the site is finally opened to student/teacher use.   Other open sourced packages/apps don't have the FQDN requirement that Moodle does ... Moodle doesn't use 'relative addressing' as a Joomla, WordPress, or a Drupal, etc. does.   Actually, that requirement, does make Moodle a little more secure.

'spirit of sharing', Ken


In reply to tasty minerals

Re: Post-install questions and Installation guides confusion

by tasty minerals -

Thank you everyone for help and patience smile

I shall take notes for the next time.