New Moodle CentOS install

Re: New Moodle CentOS install

by Ken Task -
Number of replies: 15
Picture of Particularly helpful Moodlers

Must be a Hyper-V thang .... but never heard of installing CentOS from a .rar file.   

From where did you obtain the .rar file?   And what did the .rar file contain?

You probably need to compare what you did to this:

https://www.altaro.com/hyper-v/centos-linux-hyper-v/

First things first before attempting to jump into Moodle or even domain decision.

Serve on the network with static IP address?   Can you ssh to it from a work station using Putty or Mac Terminal?

Apache, PHP, and MySQL/MariaDB.

So get Apache up to show a 'welcome' screen and check access to the server via https://IPaddress ... even though your browser will complain about the site not being secure .... which is true ... no valid cert from a CA.   At this stage you are just interested in making sure apache responds to https:// request.   The cert you can acquire later.   This means port 80 and 443 (the port used via https) are open.

Is Apache installed?   Doesn't like it if no /var/www/ directory is there.  CentOS 7 is Linux Standards Base so even Ubuntu 16.06 (also LSB) has /var/www/

Is there a /etc/httpd/ directory?

'spirit of sharing', Ken

In reply to Ken Task

Re: New Moodle CentOS install

by Jamie Tinley -

Thanks Ken and Emma

back to my CentOS installation issue finally.  I used nginx not apache.  It says welcome to nginx fine if I type 127.0.0.1 or localhost  but if I try to go to moodle/admin/cli/install.php  I get a 404 error.  I tried a putting a test.php file everywhere I could think of but all locations fail.  It actually does see it but tries to download it instead of display it making me think my PHP is not talking to Nginx.  

I will try to get a static address this week.  I want to ditch the https just to get it to work. the link I followed with it's own moodle.conf it here.

The files I'm trying to edit to make it work
      /etc/nginx/conf.d/moodle.conf
       /etc/nginx/nginx.conf
      /var/www/moodle/config.php

One clue I have is I read fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  What this line does is tell PHP which file it should execute, without this nginx and PHP cannot work together. 
I'm getting 403 error:  "403" is actually an HTTP status code that means that the web server has received and understood your request, but that it cannot take any further action
I'm not sure what the difference btwn fast_param and fastcgi or if those matter. 

In reply to Jamie Tinley

Re: New Moodle CentOS install

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

Have you looked at this? https://docs.moodle.org/34/en/Nginx - I haven't run Moodle through nginx but have used it for other servers - someone else might know some more but I can't help thinking that the page you are using is perhaps overcomplicated.  Now that you say you have been messing with the configuration - it will hard to track down what piece you are missing.  It might help our nginx experts if you shared your config files (with sensitive info blacked out of course..)

 

In reply to Jamie Tinley

Re: New Moodle CentOS install

by Ken Task -
Picture of Particularly helpful Moodlers

When you say "try to go to moodle/admin/cli/install.php" do you mean with a browser ... remotely?

Uhhh ... any 'cli' directory in moodle code is meant for 'command line' usage - only - and is restricted to command line only ... attempting access with a browser should inform you that one can use command line only.

Using apache as server, here's what that attempted access would show:

"Command line scripts can not be executed from the web interface"

would/should be the same with nginx, I would think.

IF attempting to install via web, url would be http(s)://yoursite/install.php

As far as config of nginx ... https://docs.moodle.org/34/en/Nginx

Don't run nginx myself, but thought if the site was to host just a Moodle and no other software/sites, one couldn't need to configure/use a moodle.conf file as moodle code would reside in the document root as defined by nginx config.

So ... have to ask ... what docs were you reading?

'spirit of sharing', Ken



In reply to Jamie Tinley

Re: New Moodle CentOS install

by Ken Task -
Picture of Particularly helpful Moodlers

2 more 'sense' ... nope ... said it right ...

So your virtualized CentOS is on an X  box of some sort ...  and right now it does not have a statically assigned IP address ... nor a FQDN ... nor a valid Certificate from a CA.

