Moodle 3.3 upgrade on ubuntu

Moodle 3.3 upgrade on ubuntu

by Jamie Tinley -
Number of replies: 22

Thanks in advance - I'm hoping Ken or Howard reads this!

First try I tried to update to 16.04 from 14.04 which resulted in my working production virtual ubuntu hyper-v server being unbootable (kernal error? here) 2nd time I'm just trying to update php 7!

Details: current setup

Production server Hyper-v built 2014 on Ubuntu 14.04  Moodle 3.0.5 (20160728)  PHP 5.5.9 apache 2.4.7 Mysqli

Goal: update Moodle to 3.3 environment shows I need php5.6 or php 7  (read good post by Ken/Matt questioning why upgrade now if working since many of my added modules may not be ready for php7 but teachers clamor . .)


First time I tried to update to 16.04 and that's where the kernal error I read here may have made my ubuntu unbootable.  Rather than try that again, I reverted to saved image and (yes, backed up everything again!)

typed 

sudo add-apt-repository ppa:ondrej/php then sudo apt-get update. 

Next command differs 

 Howard says use sudo apt install php   or

sudo apt-get install php7.0   or super long one

sudo apt-get install aspell graphviz php7.0-curl php7.0-gd php7.0-intl php7.0-ldap php7.0-mysql php7.0-pspell php7.0-xml php7.0-xmlrpc php7.0-zip

or Ken's yum install php70w* --exclude=php70w-mysql  using webstatic which I may be able to make work with apt-get too if webstatic is a better repo to use. or go back and use 5.6 only?? I"m pretty sure I'm using mysqli not mysql. 

First time I installed php -v showed php 7 but Moodle still showed php 5.5.9 despite using 

sudo a2dismod php5   and then sudo a2enmod php7.0.  Fixed php.ini in etc/php/7.0/php.ini to no avail.

Thanks in advance for your help! 


Average of ratings: -
In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

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

This isn't really a Moodle problem. You might be better off in the Ubuntu forums. It shouldn't make any difference I suppose, but I don't know anything about hyper-v.

In reply to Howard Miller

Re: Moodle 3.3 upgrade on ubuntu

by Jamie Tinley -

Ok but ignoring the hyper-v part which ubuntu command - I like yours best as it's super simple to type

sudo apt install php.  Will that pull in all the other things I might need for mysqli etc?  And any idea why it did not show in moodle environment as php7 when it does in ubuntu? Thanks Howard - I thought you are an ubuntu guy? I was windows+moodle  from 2005 until 2014 when Ken encouraged me to try Ubuntu (I'm using I guess the wrong version than him but I'm still figuring this all out).  Much faster than windows though! Thanks, Jamie

In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

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

No... you need to specify all the different addins. install php just gets the basics. Having said that, if you try to install Moodle and the environment check fails you can just go back to the command line install the module, restart Apache and refresh the page. That's what I usually do - I always forget something. 

If you have 16.04 then you should get PHP 7. I'm struggling to think why you wouldn't. Running 5.6 on 16.04 is a big hassle. 

It might be quicker to re-install Ubuntu from scratch. It sounds like something has gone awry with your install.

In reply to Howard Miller

Re: Moodle 3.3 upgrade on ubuntu

by Jamie Tinley -

Thanks Howard - so then you mean I should do both of these below?

sudo apt install php

sudo apt-get install aspell graphviz php7.0-curl php7.0-gd php7.0-intl php7.0-ldap php7.0-mysql php7.0-pspell php7.0-xml php7.0-xmlrpc php7.0-zip 

In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

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 don't think you need all those 7.0s. They're just an alias. Without checking carefully, that looks entirely reasonable. 

As I say, if you miss one Moodle will complain and you can do another 'apt' and add it later.

In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

by Ken Task -
Picture of Particularly helpful Moodlers

+1 to what Howard said ... not a ubuntu person myself but it's Linux, right? (yeah, right).

Then there is the added layer of Hyper-V ... interesting note that Microsoft is a developing/has developed a linux of their own to help with issues of the 30%+ guest OS's running on Azure that have opted to use a Linux.    Hmmmm ....

Anyhoo ... from what I read about upgrades of the OS in place ... Ubuntu 14.04 -> 16.04 ... while supposedly possible, many have reported too many issues.

You might be better off installing fresh 16.04 in another VM, get **native** (linux ... no Bitnamic package, etc.) apache, mysql, and PHP on it ... and functioning  ... no moodle initially.  Get php info page running, get a test DB installed and find a test php script to connect to the DB.

