Out of Memory error during an upgrade

II tried to upgrade 18.03 to 18.09 using the web upgrader and there was an error so I tried the occ command and got as below. It seems it was trying to allocate a large amount of memory for the upgrade. Any recommendations? I checked my Linode dashboard and I am using only 31% of a 160 GB drive.

Thanks,
Dennis

root@bereaccpc:~# sudo -u www-data php /var/www/nextcloud/occ upgrade
sudo: unable to resolve host bereaccpc: Name or service not known
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Updated database
Checking for update of app accessibility in appstore
Checked for update of app “accessibility” in appstore
Checking for update of app activity in appstore
Checked for update of app “activity” in appstore
Checking for update of app admin_audit in appstore
Checked for update of app “admin_audit” in appstore
Checking for update of app bruteforcesettings in appstore
Checked for update of app “bruteforcesettings” in appstore
Checking for update of app calendar in appstore
Checked for update of app “calendar” in appstore
Checking for update of app carnet in appstore
Checked for update of app “carnet” in appstore
Checking for update of app cloud_federation_api in appstore
Checked for update of app “cloud_federation_api” in appstore
Checking for update of app comments in appstore
Checked for update of app “comments” in appstore
Checking for update of app contacts in appstore
Checked for update of app “contacts” in appstore
Checking for update of app dav in appstore
Checked for update of app “dav” in appstore
Checking for update of app deck in appstore
Checked for update of app “deck” in appstore
Checking for update of app federatedfilesharing in appstore
Checked for update of app “federatedfilesharing” in appstore
Checking for update of app federation in appstore
Checked for update of app “federation” in appstore
Checking for update of app files in appstore
Checked for update of app “files” in appstore
Checking for update of app files_external in appstore
Checked for update of app “files_external” in appstore
Checking for update of app files_lock in appstore
Update app files_lock from appstore
Checked for update of app “files_lock” in appstore
Checking for update of app files_pdfviewer in appstore
Checked for update of app “files_pdfviewer” in appstore
Checking for update of app files_rightclick in appstore
Checked for update of app “files_rightclick” in appstore
Checking for update of app files_sharing in appstore
Checked for update of app “files_sharing” in appstore
Checking for update of app files_trashbin in appstore
Checked for update of app “files_trashbin” in appstore
Checking for update of app files_versions in appstore
Checked for update of app “files_versions” in appstore
Checking for update of app files_videoplayer in appstore
Checked for update of app “files_videoplayer” in appstore
Checking for update of app firstrunwizard in appstore
Checked for update of app “firstrunwizard” in appstore
Checking for update of app groupfolders in appstore
Update app groupfolders from appstore
Checked for update of app “groupfolders” in appstore
Checking for update of app logreader in appstore
Checked for update of app “logreader” in appstore
Checking for update of app lookup_server_connector in appstore
Checked for update of app “lookup_server_connector” in appstore
Checking for update of app mail in appstore
Update app mail from appstore
Purify and migrate collected mail addresses

Done
2/2 [============================] 100%
Insert background jobs for all accounts
Done
1/1 [============================] 100%
Checked for update of app “mail” in appstore
Checking for update of app nextcloud_announcements in appstore
Checked for update of app “nextcloud_announcements” in appstore
Checking for update of app notifications in appstore
Checked for update of app “notifications” in appstore
Checking for update of app oauth2 in appstore
Checked for update of app “oauth2” in appstore
Checking for update of app onlyoffice in appstore
Update app onlyoffice from appstore
Checked for update of app “onlyoffice” in appstore
Checking for update of app password_policy in appstore
Checked for update of app “password_policy” in appstore
Checking for update of app photos in appstore
Checked for update of app “photos” in appstore
Checking for update of app privacy in appstore
Checked for update of app “privacy” in appstore
Checking for update of app provisioning_api in appstore
Checked for update of app “provisioning_api” in appstore
Checking for update of app recommendations in appstore
Checked for update of app “recommendations” in appstore
Checking for update of app richdocuments in appstore
Update app richdocuments from appstore
Checked for update of app “richdocuments” in appstore
Checking for update of app serverinfo in appstore
Checked for update of app “serverinfo” in appstore
Checking for update of app settings in appstore
Checked for update of app “settings” in appstore
Checking for update of app sharebymail in appstore
Checked for update of app “sharebymail” in appstore
Checking for update of app spreed in appstore
Update app spreed from appstore
Checked for update of app “spreed” in appstore
Checking for update of app support in appstore
Checked for update of app “support” in appstore
Checking for update of app survey_client in appstore
Checked for update of app “survey_client” in appstore
Checking for update of app systemtags in appstore
Checked for update of app “systemtags” in appstore
Checking for update of app text in appstore
Checked for update of app “text” in appstore
Checking for update of app theming in appstore
Checked for update of app “theming” in appstore
Checking for update of app twofactor_backupcodes in appstore
Checked for update of app “twofactor_backupcodes” in appstore
Checking for update of app updatenotification in appstore
Checked for update of app “updatenotification” in appstore
Checking for update of app viewer in appstore
Checked for update of app “viewer” in appstore
Checking for update of app workflowengine in appstore
Checked for update of app “workflowengine” in appstore
Checking for update of app documentserver_community in appstore
Update app documentserver_community from appstore

mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory
PHP Fatal error: Out of memory (allocated 44040192) (tried to allocate 314314904 bytes) in /var/www/nextcloud/lib/private/Installer.php on line 285
root@bereaccpc:~# df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 4070168 0 4070168 0% /dev
tmpfs 816996 82484 734512 11% /run
/dev/sda 50959004 23476460 26947116 47% /
tmpfs 4084972 0 4084972 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 4084972 0 4084972 0% /sys/fs/cgroup
tmpfs 816992 4 816988 1% /run/user/0
overlay 50959004 23476460 26947116 47% /var/lib/docker/overlay2/abafca92cd235d0eb8cc5aaaf5fc73ae1d0c279bc8174f46a72e7ca869194bbd/merged
root@bereaccpc:~# df -H --output=size,used,avail
Size Used Avail
4.2G 0 4.2G
837M 85M 753M
53G 25G 28G
4.2G 0 4.2G
5.3M 0 5.3M
4.2G 0 4.2G
837M 4.1k 837M
53G 25G 28G

I stopped nginx and then was able to continue with an occ upgrade, then I was able to upgrade to 19.0.3 from the web upgrade with no problem.