If you rebooted the CentOS from CentOS command line, does it come back up?   And, more importantly, does it get the same IP address?

I know docs don't say this but ... IF you know you will be using this server, I'd start with acquiring a static IP address.  A FQDN for server that will resolve both internally (private network) and externally (public IP addresses).

That way ... when you install from scratch, one doesn't have to move forward 2 only to have to go back 1 ... or 2.

One is not using an IP address(s) ... which, if you reboot the CentOS and the IP address it got the first time from a DHCP server didn't set the lease of that IP for a long time, your server has a different IP ... now you're going backwards ... network wise ... and have to adjust your Moodle again.

Then in CentOS, with a static IP address, one cant edit /etc/hosts and give the server the FQDN it will have ... as in DNS.

Now you can use the FQDN all the time.

Running https ... the tutorial you followed used self-generated .key and .crt.    That would force FireFox to whoopie and you have to make an exception to access the site by https (not secure, FF knows a selfsigned when it sees it).   That's another one of those 1 step forward ... 1 step back kinda things.

Now in order to get a valid CA the server has to be running something on port 80 (just a Welcome page is ok) AND it has to be accessible from the outside world ... CA can't talk to it, then it won't work.

So all in all, think we're trying to drive the cart (nginx/Moodle) before we've done anything with the horse (VirtOS, CentOS, etc.) ... so to speak.

Ok, it was really 4 cents! smile

'spirit of sharing', Ken


In reply to Ken Task

Re: New Moodle CentOS install

by Jamie Tinley -

Thank you Ken and Emma.  Your insight helped me realize I was getting no where likely due to it being DHCP and me not knowing enough about Cent0S.  My hats off to you Cent0S people but after wasting time for 4 months I finally went back to Ubuntu and installed it all in 1 day! Thanks for helping me realize I needed to re-think my life! smile

for anyone following, here's the links I used to optimize apache, mysql, php and install moodle. I followed most of them but used php 7.2 not 7.0 as in the tutorial.  The hardest part was getting my ip to work from an outside address which I did by correctly stating the address in wwwroot of config.php


 I installed Moodle using Ubuntu not Cent0S and followed these four links:

https://docs.moodle.org/34/en/Step-by-step_Installation_Guide_for_Ubuntu

https://thishosting.rocks/how-to-install-optimize-apache-ubuntu/

https://thishosting.rocks/install-mysql-mariadb-ubuntu/

https://thishosting.rocks/install-php-on-ubuntu/

Thanks again Ken and Emma!

In reply to Jamie Tinley

Re: New Moodle CentOS install

by Ken Task -
Picture of Particularly helpful Moodlers

Ubuntu is a safe bet ... much (if not about all) of Moodle docs addresses that distro first.

Confession ... my first 4 Linux server I wrecked in 1 weeks time, 2 weeks time, then a couple more servers later kept them for 4 weeks ... a record!!!!   Those were Fedora boxen.  But, from those 'experiences' and some more seeking, learned about 'long term support' and CentOS.

The key was finding the 'right' tutorial ... and learning the diff between keeping things simple and making them difficult ... which begins with that tutorial.

Make your next adventure into Cloud ... Amazon or Google Compute Engine. smile

Never ending ... always learning ... it's a journey.

Enjoy your Buntu box! ;)

'spirit of sharing', Ken


In reply to Ken Task

Re: New Moodle CentOS install

by Jamie Tinley -

Thanks again Ken, The cloud with Amazon and or google is now on my list of things to try at some point smile  would never go down like our school internet does! that would be a plus. thanks again smile

In reply to Jamie Tinley