Another incentive to go 16.04 ... as I understand it, it's Ubuntu's first Linux Standards Base (LSB) and in looking at first hand om a VirtualBox 16.04 there are things that are located and are configured the same way on 16.04 as they are on CentOS 6 and 7.   Discovered no need to have a listener script that was different for unoconv on Ubuntu 16.04 from CentOS 6.   That's not a biggy to you yet, maybe, you don't know what you don't know (that goes for all of us ... including myself).

Now the moodle ... full site backup ... xfer the backup to new Ubuntu 16.04.  Place moodle code and moodle data directories in locations compat with Ubuntu 16.04.   Edit the .sql dump of the database with nano or some text editor ... search for http://oldurl/ replace with http://newurl/.   Then import that SQL file.

What you should end up with is a clone of what you had on 14.04 but with 16.04 repos and the ability to upgrade MySQL/PHP should you need to in the 'march' of Moodle upwards.

I have to do this same thing with CentOS 5 on Rackspace boxes when moving to CentOS 6 or 7.   There ain't no easy button for it ... it is a rebuild of existing site on new 'hardware', with new MySQL/PHP.

Best if you could leave old site up while building new site.   Some actually opt to make no user backups of courses on old and restore those courses on new server.

As others of said ... 'hoping that helps' ...

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.3 upgrade on ubuntu

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

I use hyper-v and have found no extra stuff needed once it is setup but I use Debian, not Ubuntu.  I had a Centos server that I upgraded to a newer version of PHP and also had the problem of Moodle not seeing it even after deleting php 5.5. I believe it took a server reboot to fix that issue.

In reply to Emma Richardson

Re: Moodle 3.3 upgrade on ubuntu

by Ken Task -
Picture of Particularly helpful Moodlers

Ahhhh ... there's a difference, Emma ... you control HyperV ... which sits on top of Debian or any guest OS ... which sits runs the apps (apache/php/mysql) for Moodle code.   The op asking ... does not.

So to get to Moodle there are two layers above it.

Not sure I really like Virtualization ... Rackspace is one that has been at it for a very long time .... before Amazon?  Recently spent a couple of weeks with them and their newest CentOS 6 and 7 offerings.  

I tinker locallly with VirtualBox on a Mac ... can tell you that VMWare can putz a moodle ... konw that for a fact ... and had a heck of a time convincing the Virtual Server Admin ... yet another person ... that setup wasn't correct.  Finally, after 4 months of back and forth, he decides to check VMWare ... guess what ... another Guest OS on the same physical Virtual box had been given 100% CPU on demand when ever it wanted it.    No one could access the moodle for 5 minutes at 37 minutes after each hour for 5 minutes.

So since the poster is using Ubuntu and HyperV, think I'll back out of this conversation. ;)

'spirit of sharing', Ken



In reply to Emma Richardson

Re: Moodle 3.3 upgrade on ubuntu

by Jamie Tinley -

Thanks Emma - I did try restarting the entire server that houses the hyper-v (luckily this server was bought just for me so it's totally dedicated just to moodle and I chose hyper-v because my friend showed me how to save checkpoints on it which has been really useful if things go bad as they did here the first time smile

In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

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

I love that about hyper-v - very easy to use.  And the snapshot feature is excellent, especially because you can create multiple snapshots which really helps if you are jumping through a few versions.

In reply to Ken Task

Re: Moodle 3.3 upgrade on ubuntu

by Jamie Tinley -

Thanks Ken, that does help - I may have to bite the bullet and just do a full install of 16.04 and Moodle all over again.  I do not understand what this sentence means and how that will benefit me in the future:

Discovered no need to have a listener script that was different for unoconv on Ubuntu 16.04 from CentOS 6.  

Thanks,

Jamie

In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

by Ken Task -
Picture of Particularly helpful Moodlers

Correction ... unoconv listener for Ubuntu 16.04 could be used with CentOS 7 (not 6).

That has to do with Annotation of assignments.

Rather than me re-writing ...

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

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

Then again, you teach math/science and your ISD has Google Docs/Drive ... is that correct?

Would think you could find something a lot better via Google .... depending upon assignment and how students are submitting + how you grade ... or where your official gradebook (for the entire school) resides.

https://www.google.com/search?q=unoconv+annotate+assignments&ie=utf-8&oe=utf-8#q=annotation+Google+Docs

Yeah ... I know that's clear as mud. :|

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.3 upgrade on ubuntu

by Jamie Tinley -

still wrapping my head around all this.  I can easily create another virtual server but it would not have any ip address as the county is tight about handing them out.  So I could install but not sure how I would test if it works. maybe internally?  Then I'm not sure how to copy over one image from one virtual server to another virtual server unless I copy the folders.  Not being an expert on hyper-v, ubuntu, nor moodle is the danger of letting fear control me a little from learning faster but at least I can always revert when things go bad! saved me many times smile

Thanks for input.

In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

by Ken Task -
Picture of Particularly helpful Moodlers

The issue with getting an IP address might be a public IP (IPv4) for the server.   If you can spin up another virtual that instance surely can get/does have a private IP address (10., 172.16.x.x, or 192.168.x.x) ... if not what good is it? ;)

