How to ensure I "own" everything -Ubuntu Moodle install

How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Number of replies: 58
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

With the help of Howard, Visvanath and the docs I have got as far as installing Ubuntu 13.10 on my laptop and getting to the Moodle installation screen. However I have tried several times and cannot get beyond the database details because of some problems with (apparently) the folders being writeable. First I got a message saying the config.php file couldn't be created because the Moodle directory wasn't writeable - I pasted the details as requested but just got a blank page when moving on to the next stage. Then I tried again but got a blank screen. When I went manually to the config.php file to look inside it, it now tells me I am not allowed to open it because I am  not the owner of it! For heaven's sake - this is as bad as Windows angry Please: how do I ensure I have all permissions on the Moodle directory, Moodledata directory, config.php file and anything else I might need? 

Average of ratings: -
In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

Personally, I've never used the installation facility that creates config.php. I just copy config-dist.php to config.php, edit it and put in my details. If it's your 'test' setup, you probably also want to go down to section 7 and uncomment some items there (e.g. force debugging on). 

Again, assuming it's just your private setup, you will most likely have created the directories as the superuser, but it's not important. You won't have created them as the web server user. So, the following is reasonably foolproof. 

sudo chown -R mary:mary /path/to/moodle
sudo chmod -R 0755 /path/to/moodle
sudo chmod -R 0777 /path/to/moodledata

so... 1. change your Moodle code directory to your ownership so you can manipulate it without sudo in future. 2. Change its permissions so you have write access and everybody else has read. 3. Make the moodledata area writeable by everyone. 

That should be it. 

If you are still getting a blank screen then its something else, but forcing debugging in config.php should help with that. 

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

So how do I know it has done that? I mean, it doesn't seem to say anything in the terminal but nor does it protest. My new Moodle is a directory called moodle in var/www by the way, and moodledata is a directory called moodledata in /var so I therefore typed

sudo chown -R mary:mary /var/www/moodle
sudo chmod -R 0755 /var/www/moodle
sudo chmod -R 0777 /var/moodledata 

Is this right?

but when I tried to install from the browser (having deleted the previous config.php file) I got once again the red message about the moodle directory not being writeable. So -again I copied the text to make a new config.php, hit next and got a blank screen. So...where do I look for error messages?

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by John Andrewartha -

I have watched this thread go back and forth for days sad

The directory /var/www  is the htdoc or web root, it and all sub directory’s should be owned by the web server.  As Ubunto is derived from Debian the web owner is ( I hope) www-data, thus the /var/www/moodle should be that.  CLI chown -R www-data:www-data /var/www/moodle  [enter] if it's wrong and it will be the owner it will tell you if OK it just returns to the shell.

Do the same on /var/moodledata.

It should now work.  If not then second string,

chmod -R a+r /var/www/moodle

chmod -R a+rw /var/moodledata

This is less secure but on a closed box is less important.