Re: New Moodle CentOS install

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome.   But ... 'never go down'.   Uhhhh .... in a perfect networking world (which doesn't really exist in all situations) that would be true.   But ... let's say you have a Moodle instance on Amazon or Google Compute Engine.   It *might* be up, but the circuit that connects your school/campus isn't.   Ok, work-around for that ... tether your laptop/table top wireless connection to your smartphone ... now you are using that devices carrier ... in USA that could be AT&T, Verizon and the like ... but ooh so slow (depending upon smartphone networking - 3G forget it ... like the 'world wide wait' of old ... there's 4G and 5G ... and now yet another coming out.

But, how many devices/computers in your lab are wireless and will IT department at your school allow students to change their connection to their own smartphone ... wow ... class of 20 students and 20 wireless base stations (student phones).   Ok, how many computers could use just one smartphone connection?   Not like the digital circuits for your school/campus which are somewhere in the range of 10Gig on the low end and to 100Gig on higher end - that's per second - can't wait for fiber to the desktop myself! ;)   But then what workstations could keep up with the amount of data fiber could supply?

Then there is the other end ... the end point ... Google Compute Engine or Amazon.   While they do have zones and sites can be setup to replicate the content to other zones ... North America Chicago, North America D-FW, etc. can ya get there?  Think I read that if one restricts to only one zone, it's cheaper.

It's rare but it does happen ... may not be Google or Amazon but your server itself ... or a 'noisey neighbor' in that slice of GCP or Amazon's internal network.

Like I said ... it's a journey ... enjoy the ride!

'spirit of sharing', Ken

In reply to Ken Task

Re: New Moodle CentOS install

by Mr. Marc -

Thank you Ken your knowledge and posts and insights have been most helpful to our install and up grade thank you again.

In reply to Jamie Tinley

Re: New Moodle CentOS install

by Jerry Lau -

CentOS > Ubuntu ... imho... but glad you got it working...

In reply to Jerry Lau

Re: New Moodle CentOS install

by Ken Task -
Picture of Particularly helpful Moodlers

I agree ... have never heard of installing CentOS starting with a .rar file and that's really what might have cascaded into issues.

But ... at least it's a linux and not 'the other'! smile [even though on Azure].

'spirit of sharing', Ken


In reply to Jerry Lau

Re: New Moodle CentOS install

by Jamie Tinley -

I"ll try Cent0S again someday just not this year. 


Ken if I use one web address for my test server now then put a bunch of classes in by 1 of 3 ways either by 1 uploading courses by csv, 2 importing courses one by one as mbz, or 3 by migrating the database over and then switch the address in config.php to our production web address (and take the current one offline permanantly)


Will this cause issues?  I see that each site has a site identifier and that if I do the 3rd method I would need to run the script admin/clip/replace.php to fix the url in the database. Most of the plugins I"m not going to re-install in my new Moodle and I think having the teachers start over mostly fresh sometimes avoids headaches.  At least if I import their old courses then their content would be there for their new courses and I"m hoping changing it web address later won't matter if I do it by method 1 or 2.   

test address is http://moodlecwcs.waterford.k12.ca.us     production address is http://moodlex.waterford.k12.ca.us

If it's too much hassle I could just tell them all to use the new web address.  I plan on upgrading this way now back and forth so that I can be working on the next upgraded moodle while they work on the production moodle and then say at Dec and June each year I switch them all to the upgraded moodle.   I should have been able to just git update it  for a few years but that failed for me this summer when I tried to update from 3.0.10 to 3.3 but then php mysql etc all needed upgrading too so that was likely the problem that time.

Thanks

In reply to Jamie Tinley

Re: New Moodle CentOS install

by Ken Task -
Picture of Particularly helpful Moodlers

If I could predict the future (accurately), I wouldn't be doing what am doing now! smile

The methods one chooses to upgrade or use the latest/greatest (or one version behind) is really a matter of preferences of the true admin of the server.   What ever floats your  boat! ;)

For me, considering that, at present, coders/moodle using git to install, maintain/update, as well as upgrade, I'll choose that one - every time (prior to git, BTW, cvs was used). 

The site stays where it's at ... including the FQDN of the server ... it's only files/config that changes.  

And yes, you just happened to hit using git at a time when there were PHP upgrades to acquire and database config changes as well, so that did make it more difficult to sort out .. do at appropriate versions of the 'moodle march', etc..