That would mean you could work on it via IP address only ... unless your DNS administrator could be convinced to give the server a FQDN in the private DNS only.

Just for development, if your network allows/has VPN, one could access the server outside the entity private network via VPN client ... which places your home computer on the entities private network ... like being there rather than else where.

That would give you practice in installing PHP/MySQL/Apache and configuring them for a Moodle ...

While the easiest way to clone with virtuals is to restore an image of one, that would still require a different IP address.  And best if any server has a static IP ... not DHCP.   That's where your network people need to be consulted.

Spinning up a new rather than cloning a virtual means you have to learn package manager ... get desired PHP/MySQL/Apache versions, configure them, then get a clone of production moodle server ... a tar ball of the code, a tar ball of moodledata, and an sql dump imported into new DB on new test server.

Keep that box as a tinker machine. ;)

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle 3.3 upgrade on ubuntu

by Jamie Tinley -

Thanks Ken, on my 5th install I noticed the hyper-v image lets me export it so maybe I can import it to the other server.

Trial 5 worked!!! yaaa.  it did not like configurable reports and the theme aigne so maybe they held it up.  

In environment it complains about many extensions not being enabled that I know are installed like curl, iconv, zip etc. doing php-m they all show up fine.  looking on moodle in a page I created called info.php it shows like this which I think is the same: apache2/conf.d/20-curl.ini, 

I installed aptitude and ran 

Aptitude show php7.1-curl

