Difference between revisions of "Nextcloud"

From SME Server
Jump to navigationJump to search
(102 intermediate revisions by 7 users not shown)
Line 11: Line 11:
 
|description_image= {{#var:contribname}} logo
 
|description_image= {{#var:contribname}} logo
 
|maintainer= Unnilennium
 
|maintainer= Unnilennium
|licence= GPL
+
|licence= AGPLv3
|url= https://nextcloud.org
+
|url= https://nextcloud.com
|category= Contrib
+
|category= Cloud
|tags=cloud,files,dropbox,seafile,pydio,ajaxplorer  
+
|tags=cloud,files,dropbox,seafile,pydio,ajaxplorer,owncloud
 
}}
 
}}
 
 
===Maintainer===
 
===Maintainer===
 
<!-- here you need to file your username and name -->
 
<!-- here you need to file your username and name -->
Line 24: Line 23:
 
<!-- keep this first element as is, you can add some if needed -->
 
<!-- keep this first element as is, you can add some if needed -->
 
{{#smeversion: {{#var:smecontribname}} }}
 
{{#smeversion: {{#var:smecontribname}} }}
{{#smeversion: {{#var:contribname}} }}
+
{{#smeversion: nextcloud-src  }}
  
 
=== Description ===
 
=== Description ===
 
Nextcloud is a suite of client-server software for creating and using file hosting services. It is functionally similar to Dropbox, although Nextcloud is free and open-source, allowing anyone to install and operate it on a private server.
 
Nextcloud is a suite of client-server software for creating and using file hosting services. It is functionally similar to Dropbox, although Nextcloud is free and open-source, allowing anyone to install and operate it on a private server.
 +
 +
As per SME Server Keep It Simple, all your ibays and home folders will be accessible through the nextcloud interface using the "external files" app. You will also have your main user user Nextcloud folder saved under /home/e-smith/files/owncloud/data which is in the default backup path. So you can now enjoy both your own cloud repository with access to the very same files on your samba share!
 +
 +
How do I add my SME users ? They are already there ! Just tell them to connect to https://mydomain/nextcloud. You can also add external users or allow them to register with a nextcloud app.
 +
 +
What are the admin ? By default you have a nextcloudadmin user and the regular SME admin user. First one use the password you can see with "config getprop nextcloud AdminPassword", and second one, well, just use your regular admin password. Then you can manage apps, external files repos and admin group membership.
  
 
=== Installation ===
 
=== Installation ===
  yum install smeserver-extrarepos-remi-safe smeserver-extrarepos-fws
+
 
 +
<tabs container>
 +
<tab name="For sme10">
 +
yum install {{#var:smecontribname}} --enablerepo=smecontribs
 +
 
 +
you might need a second event or sometime ibays folder is not visible
 +
signal-event nextcloud-update
 +
 
 +
</tab>
 +
<tab name="For sme9">
 +
You do not need to  follow the Repo pages of [https://wiki.contribs.org/Fws fws] and [https://wiki.contribs.org/Remi-safe remi-safe] to install those two needed repos, instead use the packages to install them followed by a yum-modify event. Then run the main installation.
 +
  yum install smeserver-extrarepositories-remi-safe smeserver-extrarepositories-fws smeserver-extrarepositories-epel
 
  signal-event yum-modify
 
  signal-event yum-modify
  yum --enablerepo=smecontribs install {{#var:smecontribname}} --enablerepo=smecontribs,fws,remi-safe,smedev.smetest
+
  yum install {{#var:smecontribname}} --enablerepo=smecontribs,epel,fws
 +
signal-event webapps-update
 +
service php-fpm start
 +
service php71-php-fpm start
 +
service php72-php-fpm start
 +
service php73-php-fpm start
 +
signal-event nextcloud-update
 +
 
 +
you can skip the service php-fpm* commands if it was already installed and running before the installation of nextcloud
  
 +
then you can do the following and you can safely ignore the signal-event post-upgrade reboot if prompted, unless you also installed other packages that needs to do so.
 +
config set UnsavedChanges no
  
 +
or do
 +
signal-event post-upgrade
 +
signal-event reboot
 +
then
 +
signal-event nextcloud-update
 +
 +
if you want to add SME user admin as administrator of nextcloud do
 +
  OCC group:adduser admin admin
 +
</tab>
 +
</tabs>
 +
 +
you might want to set your default phone region (use your country 2 letter code - low case)
 +
occ config:system:set default_phone_region --value="us"
 +
 +
you might want to have nextcloud accessible to the Internet
 +
config setprop nextcloud access public
 +
signal-event nextcloud-update
 +
 +
=== Use a dedicated domain to connect to Nextcloud ===
 +
first change the first line variable content with you nextcloud domain as defined with your DNS provider.
 +
<syntaxhighlight lang="bash">
 +
NEXTCLOUDDOMAIN="cloud.mydomain.com"
 +
db domains set $NEXTCLOUDDOMAIN domain Description "Nextcloud" Content Primary Nameservers internet TemplatePath WebAppVirtualHost DocumentRoot /usr/share/nextcloud RequireSSL enabled letsencryptSSLcert enabled
 +
signal-event domain-create $NEXTCLOUDDOMAIN
 +
 +
# this one to let nextcloud DAV be redirect correctly and to have collabora recognize the domain
 +
config setprop nextcloud VirtualHost $NEXTCLOUDDOMAIN
 +
signal-event nextcloud-update
 +
 +
# only if you use a Let's Encrypt certificate
 +
expand-template /etc/dehydrated/domains.txt
 +
dehydrated -c
 +
 +
</syntaxhighlight>
 +
 +
=== Configuration ===
 +
{| class="wikitable"
 +
!property
 +
!default
 +
!values
 +
!
 +
|-
 +
|AdminPassword
 +
|GENERATED
 +
|string
 +
|password for your main admin user for nextcloud (*)
 +
|-
 +
|AdminUser
 +
|nextcloudadmin
 +
|string
 +
|main admin user for your installation (*)
 +
|-
 +
|cliurl
 +
|enabled
 +
|enabled,disabled
 +
|force overwrite.cli.url to https://domain/nextcloud or https://domain if virtualhost is set; disable it if you have specific needs and then use occ command to set your value
 +
|-
 +
|DbName
 +
|nextcloud
 +
|string
 +
|for mysql db
 +
|-
 +
|DbPassword
 +
|GENERATED
 +
|string
 +
|for mysql db
 +
|-
 +
|DbUser
 +
|nextcloud
 +
|string
 +
|for mysql db
 +
|-
 +
|TrustedDomains
 +
|empty
 +
|strings coma separated
 +
|add domain or ip that are in need to be added to default access to nextcloud
 +
|-
 +
|VirtualHost
 +
|empty
 +
|domain name
 +
|domain dedicated to nextcloud, needs to also be defined as domain on the server
 +
|-
 +
|access
 +
|private
 +
|private, public
 +
|
 +
|-
 +
|status
 +
|enabled
 +
|enabled,disabled
 +
|
 +
|-
 +
|MaxUploadSize
 +
|4096M
 +
|number
 +
|if a number will be converted to Megabytes, otherwise use the usual suffix : 2T for 2 terrabytes etc...
 +
|-
 +
|MemoryLimit
 +
|528M
 +
|number
 +
|webinterface : if a number will be converted to Megabytes, otherwise use the usual suffix : 2T for 2 terrabytes etc...
 +
|-
 +
|memory_limit
 +
|1024M
 +
|number
 +
|for cli like occ command or cron: if a number will be converted to Megabytes, otherwise use the usual suffix : 2T for 2 terrabytes etc...
 +
|-
 +
|Shares
 +
|enabled
 +
|enabled,disabled
 +
|add the samba shares from the shared-folders contrib in the nextcloud ibays folder along with regular ibays
 +
|-
 +
|IncludeIbay
 +
|empty
 +
|strings coma separated
 +
|add ibays names that need to be include. If not empty, only the name present here will be accessible via nextcloud. Take precedence over ExcludeIbay. You set it with a random string to exclude all ibays and shares from automatic inclusion.
 +
|-
 +
|ExcludeIbay
 +
|Primary
 +
|strings coma separated
 +
|will exclude from nexcloud access any ibay via nextcloud. Default excludes Primary ibay. If you want to include Primary set it with a random string.
 +
|-
 +
|opcache.memory_consumption
 +
|32
 +
|number
 +
|update this value if Nextcloud says that it should be
 +
|-
 +
|opcache.interned_strings_buffer
 +
|128
 +
|number
 +
|update this value if Nextcloud says that it should be
 +
|-
 +
|PHPBaseDir
 +
|
 +
|colon separated string
 +
|php base dir you want to add to the default example /home/e-smith/files/ibays/musique/files:/usr/share/GeoIP/GeoLite2-Country.mmdb:/proc/cpuinfo
 +
|-
 +
|UseSMB
 +
|enabled
 +
|enabled,disabled
 +
|allow you to set ibay access via samba share or via Local driver in nextcloud. Enabled is for samba, this allow you to access as your user and have your quota accounted. It might be a little slower, and need you to have your password loaded in the session. Local driver if disabled, will let you access only what apache user (www) has right to access as member of a group.
 +
|}
 +
(*) the SME admin user is also an admin of your nextcloud installation. You have two admin account as per default installation on SME Server.
 +
 +
 +
example of setting :
 +
  config setprop nextcloud ExcludeIbay ibay1,ibay2
 +
  signal-event nextcloud-update
 +
 +
=== LDAP/AD Integration Settings ===
 +
Do not change the LDAP/AD integration settings for "1. Server: Localhost" or you will break the Nextcloud install.  If you want to add a second LDAP/AD server, click the "+" symbol to add another configuration and then add the appropriate LDAP/AD settings.
 +
 +
=== Command line ===
 +
if you happen to need tweaking your installation, here is how to access the command line for Nextcloud on SME, we made it easier for you, just log as root and use the OCC command (using capitals), This command will execute for you what you need as the www user, using the needed version of php. Here two examples: <syntaxhighlight lang="bash">
 +
occ maintenance:mode --off
 +
occ maintenance:repair
 +
 +
</syntaxhighlight>to seek for additional command consult Nextcloud documentation : https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html
 +
 +
=== Upgrade ===
 +
yum  update {{#var:smecontribname}} {{#var:contribname}} --enablerepo=smecontribs
 +
 +
=== CLI upgrade of Nextcloud software ===
 +
You should rather prefer the online updater, but in case:<syntaxhighlight lang="bash">
 +
occ maintenance:mode --on
 +
sudo -u www /usr/bin/php74 --define memory_limit=1024M -d apc.enable_cli=1 /usr/share/nextcloud/updater/updater.phar --no-interaction
 +
occ upgrade
 +
occ maintenance:mode --off
 +
</syntaxhighlight>In case of a huge db, you can choose the online updater and then only issue the db update doing<syntaxhighlight lang="bash">
 +
occ upgrade
 +
occ maintenance:mode --off
 +
</syntaxhighlight>
 +
 +
starting 25 to upgrace to 26, you should do
 +
<syntaxhighlight lang="bash">
 +
occ maintenance:mode --on
 +
sudo -u www /usr/bin/php81 --define memory_limit=1024M -d apc.enable_cli=1 /usr/share/nextcloud/updater/updater.phar --no-interaction
 +
occ upgrade
 +
occ maintenance:mode --off
 +
</syntaxhighlight>In case of a huge db, you can choose the online updater and then only issue the db update doing<syntaxhighlight lang="bash">
 +
occ upgrade
 +
occ maintenance:mode --off
 +
</syntaxhighlight>
 +
 +
=== Restore info loglevel ===
 +
<syntaxhighlight lang="bash">
 +
occ config:system:set loglevel --value=3
 +
</syntaxhighlight>
  
 
=== Uninstall ===
 
=== Uninstall ===
  yum remove {{#var:smecontribname}}  {{#var:contribname}}
+
 
 +
{{Warning box| if you plan to reinstall and had the nextcloud rpm installed do not yum remove it or rpm -e it as it would put you in a situation where you will not be able to reinstall and restore your old data. nextcloud-src rpm if present do not create such situation and can be removed safely.}}
 +
 
 +
Uninstalling the rpms
 +
  yum remove {{#var:smecontribname}}  {{#var:contribname}}-src
 +
rpm -e --justdb nextcloud
 +
 
 +
those folders will then remain
 +
* /usr/share/nextcloud : software and config
 +
* /home/e-smith/files/nextcloud : user data
 +
 
 +
also you will have mariadb or mariadb105 with nextcloud db and user.
 +
 
 +
And finally, db configuration with entry for nextcloud.
 +
 
 +
If all of those remains as is, a simple reinstall of the contrib will bring back nextcloud running. If you uninstalled it because your install was non functional or want a complete removal, there are extra steps.
 +
 
 +
In case of deleting either the db or part of the software folder, whenever you will try to reinstall the contrib, process will fail as db and files are not in sync. 
 +
 
 +
In case you need to reinstall from scratch, '''first, backup what you might want to restore latter''':
 +
cd /home/e-smith/files/nextcloud/data
 +
mysqldump nextcloud > nextcloud55.sql
 +
mysqldump105 nextcloud > nextcloud105.sql
 +
config print nextcloud /root/nextcloud.config
 +
tar -czf  /root/nextcloud.tar.gz /home/e-smith/files/nextcloud/data /usr/share/nextcloud
 +
then erase all what is remaining:
 +
mysql -e "DROP DATABASE `config getprop nextcloud DbName`;DROP USER IF EXISTS `config getprop nextcloud DbUser`;"
 +
mysql105 -e "DROP DATABASE `config getprop nextcloud DbName`;DROP USER IF EXISTS `config getprop nextcloud DbUser`;"
 +
rm -rf /usr/share/nextcloud
 +
rm -rf /home/e-smith/files/nextcloud
 +
#this one is optional, and should not cause issue if still there
 +
config delete nextcloud
 +
 
 +
and you should be able to start a new install from scratch
 +
 
 +
=== Release schedule ===
 +
see https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule
 +
 
 +
as per 2024/01:
 +
{| class="wikitable"
 +
!Version
 +
!Name
 +
!Release date
 +
!End of life
 +
|-
 +
|'''30'''
 +
|
 +
|2024-09-14
 +
|
 +
|-
 +
|'''29'''
 +
|Hub 8
 +
|2024-04-24
 +
|2025-04
 +
|-
 +
|'''28'''
 +
|Hub 7
 +
|2023-12-12
 +
|2024-12
 +
|-
 +
|'''<s>27</s>'''
 +
|<s>Hub 6</s>
 +
|<s>2023-06-13</s>
 +
|<s>2024-06</s>
 +
|-
 +
|'''<s>26</s>'''
 +
|<s>Hub 4</s>
 +
|<s>2023-03-21</s>
 +
|<s>2024-03</s>
 +
|-
 +
|'''<s>25</s>'''
 +
|<s>Hub 3</s>
 +
|<s>2022-10-19</s>
 +
|<s>2023-10</s>
 +
|-
 +
|'''<s>24</s>'''
 +
|<s>Hub 3</s>
 +
|<s>2022-05-03</s>
 +
|<s>2023-05</s>
 +
|-
 +
|'''<s>23</s>'''
 +
|<s>Hub 2</s>
 +
|<s>2021-11-30</s>
 +
|<s>2022-12</s>
 +
|-
 +
|'''<s>22</s>'''
 +
|<s>Hub</s>
 +
|<s>2021-07-06</s>
 +
|<s>2022-07</s>
 +
|-
 +
|'''<s>21</s>'''
 +
|<s>Hub</s>
 +
|<s>2021-02-22</s>
 +
|<s>2022-02</s>
 +
|-
 +
|'''<s>20</s>'''
 +
|<s>Hub</s>
 +
|<s>2020-10-03</s>
 +
|<s>2021-11</s>
 +
|-
 +
|'''<s>19</s>'''
 +
|<s>Hub</s>
 +
|<s>2020-06-03</s>
 +
|<s>2021-06</s>
 +
|-
 +
|'''<s>18</s>'''
 +
|<s>Hub</s>
 +
|<s>2020-01-16</s>
 +
|<s>2021-01</s>
 +
|}
 +
 
 +
=== Change Database ===
 +
If you are in the situation your are unable to update your nextcloud because of database requirements, you might need to install a newer and then migrate your db.
 +
 
 +
Here a simple procedure, after having the new db working as a sclo [[Mariadb105]] for SME10 as example.<syntaxhighlight lang="bash">
 +
occ maintenance:mode --on
 +
mysqldump `config getprop nextcloud DbName` > nextcloud.sql
 +
echo "CREATE DATABASE IF NOT EXISTS `config getprop nextcloud DbName` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"| mysql105
 +
mysql105 `config getprop nextcloud DbName`< nextcloud.sql
 +
echo "CREATE USER IF NOT EXISTS `config getprop nextcloud DbUser`@localhost IDENTIFIED BY '`config getprop nextcloud DbPassword`';"| mysql105
 +
echo "GRANT ALL PRIVILEGES ON `config getprop nextcloud DbName`.* TO `config getprop nextcloud DbUser`@localhost; FLUSH PRIVILEGES;" | mysql105
 +
occ config:system:set dbhost --value localhost:/var/lib/mysql/mariadb105.sock --type string
 +
occ maintenance:mode --off
 +
</syntaxhighlight>
 +
 
 +
After checking that all is working you can then delete yourself the old db from the previous mysql server, or keep it as a backup for a while.
 +
If it fails and just want to go back to previous state:
 +
occ maintenance --on
 +
occ config:system:set host --value localhost --type string
 +
occ maintenance --off
 +
 
 +
=== File Scan ===
 +
<syntaxhighlight lang="bash">
 +
# scan all, could take hours if you have a lot of files
 +
occ files:scan -v --all
 +
# scan all that is inside a username path (including external storages mounted there)
 +
occ files:scan -v myusername
 +
#scan only a subfolder of a user (path needs a heading / and is relative to /home/e-smith/files/nextcloud/data)
 +
occ files:scan -v --path="/myusername/files/myfolder/mysubfolder" myusername
 +
#For external storage one has to use a user and the mount point in the user space, e.g. admin
 +
occ files:scan -v --path="/admin/files/name_of_external_storage"
 +
</syntaxhighlight>If you use groupgfolders app, then you might consider, to list the golders id<syntaxhighlight lang="bash">
 +
occ groupfolders:list
 +
</syntaxhighlight>then for folder group with id 1<syntaxhighlight lang="bash">
 +
occ groupfolders:scan 1
 +
</syntaxhighlight>
 +
 
 +
=== Known issues ===
 +
 
 +
==== Web or GUI upgrade from NC25 to NC26  ====
 +
 
 +
Due to the change of php version needed from php74 to php80 and higher, you need to issue the following command while using NC25 to be able to then upgrade to NC26. NC25 is the first to be able to handle php80, and NC26 requires php80 or higher.
 +
<syntaxhighlight lang="bash">
 +
signal-event nextcloud-update
 +
</syntaxhighlight>
 +
 
 +
==== Issue importing files in db "Entry path/to/file will not be accessible due to incompatible encoding" ====
 +
<syntaxhighlight lang="bash">
 +
yum install convmv --enablerepo=epel
 +
#first test to see the changes
 +
convmv -f utf-8 -t utf-8 --nfc -r /home/e-smith/files/nextcloud/data/username
 +
#check, then with --notest
 +
convmv -f utf-8 -t utf-8 --nfc -r --notest /home/e-smith/files/nextcloud/data/username
 +
#then rescan
 +
occ files:scan -p /username/files/
 +
</syntaxhighlight>this might also occurs on ibays / home folders and their files not all visibles from nextcloud, simply adapt the path for convmv /home/e-smith/files/ibays/ibayname/files/ or /home/e-smith/files/users/userame/home/
 +
 
 +
==== Remove legacy nextcloud rpm without deleting /usr/share/nextcloud content ====
 +
for installs done before smeserver-nextcloud 1.2.0-16, the rppm nextcloud was required and was conflicting with web update. Since 1.2.0-16 it is not required anymroe and we use a nextcloud-src rpm which updates itself in /usr/share/nextcloud-src and is only used if you install the first time or restart from scratch your install.
 +
To remove the nextcloud rpm which is not needed and save your files:
 +
rpm -e --justdb nextcloud
 +
 
 +
source https://unix.stackexchange.com/questions/208722/how-to-remove-an-rpm-package-while-keeping-certain-files
 +
 
 +
==== User cannot see shares/files ====
 +
 
 +
After a new install the admin user could see shares but not a user.
 +
 
 +
We had a single ibay and it was set:
 +
 
 +
Group Everyone
 +
Write group
 +
Read everyone
 +
 
 +
We created a new group called localusers and added the admin and single user.
 +
 
 +
We then set the ibay:
 +
 
 +
Group localusers
 +
Write group
 +
Read group
 +
 
 +
This appeared to fix the issue and the user could now see the files.
 +
 
 +
====Upgrading beyond 20.x====
 +
 
 +
To set the default phone region:
 +
 
 +
OCC config:system:set default_phone_region --type string --value="GB"
 +
 
 +
To fix missing indices - this may take a while so be patient:
 +
 
 +
OCC db:add-missing-indices
 +
 
 +
==== NC 20-21 :  open_basedir restriction in effect. File(/templates/) is not within the allowed path ====
 +
this is a bug in NC. It has been fixed in NC 22 and not backported to NC20. This is just log noise. You can ignore it while waiting to update
 +
see https://help.nextcloud.com/t/error-file-templates-is-not-within-the-allowed-path-s-after-update-from-20-xx-to-21-0-3/119843
 +
 
 +
===Reset Database===
 +
 
 +
For reference, whilst looking at resetting file caches I found this.
 +
 
 +
It is probably extremely dangerous but wanted to make a note.
 +
 
 +
https://github.com/nextcloud/server/issues/8113#issuecomment-565876798
  
 
=== Bugs ===
 
=== Bugs ===
Line 48: Line 476:
 
Only released version in smecontrib are listed here.
 
Only released version in smecontrib are listed here.
  
{{ #smechangelog: {{#var:smecontribname}} }}
+
{{#smechangelog: {{#var:smecontribname}} }}
  
  
 
<!-- list of category you want to see this page in -->
 
<!-- list of category you want to see this page in -->
 
[[Category: Contrib]]
 
[[Category: Contrib]]
 +
<!-- Please keep there the template revision  number as is -->
  
<!-- Please keep there the template revision  number as is -->
+
===References===
[[contribtemplate::1| ]]
+
# https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html
[[contriblang:: {{#var:lang}} | ]]
+
# https://help.nextcloud.com/t/migration-from-mysql-to-mariadb/6816/3
 +
# https://help.nextcloud.com/t/changing-mariadb-socket-when-hosting-multiple-db-ubuntu/68294
 +
# https://markus-blog.de/index.php/2019/10/21/how-to-migrate-nextcloud-17-database-backend-from-mysql-to-postgresql/
 +
# https://www.ullright.org/ullWiki/show/nextcloud-cheatsheet

Revision as of 18:51, 12 August 2024




nextcloud
Nextcloud Logo.svg
nextcloud logo
MaintainerUnnilennium
Urlhttps://nextcloud.com
LicenceAGPLv3
Category

Cloud

Tags cloudfilesdropboxseafilepydioajaxplorerowncloud


Maintainer

Jean-Philippe Pialasse

Version

Contrib 10:
Contrib 9:
smeserver-nextcloud
The latest version of smeserver-nextcloud is available in the SME repository, click on the version number(s) for more information.


Contrib 10:
nextcloud-src
The latest version of nextcloud-src is available in the SME repository, click on the version number(s) for more information.


Description

Nextcloud is a suite of client-server software for creating and using file hosting services. It is functionally similar to Dropbox, although Nextcloud is free and open-source, allowing anyone to install and operate it on a private server.

As per SME Server Keep It Simple, all your ibays and home folders will be accessible through the nextcloud interface using the "external files" app. You will also have your main user user Nextcloud folder saved under /home/e-smith/files/owncloud/data which is in the default backup path. So you can now enjoy both your own cloud repository with access to the very same files on your samba share!

How do I add my SME users ? They are already there ! Just tell them to connect to https://mydomain/nextcloud. You can also add external users or allow them to register with a nextcloud app.

What are the admin ? By default you have a nextcloudadmin user and the regular SME admin user. First one use the password you can see with "config getprop nextcloud AdminPassword", and second one, well, just use your regular admin password. Then you can manage apps, external files repos and admin group membership.

Installation

yum install smeserver-nextcloud --enablerepo=smecontribs

you might need a second event or sometime ibays folder is not visible

signal-event nextcloud-update

You do not need to follow the Repo pages of fws and remi-safe to install those two needed repos, instead use the packages to install them followed by a yum-modify event. Then run the main installation.

yum install smeserver-extrarepositories-remi-safe smeserver-extrarepositories-fws smeserver-extrarepositories-epel
signal-event yum-modify
yum install smeserver-nextcloud --enablerepo=smecontribs,epel,fws
signal-event webapps-update
service php-fpm start
service php71-php-fpm start
service php72-php-fpm start
service php73-php-fpm start
signal-event nextcloud-update

you can skip the service php-fpm* commands if it was already installed and running before the installation of nextcloud

then you can do the following and you can safely ignore the signal-event post-upgrade reboot if prompted, unless you also installed other packages that needs to do so.

config set UnsavedChanges no

or do

signal-event post-upgrade 
signal-event reboot

then

signal-event nextcloud-update

if you want to add SME user admin as administrator of nextcloud do

 OCC group:adduser admin admin

you might want to set your default phone region (use your country 2 letter code - low case)

occ config:system:set default_phone_region --value="us"

you might want to have nextcloud accessible to the Internet

config setprop nextcloud access public
signal-event nextcloud-update

Use a dedicated domain to connect to Nextcloud

first change the first line variable content with you nextcloud domain as defined with your DNS provider.

NEXTCLOUDDOMAIN="cloud.mydomain.com"
db domains set $NEXTCLOUDDOMAIN domain Description "Nextcloud" Content Primary Nameservers internet TemplatePath WebAppVirtualHost DocumentRoot /usr/share/nextcloud RequireSSL enabled letsencryptSSLcert enabled
signal-event domain-create $NEXTCLOUDDOMAIN

# this one to let nextcloud DAV be redirect correctly and to have collabora recognize the domain
config setprop nextcloud VirtualHost $NEXTCLOUDDOMAIN
signal-event nextcloud-update

# only if you use a Let's Encrypt certificate
expand-template /etc/dehydrated/domains.txt
dehydrated -c

Configuration

property default values
AdminPassword GENERATED string password for your main admin user for nextcloud (*)
AdminUser nextcloudadmin string main admin user for your installation (*)
cliurl enabled enabled,disabled force overwrite.cli.url to https://domain/nextcloud or https://domain if virtualhost is set; disable it if you have specific needs and then use occ command to set your value
DbName nextcloud string for mysql db
DbPassword GENERATED string for mysql db
DbUser nextcloud string for mysql db
TrustedDomains empty strings coma separated add domain or ip that are in need to be added to default access to nextcloud
VirtualHost empty domain name domain dedicated to nextcloud, needs to also be defined as domain on the server
access private private, public
status enabled enabled,disabled
MaxUploadSize 4096M number if a number will be converted to Megabytes, otherwise use the usual suffix : 2T for 2 terrabytes etc...
MemoryLimit 528M number webinterface : if a number will be converted to Megabytes, otherwise use the usual suffix : 2T for 2 terrabytes etc...
memory_limit 1024M number for cli like occ command or cron: if a number will be converted to Megabytes, otherwise use the usual suffix : 2T for 2 terrabytes etc...
Shares enabled enabled,disabled add the samba shares from the shared-folders contrib in the nextcloud ibays folder along with regular ibays
IncludeIbay empty strings coma separated add ibays names that need to be include. If not empty, only the name present here will be accessible via nextcloud. Take precedence over ExcludeIbay. You set it with a random string to exclude all ibays and shares from automatic inclusion.
ExcludeIbay Primary strings coma separated will exclude from nexcloud access any ibay via nextcloud. Default excludes Primary ibay. If you want to include Primary set it with a random string.
opcache.memory_consumption 32 number update this value if Nextcloud says that it should be
opcache.interned_strings_buffer 128 number update this value if Nextcloud says that it should be
PHPBaseDir colon separated string php base dir you want to add to the default example /home/e-smith/files/ibays/musique/files:/usr/share/GeoIP/GeoLite2-Country.mmdb:/proc/cpuinfo
UseSMB enabled enabled,disabled allow you to set ibay access via samba share or via Local driver in nextcloud. Enabled is for samba, this allow you to access as your user and have your quota accounted. It might be a little slower, and need you to have your password loaded in the session. Local driver if disabled, will let you access only what apache user (www) has right to access as member of a group.

(*) the SME admin user is also an admin of your nextcloud installation. You have two admin account as per default installation on SME Server.


example of setting :

 config setprop nextcloud ExcludeIbay ibay1,ibay2
 signal-event nextcloud-update

LDAP/AD Integration Settings

Do not change the LDAP/AD integration settings for "1. Server: Localhost" or you will break the Nextcloud install. If you want to add a second LDAP/AD server, click the "+" symbol to add another configuration and then add the appropriate LDAP/AD settings.

Command line

if you happen to need tweaking your installation, here is how to access the command line for Nextcloud on SME, we made it easier for you, just log as root and use the OCC command (using capitals), This command will execute for you what you need as the www user, using the needed version of php. Here two examples:

occ maintenance:mode --off
occ maintenance:repair

to seek for additional command consult Nextcloud documentation : https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html

Upgrade

yum  update smeserver-nextcloud nextcloud --enablerepo=smecontribs

CLI upgrade of Nextcloud software

You should rather prefer the online updater, but in case:

occ maintenance:mode --on
sudo -u www /usr/bin/php74 --define memory_limit=1024M -d apc.enable_cli=1 /usr/share/nextcloud/updater/updater.phar --no-interaction
occ upgrade
occ maintenance:mode --off

In case of a huge db, you can choose the online updater and then only issue the db update doing

occ upgrade
occ maintenance:mode --off

starting 25 to upgrace to 26, you should do

occ maintenance:mode --on
sudo -u www /usr/bin/php81 --define memory_limit=1024M -d apc.enable_cli=1 /usr/share/nextcloud/updater/updater.phar --no-interaction
occ upgrade
occ maintenance:mode --off

In case of a huge db, you can choose the online updater and then only issue the db update doing

occ upgrade
occ maintenance:mode --off

Restore info loglevel

occ config:system:set loglevel --value=3

Uninstall

Warning.png Warning:
if you plan to reinstall and had the nextcloud rpm installed do not yum remove it or rpm -e it as it would put you in a situation where you will not be able to reinstall and restore your old data. nextcloud-src rpm if present do not create such situation and can be removed safely.


Uninstalling the rpms

yum remove smeserver-nextcloud  nextcloud-src
rpm -e --justdb nextcloud

those folders will then remain

  • /usr/share/nextcloud : software and config
  • /home/e-smith/files/nextcloud : user data

also you will have mariadb or mariadb105 with nextcloud db and user.

And finally, db configuration with entry for nextcloud.

If all of those remains as is, a simple reinstall of the contrib will bring back nextcloud running. If you uninstalled it because your install was non functional or want a complete removal, there are extra steps.

In case of deleting either the db or part of the software folder, whenever you will try to reinstall the contrib, process will fail as db and files are not in sync.

In case you need to reinstall from scratch, first, backup what you might want to restore latter:

cd /home/e-smith/files/nextcloud/data
mysqldump nextcloud > nextcloud55.sql
mysqldump105 nextcloud > nextcloud105.sql
config print nextcloud /root/nextcloud.config
tar -czf   /root/nextcloud.tar.gz /home/e-smith/files/nextcloud/data /usr/share/nextcloud

then erase all what is remaining:

mysql -e "DROP DATABASE `config getprop nextcloud DbName`;DROP USER IF EXISTS `config getprop nextcloud DbUser`;"
mysql105 -e "DROP DATABASE `config getprop nextcloud DbName`;DROP USER IF EXISTS `config getprop nextcloud DbUser`;"
rm -rf /usr/share/nextcloud
rm -rf /home/e-smith/files/nextcloud
#this one is optional, and should not cause issue if still there
config delete nextcloud

and you should be able to start a new install from scratch

Release schedule

see https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule

as per 2024/01:

Version Name Release date End of life
30 2024-09-14
29 Hub 8 2024-04-24 2025-04
28 Hub 7 2023-12-12 2024-12
27 Hub 6 2023-06-13 2024-06
26 Hub 4 2023-03-21 2024-03
25 Hub 3 2022-10-19 2023-10
24 Hub 3 2022-05-03 2023-05
23 Hub 2 2021-11-30 2022-12
22 Hub 2021-07-06 2022-07
21 Hub 2021-02-22 2022-02
20 Hub 2020-10-03 2021-11
19 Hub 2020-06-03 2021-06
18 Hub 2020-01-16 2021-01

Change Database

If you are in the situation your are unable to update your nextcloud because of database requirements, you might need to install a newer and then migrate your db.

Here a simple procedure, after having the new db working as a sclo Mariadb105 for SME10 as example.

occ maintenance:mode --on
mysqldump `config getprop nextcloud DbName` > nextcloud.sql
echo "CREATE DATABASE IF NOT EXISTS `config getprop nextcloud DbName` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"| mysql105
mysql105 `config getprop nextcloud DbName`< nextcloud.sql
echo "CREATE USER IF NOT EXISTS `config getprop nextcloud DbUser`@localhost IDENTIFIED BY '`config getprop nextcloud DbPassword`';"| mysql105
echo "GRANT ALL PRIVILEGES ON `config getprop nextcloud DbName`.* TO `config getprop nextcloud DbUser`@localhost; FLUSH PRIVILEGES;" | mysql105
occ config:system:set dbhost --value localhost:/var/lib/mysql/mariadb105.sock --type string
occ maintenance:mode --off

After checking that all is working you can then delete yourself the old db from the previous mysql server, or keep it as a backup for a while. If it fails and just want to go back to previous state:

occ maintenance --on
occ config:system:set host --value localhost --type string
occ maintenance --off

File Scan

# scan all, could take hours if you have a lot of files
occ files:scan -v --all
# scan all that is inside a username path (including external storages mounted there)
occ files:scan -v myusername
#scan only a subfolder of a user (path needs a heading / and is relative to /home/e-smith/files/nextcloud/data)
occ files:scan -v --path="/myusername/files/myfolder/mysubfolder" myusername
#For external storage one has to use a user and the mount point in the user space, e.g. admin
occ files:scan -v --path="/admin/files/name_of_external_storage"

If you use groupgfolders app, then you might consider, to list the golders id

occ groupfolders:list

then for folder group with id 1

occ groupfolders:scan 1

Known issues

Web or GUI upgrade from NC25 to NC26

Due to the change of php version needed from php74 to php80 and higher, you need to issue the following command while using NC25 to be able to then upgrade to NC26. NC25 is the first to be able to handle php80, and NC26 requires php80 or higher.

signal-event nextcloud-update

Issue importing files in db "Entry path/to/file will not be accessible due to incompatible encoding"

yum install convmv --enablerepo=epel
#first test to see the changes
convmv -f utf-8 -t utf-8 --nfc -r /home/e-smith/files/nextcloud/data/username
#check, then with --notest
convmv -f utf-8 -t utf-8 --nfc -r --notest /home/e-smith/files/nextcloud/data/username
#then rescan 
occ files:scan -p /username/files/

this might also occurs on ibays / home folders and their files not all visibles from nextcloud, simply adapt the path for convmv /home/e-smith/files/ibays/ibayname/files/ or /home/e-smith/files/users/userame/home/

Remove legacy nextcloud rpm without deleting /usr/share/nextcloud content

for installs done before smeserver-nextcloud 1.2.0-16, the rppm nextcloud was required and was conflicting with web update. Since 1.2.0-16 it is not required anymroe and we use a nextcloud-src rpm which updates itself in /usr/share/nextcloud-src and is only used if you install the first time or restart from scratch your install. To remove the nextcloud rpm which is not needed and save your files:

rpm -e --justdb nextcloud

source https://unix.stackexchange.com/questions/208722/how-to-remove-an-rpm-package-while-keeping-certain-files

User cannot see shares/files

After a new install the admin user could see shares but not a user.

We had a single ibay and it was set:

Group Everyone
Write group
Read everyone

We created a new group called localusers and added the admin and single user.

We then set the ibay:

Group localusers
Write group
Read group

This appeared to fix the issue and the user could now see the files.

Upgrading beyond 20.x

To set the default phone region:

OCC config:system:set default_phone_region --type string --value="GB"

To fix missing indices - this may take a while so be patient:

OCC db:add-missing-indices

NC 20-21 : open_basedir restriction in effect. File(/templates/) is not within the allowed path

this is a bug in NC. It has been fixed in NC 22 and not backported to NC20. This is just log noise. You can ignore it while waiting to update see https://help.nextcloud.com/t/error-file-templates-is-not-within-the-allowed-path-s-after-update-from-20-xx-to-21-0-3/119843

Reset Database

For reference, whilst looking at resetting file caches I found this.

It is probably extremely dangerous but wanted to make a note.

https://github.com/nextcloud/server/issues/8113#issuecomment-565876798

Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-nextcloud component or use this link


Below is an overview of the current issues for this contrib:

IDProductVersionStatusSummary (8 tasks)
12685SME Contribs10.0VERIFIEDInstall fails when attempting occ cmd at cli and no browser access
12611SME Contribs10.0RESOLVEDupdate cron script with maintenance_window_start
12609SME Contribs10.0CONFIRMEDsmeserver-nextcloud S30nextcloud-occ-conf errors when run via ddclient panel
12487SME Contribs10.0CONFIRMEDupdate nextcloud fail2ban filter
12486SME Contribs10.0RESOLVEDocc requires /sbin/e-smith to be in the path
12406SME Contribs10.0CONFIRMEDNFR switch to PHP83 support for NC 29 and after
11169SME Contribs10alphaCONFIRMEDsmeserver-nextcloud requires a modify script
10566SME Contribs10.0CONFIRMEDNFR: split action nextcloud-occ-conf

Changelog

Only released version in smecontrib are listed here.

smeserver-nextcloud Changelog: SME 10 (smecontribs)
2024/05/16 Jean-Philippe Pialasse 1.2.0-31.sme
- fix php version on initial install [SME: 12685]

2024/04/12 Jean-Philippe Pialasse 1.2.0-30.sme
- add maintenance windows start [SME: 12611]

 increase frequency of cron task every 5 min
- fix missing full path [SME: 12486]

2024/01/29 Jean-Philippe Pialasse 1.2.0-29.sme
- require nextcloud-src >= 26 [SME: 12318]

 multiple fixes and rewrites
- restore default log level [SME: 12412]

2023/09/09 Jean-Philippe Pialasse 1.2.0-28.sme
- workaround opcache segfault with php 81 using in memory only [SME: 12298]

- index file cache using Redis [SME: 12401]
2023/09/09 John Crisp 1.2.0-27.sme
- Fix syntax error in 20opcache.ini [SME: 12298]

References

  1. https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html
  2. https://help.nextcloud.com/t/migration-from-mysql-to-mariadb/6816/3
  3. https://help.nextcloud.com/t/changing-mariadb-socket-when-hosting-multiple-db-ubuntu/68294
  4. https://markus-blog.de/index.php/2019/10/21/how-to-migrate-nextcloud-17-database-backend-from-mysql-to-postgresql/
  5. https://www.ullright.org/ullWiki/show/nextcloud-cheatsheet