Where ever possible, think in terms of server to server ... not download upload.

While requiring teachers to begin a new every year might cause some to review what worked and what didn't thus re-design their courses, others, may see that as just work and they'll do what they are allowed to do .. example: teacher knowing the future process, creates a backup and when the new server is up, they restore the backup.  Been there ... tired that ... version 1.9 backups to 2.2.highest worked for the most part but ....

Then again, if you work your tail off and restore no user backups of teacher courses for them, more power to ya ... still might have to hold some sessions to show them what's new.  Will teachers learn the new system as well?

Servers ... one could use virtual apaches on a beefy box ... prodmoodle.domain sits on same physical/or virtual server as development.domain.  I find that handy ... one can setup a 'universal file system repo' that's seen by both servers so one doesn't have to do download only to turn around and upload anything.   One's tweaks to PHP and DB server apply to both sites.   One would need enough space to handle the two moodledata dirs.  However, one could use the dev server to explore the use of a dedicated DB server ... or NFS (other) for not all but the largest dir's of moodledata.

The catch 22 would be like the last few versions of Moodle - 3.0.highest -> ... PHP to 7.0 or 7.1 ... DB to different character set/collation ... would mean can't have your dev and prod too far apart version wise.  But then again, one probably shouldn't be running a 3.0 any more .. no fixes for code nor security.

There's a college on the west coast ... they use the latest version of Moodle every year as their main site ... currently active ... host names are like; lms2014.tld, lms2015,tld, lms2016.tld, etc. etc.  So when their new academic year begins in 2018 they will be using whatever the highest version of Moodle is at that time.

Dunno if this response is an answer for you or not - probably not all of it ... just more food for thought! ;)

'spirit of sharing', Ken


In reply to Ken Task

Re: New Moodle CentOS install

by Jamie Tinley -

Thanks Ken, I like the idea of having prodmoodle and development on the same domain.  Do you have a link on that setup?  


So if I do change my url do I have to run the admin/cli/replace.php script to fix the database?  Or can I just change my url without worry when I'm ready for them to use the new moodle as the production site.  Again, I could force them to learn to switch back and forth for their web url after each upgrade.

Thanks


Jamie

In reply to Jamie Tinley

Re: New Moodle CentOS install - Now Ubuntu

by Ken Task -
Picture of Particularly helpful Moodlers

May as well change the subject line  or start a new thread ... remember your choice of poison is Ubuntu ... mine is CentOS.  Time to start digging on your own a little. ;)

Sooo .... https://tutorials.ubuntu.com/tutorial/install-and-configure-apache#0

'forcing ...' ... uhhhh, teachers will not like being 'forced' to do anything ... so good luck there!

Yes ... if you develop a moodle site using http(s)://onedomain.tld and want to move that to otherdomain.tld you will have to change config.php and run the search and replace.

Maybe don't take what I've suggested/shared so literally!!!

One could do this ... 3 virtual apaches ... dev.tld, lms2018.tld (the currently active), and lms2019.tld (future).  The dev is a tinker, the lms2019 could start as a clone of lms2018.tld but it's really running the next highest version of Moodle.

There's an organization in Texas called tcea.org ... hold a Conference every year ... so guess what they do?  Servers used in the current year all have the year in them ... like 2017 ... in the FQDN - so conference2017.tcea.org was this years main site ... but they also have a place where presenters can shared their files at something like files2017.tcea.org - one just for registrations ... register2017.tcea.org, etc. 

A week or so after a conference they crank up new domains ... conference2018.tcea.org and files2018.tcea.org, etc..

'The 2017's become archived or 'read only' ... eventually slide off the radar when the 2019's start.

Or ... you could use git ... and you could learn ... keep dev.tld and production.tld where they are ... no moving of files/changing FQDN nor none of that ... and using git ... upgrade when the time is right - on both!

One of the major things you'd have to do is remove the graduating Seniors ... and less so, I hope, removing teachers that take another job or retire ... adding new teachers/staff/students.

'spirit of sharing', Ken