The basics are you need to let the web server read the moodle/* directory, remember the web server is another user and need permission to read and write to things it does not own.

Don't forget to prepend sudo to these commands.

In reply to John Andrewartha

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Ah (just edited this post) I have seen Visvanath's reply as well as Jon's. I will go and try a few thing and then get back with more information. You are all very kind.smile

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Does this have any bearing? This is what I see as default in my terminal:

mary@mary-ubuntu:~$

Would this affect what commands I type in?

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Visvanath: I first upgraded my laptop from 12.4 to 13.10 using a DVD I got from a Linux magazine. Mine is "standalone" to answer your question. Just a test Moodle dev on my own laptop, offline. I then went through your page http://www.syndrega.ch/?p=33 and http://www.syndrega.ch/?p=33 And yes I am stuck at number 4. I have tried typing in both your and Jon's (and Howard's!) sudo  chown www-data /var/moodledata  andsudo chown www-data /var/moodle  aand various variations suggested by all but still no luck. Also -when I look at my folders I see a lock on the moodle directory ( which I presume means I don't own it) and inside it there is a config.php which I can no  longer delete because it says I am not its owner. Currently therefore I am stuck on http://localhost/moodle/admin/index.php which is a blank page. I don't know how to get back and start again.

So I seem no furthersad

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Mary

I wish Howard foresaw your (?) destiny. That would have definitely lightened your spirit. (Or not.)
;-P

OK, now to recapitulate:
- You have Ubuntu 13.10 running natively (no virtualization) on your laptop.

Could you tell us whether it is Ubuntu Server http://www.ubuntu.com/server (no GUI) or a desktop version http://www.ubuntu.com/desktop (with GUI)?

- This Ubuntu is not connected to any network.

Then it is the "stand alone" version as discussed in http://www.syndrega.ch/?p=14.

Now to the question you raised earlier:
> This is what I see as default in my terminal:
> mary@mary-ubuntu:~$
> Would this affect what commands I type in?

Yes. Commands you type in will be processed with ownership and the rights of user 'mary'. For administrative tasks like installing/configuring/restarting webserver you need administrator privileges. For this, there are two schools of thinking. The old school people either login as a user called 'root' or be super user by running 'su -'. The big problem with that is you have to remember a second password, the password of the user 'root'. For the new school that is too much. There the system is configured for "sudo" (super user do) http://linux.about.com/od/commands/l/blcmdl8_sudo.htm. You prepend all commands which should run as super user with the word 'sudo'. The system will then ask for your (mary's) password. The problem of remembering a second password is solved.

I personally don't like 'sudo' in front of every command. It may sound important, but just don't carry any information and hides the primary command which comes in the second place. My suggested method for sudo systems are described under "2. Conventions" in http://www.syndrega.ch/?p=8.

Therefore I am wondering whether you are following my instructions at all. Because then you will see just the pound sign (#) as your prompt. (Not that everything else is wrong, you just can't go in two directions.)
In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mark Hayes -

mary@mary-ubuntu:~$

this is the command prompt.
it indicates that user=mary, on host=mary-ubuntu, is presently in her home directory (indicated by the ~). the dollar sign is the prompt.

you home directory is probably = /home/mary

In reply to John Andrewartha

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

"The directory /var/www  is the htdoc or web root, it and all sub directory’s should be owned by the web server"

Wrong, wrong, wrong, wrong. Did I mention "wrong"? You just created a security hole of epic proportions there. They should specifically NOT be owned by the web server user as this user has no business with these directories. It only needs the very minimum permissions to read the files there and this can be achieved with them owned by root or (if it's a one-user machine) the main user. The web server user has 'read only' permissions by virtue of being an 'other' user. Minimum required rights. 

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
John

I agree with Howard. For Mary's second laptop which is not going to be networked, it does not matter. But the problem is, the whole world reads these posts. People may, without realizing the context, follow these instructions (remember cut-and-paste Unix!) and the whole thing back fires. Often the blame goes not to an individual but they'll say Moodle is a security menace!
In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Visvanth, to answer your question: it is Ubuntu desktop. I thought it might be easier if I show  some screenshots of what I have been trying, based on links provided. 

Screenshot 1:

 Screenshot 2:

After that I run the installer from the browser and I get 

Screenshot 3:

So I manually create a config.php file and then when I try again I get a blank screen . If I navigate to the course/index.php page just out of curiosity, I get

Screenshot 4

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Mary

Obviously you are not following my instructions.
sad

Let's repeat what you've said:
> $ sudo -s
> ..
> #
Where did I say that? http://www.syndrega.ch/?p=8 says, "sudo -i". OK, you can get away with that, because for your setup there is no difference.

> # chown -R mary:mary /var/www/moodle
> # chmod -R 0755 /var/www/moodle
> # chmod -R 0777 /var/moodledata
Where did you get them from? Show me the section in http://www.syndrega.ch/?p=38.

> # chown www-data /var/moodledata
More likely.

> # chown www-data /var/www/moodle
Didn't you hear Howard https://moodle.org/mod/forum/discuss.php?d=246408#p1069129 ?

> Configuration completed
> Moodle made an attempt to save your configuration ...
This is something new. We were talking of "moodledata not writable" all this time, grrr!

> So I manually create a config.php file and ...
How exactly?

> then when I try again I get a blank screen.
What is in config.php? ("cat /var/www/moodle/config.php") Can the webserver see it? ("ls -l /var/www/moodle/config.php")

Moral 1: Just cut-and-paste error messages into the forum, don't interpret them!

Moral 2: Cut-and-paste Unix commands from your terminal in to the forum (inline text), spare the explanations!
In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Sorryblush Actually, I did try sudo -i at first but it didn't accept my password so I googled something else. However, I have just tried again and it did accept it and here is my latest screenshot:

My moodledata directory is in var/moodledata and my Moodle directory is in var/www..

> Configuration completed
> Moodle made an attempt to save your configuration ...

This is something new. We were talking of "moodledata not writable" all this time!

Sorry if I did not make this clear in that first post of this thread; I hoped that I had.

> So I manually create a config.php file

I copy the config.dist.php file. I remove everything in it and then paste into it the contents of the page in the screenshot. I then save it renamed as config.php. I have just tried your cat /var/www/moodle/config.php and it shows me the contents which I pasted in, from the installer screen, with my database and other details. 

Then when I type ls -l /var/www/moodle/config.php I see

root@mary-ubuntu:~# ls -l /var/www/moodle/config.php
-rw-r----- 1 www-data www-data 696 Dec 29 20:39 /var/www/moodle/config.php
root@mary-ubuntu:~# ^C
root@mary-ubuntu:~#

And in the browser, on the page http://localhost/moodle/admin/index.php?lang=en I have a blank page.

 

 

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Mary

>>> Configuration completed
>>> Moodle made an attempt to save your configuration ...
>> This is something new. We were talking of "moodledata not writable" all this time!
> Sorry if I did not make this clear in that first post of this thread; I hoped that I had.

You are right. The moodledata story was in the previous thread. I didn't make the switch.

> I have just tried your cat /var/www/moodle/config.php and it shows me the contents which I pasted in, from the installer screen, with my database and other details.
> root@mary-ubuntu:~# ls -l /var/www/moodle/config.php
> -rw-r----- 1 www-data www-data 696 Dec 29 20:39 /var/www/moodle/config.php

We can leave the Unix pirouettes at that and concentrate on:
> And in the browser, on the page http://localhost/moodle/admin/index.php?lang=en I have a blank page.
- http://docs.moodle.org/en/Installation_FAQ#Why_are_all_my_pages_blank.3F
- http://docs.moodle.org/en/Debugging
In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Well here I am again, one day on, and no furthersad I added  phpinfo(); to my config.php file and sure enough got the page of PHP info - not sure how I know whether I have anything missing or not

 

Then I removed that and added the debugging code in http://docs.moodle.org/en/Debugging to the config.php but I just got a blank page as before -I just pasted the code in; didn't do anything else. Are the pages then supposed to display errors?

My last hope is to delete the moodle folder and the moodledata folder and try again. Whether I should also delete the apache server and database too and then start again,  I don't know. But I am very demoralised.

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

Check your web server error log! Generate the blank page and then do this immediately...

tail -n 10 /var/log/apache2/error_log

...this simply prints the last 10 lines. Anything?

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Well... from the terminal it told me 

tail -n 10 /var/log/apache2/error_log
tail: cannot open ‘/var/log/apache2/error_log’ for reading: No such file or directory 

then I went directly to that directory and found it is called error.log (so that works)

[Mon Dec 30 21:59:16.782862 2013] [:error] [pid 1472] [client 127.0.0.1:40030] PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /var/www/moodle/config.php on line 3
[Mon Dec 30 21:59:16.855766 2013] [:error] [pid 1472] [client 127.0.0.1:40030] PHP Warning: Creating default object from empty value in /var/www/moodle/config.php on line 4
[Mon Dec 30 21:59:56.860221 2013] [:error] [pid 1474] [client 127.0.0.1:40033] PHP Warning: Creating default object from empty value in /var/www/moodle/config.php on line 4
[Mon Dec 30 21:59:56.947634 2013] [:error] [pid 1474] [client 127.0.0.1:40033] PHP Warning: Creating default object from empty value in /var/www/moodle/config.php on line 4
[Mon Dec 30 21:59:59.726906 2013] [:error] [pid 1475] [client 127.0.0.1:40034] PHP Warning: Creating default object from empty value in /var/www/moodle/config.php on line 4

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Mary

Have "tail -f /var/log/apache2/error.log" going in a terminal and visit your Moodle with the browser. Have them both in window mode (not full screen) and next to each other.

Those PHP Warnings are usually harmless, yet with all the latest system software, specially PHP 5.5 and Apache 2.4 in Ubuntu 13.10, Modle 2.7dev should not generate too many warnings.

Don't go back to the beginning, press from here!

You have slightly less than 24 hours to elevate your morals (assuming you are not too far from Greenwich).
smile
In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

Something worries me here. As I say, I always create config.php from config-dist.php but even if Moodle creates the config.php file I don't think you should get those warnings. Can we see your config.php file contents (assuming it is short)? I have a feeling something might be wrong.

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Mary

I too think that config.php is seriously brocken.

You never said, how you manipulate text files in Unix. I hope you use a "real" text editor (not as on moodle.org https://moodle.org/mod/forum/discuss.php?d=226174 !). Paste a screen-shot of you editing config.php and attach the whole file in your next post. (You can screen the password, everything else reveals nothing, it is your localhost and is pretty standard.)
In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Ok attached - I use gedit  -is that not OK? And I made a new Moodle (new moodledata directory and new database) with same results. 

 

Attachment Selection_166.png
In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

Ahh... those first two debug lines are in the wrong place. You see why? You set them without initialising $CFG (which causes the warnings). The $CFG global is 'created' in the three lines starting 'unset($CFG)'. So, all the lines before there are 'unset' and do nothing. Move them to immediately before 'require_once(dirname.....' near the end and you should be fine.

Also... you didn't get all the debugging lines. You want something like this...

@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!

This probably won't fix whatever the problem was, but at least debugging will now be working.

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Got itsmile - or at least, this is what /admin/index.php says

Fatal error: Call to undefined function json_decode() in /var/www/moodle/lib/outputrequirementslib.php on line 1796

Also.. note that here: http://docs.moodle.org/en/Debugging#What_to_do_if_you_cannot_get_to_the_admin_screens it doesn't actually tell you where to paste that code (and not  the extra code you suggested) so maybe someone needs to improve the docs wink

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
sudo apt-get install php5-json
sudo service apache2 restart

...and on to it wink

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Oh yes, the JSON interface came recently. I had my tutorial updated though:
===
3.b PHP Modules
; All versions of Moodle need the following two modules
# apt-get install php5-gd php5-mysql
; Since version 2.0 Moodle needs the following additional modules
# apt-get install php5-curl php5-xmlrpc php5-intl php5-json
===
http://www.syndrega.ch/?p=33
In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Mary and Howard

It is still unclear why pre-installation test-page did not detect the missing PHP module?

And http://docs.moodle.org/26/en/Step-by-step_Installation_Guide_for_Ubuntu does _not_ mention php5-json. ?
In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

Good question...

admin/environment.xml:

      <PHP_EXTENSION name="json" level="required">

      </PHP_EXTENSION>

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

OMG I now have a Moodlebig grin

The  proof is below... Howard; you are a star, and so are you a star  Visvanath - and it got done within the 24 hours before the end of the yearbig grin

Thanks so much.

 


 

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

Thank God for that... I can go back to bed now big grin big grin big grin

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Are you sure?

Just grabbed ubuntu-13.10-desktop-i386.iso and went through the torture in VirtualBox. (On this very fast laptop, with 1 GB RAM for the VM it felt like molasses.Unity icons fading and glowing in slow-motion.)

Got Moodle latest with Git, 2.7dev (Build: 20131224), finally the browser install routinge brings, "Error: database driver problem deteted ... Please check your php.ini file or recompile PHP. MySQLi extension is not available for PHP 4." (no typo!)

Whereas phpinfo() clearly says, 'PHP Version 5.5.3-1ubuntu2.1" ???
(details as in http://www.syndrega.ch/?p=33 and http://www.syndrega.ch/?p=33 )

Morale: You don't own Ubuntu either!
In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

Had this just the other day and it went like this... https://moodle.org/mod/forum/discuss.php?d=227282

I am using 13.10 and 'localhost' and haven't had any problems at all. Not in a VM (native on my laptop) but that shouldn't matter.

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
It was my fault. After installing the additional php5-mods I haven't restarted Apache.

The discussion you referred to is weird. Glad that I don't have to dig into this Shuttleworth heritage.
In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
"Using Moodle", I mean the "English", is going to throw a big party!
;-(

Seriously, now you are confident that it works, repeat the exercise carefully comparing the notes http://www.syndrega.ch/?p=33 and http://www.syndrega.ch/?p=38 with what you see on the terminal taking your own notes. After three iterations, you'll repeat it in 15 min (well, not counting the time the machine screeching under Unity).

That can wait - the party first!
                      . 
|
\ * ./
. * * * .
-=* POP! *=-
. .* * * .
/ * .\
|
.

In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Yes- this evening, (when others are out partying for New Year) I will be at my laptop practising installing Moodlesmile (Actually, I genuinely will!smile)

In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

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 sound like a candidate for http://www.linuxmint.com/

In reply to Howard Miller

Linux distributions [OT}

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Howard

I know Linux Mint http://distrowatch.com/table.php?distribution=mint. That is what I suggest too (as a desktop) for people with medium to good machines. I have installed Mint with and for many people, I tend to prefer the Cinnamon flavour. Mint serves the purpose well, and the no, 1 in http://distrowatch.com ranking for years, I think. The only downside is the quick release cycle. People believe that they need the latest and the shiniest on the screen and tend to break things. (Heard of that before? ;)

No, I embraced CrunchBang http://distrowatch.com/table.php?distribution=crunchbang some years ago as the desktop, getting more and more convinced each day. It simply works, I want my desktop out of the way. (And I won't give up my Conky and OpenBox for anything on earth.) Crunchbang is a "rolling" distro and minmal in graphics. On this powerful laptop, Intel i5 M540, 4 core 8 threads @ 2.53GHz (!), 8 GB RAM and SSD, it flies. I have plenty of power for dozens of different VMs, not only Linux. (Well, not all at the same time.)

My standard server OS is of course Debian. Once upon time both the desktop and the server were Slackware. The path from there to today is too long and too winding to explain here.

BTW, I see, another discussion on Linux distributions brewing. Prepared the title, just in case this sub-thread go further OT. (Believe me, there are people who play with their Ubuntus rather than joining the Sylvester Party. ;-P )
In reply to Visvanath Ratnaweera

Re: Linux distributions [OT}

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
For those who are interested in the recent history (and turbulences) of Linux, highly recommended: "Why Linux sucks" and "Why Linux Doesn't Suck" by Bryan Lunduke. (search for them in YouTube).

Disclaimer: Only for geeks! Don't tell I me I owe you precious minutes of your life!

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Congratulations, Mary.  I have been following your struggles, wondering if you would make it.  This forum topic is one that I will want to save for reference later (if I ever try to do this).

 

In reply to Rick Jerz

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Rick

The nice thing about the kind of "open paths" we are discussing, each individual finds his own path. Since you have encountered vi 25 years ago, your's is going to be entirely different.
smile

I'm curious to what that be. I will post later a few more ideas in the sub-thread following https://moodle.org/mod/forum/discuss.php?d=246408#p1069107.
In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Visvanath, in UNIX, I use "nano", but your post made me wonder if there is a better text editor that you recommend.

In reply to Rick Jerz

Editor Wars [OT}

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Rick

Nobody goes to the party. (Or is this the party?)

Whatever. Editor wars is a sensitive one. OK, we are not talking of Emacs vs. Vi fights of those days.
- http://peabody.weeman.org/editor_wars.html
- http://www.fact-index.com/e/ed/editor_war.html
etc.

BTW, read "A text editor is a piece of computer software for editing plain text" http://www.fact-index.com/t/te/text_editor.html. That's why I go nuts, when our Moodle community calls TinyMCE a "text editor" arguit that "To them, Moodle's TinyMCE editor IS a text editor" https://moodle.org/mod/forum/discuss.php?d=226174#p982143
sad

Back to your question: There is a whole series of text editors called nano, pico, etc. which borrows the concept of control keys from https://en.wikipedia.org/wiki/Pine_%28email_client%29, which borrowed from https://en.wikipedia.org/wiki/Elm_%28email_client%29, and so forth.

The Vi, Vi(M) school uses (mostly) ordinary keys as control keys depending on the mode the editor is in. If you master them, there is a huge increase in productivity because you don't raise your fingers from the keyboard to reach control keys, meta keys, function keys, etc. (I assume you type text - code, markup - most of the time.) But if you are not a friend of this editor jumping from one mode to the other, you'll go crazy.

You can give a try to Vi(M) with a good tutorial, if you want to explore.
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Editor Wars [OT}

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Visvanath, I used the old vi editor around 25 years ago.  I might have to take a look at it again.  nano seems to come with some hosted and virtual servers, and it seems ok.

Thanks much.

In reply to Rick Jerz

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

The feeling seems to be that you should know either Vi(m) or Emacs. I'm a Vim man myself. To be honest, I've never met anybody who uses Emacs.

On your machine you can do whatever you like. But in my world I need to know an editor that I am 100% guaranteed to find on any old Unix box I happen to be lumbered with. I doubt you'll have nano on command-line Solaris for example.

Average of ratings: Useful (1)
In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Yes, I know what you mean Howard.  I am going to go back and review vi.  

In reply to Howard Miller

Editor Wars [OT]

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Now it occurs to me that talking about the text editor, or anything else for that matter, is useless unless you know for whom! Here it is, for Unix text editors, starting at the bottom end:

- A person who wants try out Linux, possibly under "pressure", possibly one-time, for himself
There is nano in almost all major distributions! Or even GUI based editors gedit, geany, etc. (if that Linux is a desktop).

- Same thing as above with the exception that it is going to be repetitive and/or there are others using that (those) Linux. The person is on Windows or Mac and interact with Linux through "PuTTY"
He can manage with a suitable editor in his (Windows or Mac) desktop, up/downloading the text files to the Linux.

As the work load increases, Vi(M) will start to pay. Because you will work more and more in text files, and through Vi(M) you can automate many repetitive tasks. Also you spare the hassle of up/downloading files.

- Same thing but you are not limited to mainstream Linux, i.e. exotic Linux distributions or other Unixodes
You can't depend on nano. Some come even without the classical vi, you need to know a bid of ex! But then these people have a different question.

- People who have discovered the power of the command line and intuitively stay there
These are the people who waged the Emacs vs. Vi war. Then again, you can't convince them, for anything.

- (there are more)
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Editor Wars [OT]

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Excellent summary!

I have to admit that I am at the "nano" stage.  Nano seemed quick and easy, but I do know that it is not as powerful as vi, vim, or Emacs.  However, for doing the things that I do with Moodle, nano seems fine.  When you get more into the guts of Linux (as you, Howard, and Ken do), then a more powerful editor can be advantageous.  Someday, I might be there!

Thanks.

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Mary

Before we continue, I just want to make sure that we stand in the same place. You started at http://www.syndrega.ch/?p=14. Experienced no problems and continued to http://www.syndrega.ch/?p=33, again without any problem. Right?

One side information: Those instructions talk of three possible network configurations which I call 'stand alone', 'LAN only' and 'Internet'. Which one applies to you?

You are now at the step "4. Initialize Moodle" in http://www.syndrega.ch/?p=38 and on the browser you get moodledata is not writable, correct?

Then you must have missed an earlier step. For example:
===
2. Setup the moodledata directory
For file uploads Moodle needs a writable directory outside the Apache DocumentRoot.
# mkdir /var/moodledata
# chown www-data /var/moodledata
===

Did you follow that?

The reason is a difficult to explain without an understanding of the file permissions of Unix. That is why I always say, Unix commands are not for cut-and-paste. The permissions are not a big deal, see eg. http://www.guru99.com/file-permissions.html. The difficulty comes from the fact that there are many possible solutions. The one I propose in the tutorial above are different from what Howard is following. You have to stick to one.

An added difficulty is to understand it is not _you_ who uploads files in to moodledata, it is the webserver! The webserver runs as a different user. That user is usually called "www-data" in Debian-based systems.
In reply to Visvanath Ratnaweera

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

+1

It's essential to understand how Linux/Unix's file permissions system works and what the basic commands do. It's a very good investment in time otherwise you will be terminally confused. And, as has been said, everybody has a slightly different way of doing things plus it depends on the prevailing circumstances. 

The thing to remember is that on Ubuntu the 'moodledata' files are 'written' by a user called www-data so that user has to be able to write in that area. The same user reads the files in your /var/www/moodle (say) area but should never be able to write. The normal setup is to have them 'owned' by someone else (e.g. you) and readable by everyone (there is no security issue in reading Moodle files)... blah blah. Anyway, point is to have control of your destiny this is the one area that you really need to understand. 

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Anyway, point is to have control of your destiny-  this is the one area that you really need to understand.

Yes - and  on a scale larger than just understanding ownerships, I guess this is why I am persevering with what currently seem insurmountably frustrating issues - so that one day (hopefully in 2014!) I will  be able to look after myself and know what I am doingsmile

In reply to Mary Cooch

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Ken Task -
Picture of Particularly helpful Moodlers

First, congrats!  Know what it's like to be a non-computer sci (instructional ed tech type) and take on the task (no pun intended) of installing an open sourced app on a Linux platform.  Frustrating at first, but with time, trial and error, and a little help from friends, success!   And what a sense of accomplishment you must now feel ... and something to add to a profile/etc..   Pass that experience along to your students as well for their world may not be all PC in the near future (uhhh, the future is already here, BTW).

Now an idea ... as anyone ever thought to provide a script (yes, to be run from the command line - no php) that would check for existence of apache/mysql/php + offer to install any/all of those parts of AMP from the distro's own repo's + install git + install Moodle via git ... not only Ubuntu, but RH flavored boxen?

Yes, I know there are docs and resources on internet ... but haven't seen any CL script.

What could be simpler:

apt-get install wget git nano  or yum -y install wget git nano

cd /var/www/html/ (or /var/www

wget http:site/installmoodle.zip

unzip installmoodle.zip

Read the readme from the extracted zip

edit script with nano for a few parameters (covered in the readme) - save script

run script: source installmoodle [ENTER]

Just thinking out loud! ;)

'spirit of sharing', Ken

In reply to Ken Task

Re: How to ensure I "own" everything -Ubuntu Moodle install

by John Andrewartha -

Here you are Ken, a copy of the FreeBSD Makefile for Moodle.  It does all the version checking and goes out and gets the package.

Maybe a starting point?

 

BTW it's for a older version of Moodle.

In reply to Ken Task

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

Who will maintain it? wink

This just takes us down the road of all the other 'magic' install scripts that result in a Moodle that can't be supported and won't upgrade. The pain of understanding how you did it is well worth it IMO. Moodle is dead easy to install, understanding the operating system enough to do it often isn't. However, Moodle is a server-based application so that's inevitable. 

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Ken Task -
Picture of Particularly helpful Moodlers

Maintain?!!!   One time offer ... as is. ;)  And limited to 'standard/stock', CentOS, Ubuntu, maybe even Debian boxen (separate scripts: installmoodle-c, installmoodle-u, installmoodle-d)

And we're not talking anything elaborate.  If one were to read the docs, one could build such a script ... that's what I'm talking about.   Would use the native OS Linux repo for acquiring apache/mysql/php (IF needed).   Would acquire git and nano as well.   The script I have in mind would install Moodle code via git from the Moodle git repo.

Don't think shared/remotely hosted systems would allow customers to run such shell scripts.  But for those taking that next step, the script alone would be educational.

@John ... thanks ... gives me something to study.

@Visvanath ... wasn't talking about those infamous scripting thangs nor any repo other than the official Moodle git repo.

I've often wondered why the .zip/.tar.gz of the downloads didn't include the .git directory for that version.  Yes, it would make the download larger, but it would be a 'step or two' saver.

Think I'll work on a CentOS version and share it.

'spirit of sharing', Ken

In reply to Ken Task

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

It would make it a LOT larger. And I don't think that's the way you should be using git anyway...

In reply to Howard Miller

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, you've aroused my curiosity ... how should one be using git then?  Granted git really for developers but why couldn't beginners (ready for that next step) use it to install the code?

'spirit of sharing', Ken

In reply to Ken Task

Re: How to ensure I "own" everything -Ubuntu Moodle install

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

Although git was never meant for deployment, it turns out that it is surprisingly useful for just that. It makes it so much easier to deal with upgrades (at least on the same branch).

I don't see the benefit in distributing whole git archives in zips - even as an option. Getting 'git clone' to work for yourself is the first step to proving you have a git setup that works and the required connectivity. I feel it would be another example of giving people more help than is good for them wink

 

In reply to Ken Task

Re: How to ensure I "own" everything -Ubuntu Moodle install

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Ken

Glad to notice that our New Year's Eve stunt has longer repercussions.
wink

Your suggestion sounds tempting but has two fundamental flaws:
1. As Howard already mentioned, who is going to maintain. We don't need another 'Debian based Linux: Ban "apt-get install moodle"!' https://moodle.org/mod/forum/discuss.php?d=196512, do we?

2. It goes against the wisdom above, "point is to have control of your destiny- this is the one area that you really need to understand" ®.

Putting it in another way: The goal is the way!

Otherwise we'll go the same way Windows went. Packages installation: Joy, if "it works". Doomed, if not.

On a practical level, what about the parameterization? What if the person needs a different version of MySQL? PHP? Moodle? My set of instructions were originally written for _any_ Moodle version from 1.6 to 2.3dev on Debian stable. Only recently I have modified it to Moodle 1.9 to 2.7dev.