which shows state: installed (automatically installed :no I think because I did it myself. 

Yet moodle looks like it's working - should I ignore all these complaints in environment as each says ok. 

Attachment ServerChecks 3.3.png
In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

by Bret Miller -
Picture of Particularly helpful Moodlers

Make sure you got all the necessary extensions. Did you restart apache2 after enabling mod_php7?

In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

by Jamie Tinley -

Thanks for all the input everyone, I'll have to re-read to digest it and have one minute to post then will re-read and post tonight when I get home.

I did restart apache many times AND restarted my server too but it still shows php 5.5.9 on moodle.

I reverted my virtual ubuntu BACK to 14.04 image which has worked for 2 years no problem. I would rather keep 14.04 because updating to 16.04 failed this week.  Easier to just upgrade to php 7 (or at least 5.6 ) but on 14.04, not 16.04 unless I have to!

So my real question is, which ubuntu command below should I use:

 sudo apt install php   or (Howards)

sudo apt-get install php7.0    or

sudo apt-get install aspell graphviz php7.0-curl php7.0-gd php7.0-intl php7.0-ldap php7.0-mysql php7.0-pspell php7.0-xml php7.0-xmlrpc php7.0-zip   OR Kens

or Ken's yum install php70w* --exclude=php70w-mysql  using webstatic 

Thanks - I'll re-read and post tonight.


In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

by Ken Task -
Picture of Particularly helpful Moodlers

Well, I had planned to back out of this conversation ... don't use Debian/HyperV nor Ubuntu.   So thought it best to do so .... you are in good hands with Emma and Howard.

Will say one more thing .... stick with one package manager ... the one native to your OS - Ubuntu - which is apt get stuff.   Debian?  *DO NOT* mix yum package manger with apt get, etc.

The yum stuff with webtatic external repo is really meant for CentOS/RedHat family servers.

I have no doubt, however, that in the future you will be moving to 16.04 ... eventually.

'spirit of sharing', Ken


In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

by Bret Miller -
Picture of Particularly helpful Moodlers

I'll agree with your assessment not to upgrade to 16.04. I did a test upgrade from 14.04 to 16.04 not too long ago with pretty disastrous results. That said, it really depends on the features of PHP you need. I'm on 7.1 now, so mine is a little different, but this is what I used:

sudo apt-get install php7.1 php7.1-mcrypt php7.1-cgi php7.1-cli php7.1-curl php7.1-xmlrpc php7.1-gd php7.1-intl php7.1-json php7.1-mbstring php7.1-mysqli php7.1-xml php7.1-zip php7.1-soap -y
Definitely "apt-get install". Looking back at my notes, this is what I last used for php 7.0.

sudo apt-get install php7.0 php7.0-mcrypt php7.0-cgi php7.0-cli php7.0-curl php7.0-xmlrpc php7.0-gd php7.0-intl php7.0-json php7.0-mbstring php7.0-mysqli php7.0-xml php7.0-zip php7.0-soap -y
And that pretty much looks the same as my php 7.1 install, so it's probably right.
Average of ratings: Useful (1)
In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

by Jamie Tinley -

As an update to anyone who also has this question I had 99% success which is usually an A+ in school but here I failed.

I have reset server 3x now and each time I get faster.  Gave up updating to 16.04 but successfully updated php7.1 for ubuntu 14.04 and updated site to 3.0.10 BUT only Moodle 3.2 and up work with php7 so some links would never work (ie, could get to front page but not to any admin settings although i could get to one class but not others so maybe it was a theme issue?) When trying to upgrade using git to 3.3 I get to the final check on all pluggins and it complains still (see further below)

Anyway, for those following I successfully used :

Typed sudo add-apt-repository ppa:ondrej/php

Sudo apt-get update

sudo apt install php

sudo a2dismod php5

sudo a2enmod php7.1

for php-xsl plugin I had trouble and used this line

sudo apt-get install php7.0 libapache2-mod-php7.0 (tried 7.1 but failed why not sure) which I wonder how that affected my system.

Then I realized I can add a bunch of things on one line now like this

sudo apt-get install php-mysql php-curl php-zip php-gd php-mbstring php-xmlrpc php-soap, php-intl, php-xsl, php-dom

I updated moodle first to 3.0.10 (was 3.0.5) then to 3.3 with various commands like 

git checkout MOODLE_33_STABLE 

which correctly showed I was following 3.3 now and web was happier 3rd time as many pluggins that filed 2nd time I had removed (uninstalled and deleted folders) that the 2nd install failed on like poodll, theme Aigne, and configurable reports hoping my 3.3 upgrade works on 3rd attempt but somehow it still finds poodll somewhere and then fails to load (hangs forever) with message:

This page should automatically redirect. If nothing is happening please use the continue link below.
Continue

I read and read many workarounds which all failed for me: renaming cache inside moodledata, deleting cache, deleting all moodle data files, editing moodle/admin/index.php to comment out various lines like // redirecte_if_major_upgrade_required    or // redirect("index.php?sessionsstarted etc or to even add these lines

after //available updates moodle core

$availableupdates['core'] = $updateschecker->get_update_info('core',

    array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));

and I tried many permutations and other browsers like firefox and chrome and restarted apache each time. updated server and restarted that too without joy (still hangs on redirect).  

I can try again 4th time  (revert to original working production server image 3.0.5) and then just update it to 3.0.10 and not update php but I would really really like to update it to 3.3 someday. I've been waiting 2 years to try to upgrade it.  My window of time when others don't use it is to June 25 to July 10th each year so now I have to wait another year and hobble along with updating only.  I would love to hear advice on what I should try for my 4th attempt to upgrade it to 3.3 and php7.1 . I guess on he positive side what took me 2 weeks only took me 4 hours now to try again last night smile

Thanks . . . Jamie





In reply to Jamie Tinley

Re: Moodle 3.3 upgrade on ubuntu

by Jamie Tinley -

4th attempt but now when I go to my site 

http://moodlex.waterford.k12.ca.us/moodle/login/index.php

I get WORDS!  I tried Brett's way which was almost the same as mine but using 7.1 and had php7.1-cgi and php7.1-cli which now show up in my etc/php/7.1 folder but there is NO APACHE2 folder now!  so I tried to create one and renamed cgi and cli folders. copied the conf.d from them and my original php.ini but still I get words like these below:

<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
Which is my index.php file but why is it loading as words and not giving me notifications with updating my moodle to 3.3?  Sigh. I guess I try it again for trial 5.  Ignorance is killing me . . .