From Mageia wiki
Jump to: navigation, search
OwnCloud/Nextcloud server is a cloud server you can have at home, your company or organisation. Use it to automatically sync and share files including some revisioning, it can sync between servers, and it can run some applications like calendar, address book, office applications too. Nextcloud forked from ownCloud. There are both open source and a commercial branch of both. Clients work with either server and exist for common desktop and mobile operating systems.

Contents

General info

ownCloud/Nextcloud compared to common external cloud solutions:

Benefits

  • Your data remains in-house, i.e not placed on the servers of third parties where you have no control of who sees it: foreign governments, cyber criminals, your business rivals, etc.
  • No external dependencies (internet connection, health of internet provider and cloud provider)
  • No external costs
  • High speed on large files, large data, quick (server side) snapshots and backups
  • Fine control of shares https://owncloud.com/how-to-avoid-oversharing-with-owncloud/ and can connect to other servers

Drawbacks

  • The server consumes a lot of CPU cycles per file. Consider Seafile instead if performance is an issue.
  • Transfer is not very intelligent, i.e may transfer identical file. (depending on timestamp etc. old info - need to check up)
  • Even for a small change, the whole file is sent. Note this is harder to solve and less useful than easy thought.
  • Need to arrange off-site backups in another way (or let it share with client or server off-site)
  • Takes some administration, and reading instructions, like this page...

Differences

Like most synchronising services, ownCloud/Nexctloud clients do not follow symlinks. - i.e Dropbox does. There seems to be a discussion about cons and pro on every client type forums...

Alternatives

ownCloud and Nextcloud

Both clients of latest versions are still compatible with both servers.

Mageia 5 have ownCloud server up to 9.1 and ownCloud clients, and Nextcloud 9 and 10 server. IMPORTANT: latest versions are in backports repo. For new installs install from backports repo, and before upgrading to Mageia 6 you must have upgraded to Nextcloud 10. Upgrading must not skip any major version! - see #Upgrading!

Mageia 6 have in release repository Nextcloud 11 server which is upwards compatible with Nextcloud 10 found in Mageia 5 backports. NC12 is in updates, see #News.

Cauldron has Nextcloud 13.

In texts below generally describing any of them, "ownCloud" also represent "Nextcloud".

Other file sync server and clients packaged in Mageia 6

Seafile

https://github.com/haiwen/seafile https://www.seafile.com/

Syncthing

Serverless cluster type Open Source Continuous File Synchronization

https://syncthing.net/, https://docs.syncthing.net/users/faq.html

News

  • Mageia 5 have in core updates: ownCloud server 8.0.15, client 1.8.3, BUT higher versions of both in backports, and also Nextcloud 10 - for new installs use the latest in backport directly!
  • Mageia 6 have switched from ownCloud to Nextcloud - both server and client. Nextcloud 11 in release media, NC12 in updates.
  • NOTE: For upgrading Mageia 5 to Mageia 6 it is important to read #Upgrading - you must iterate upgrading through every major version, with some manual intervention and check between each. Also: when upgrading mga5 to mga6 *avoid* updating to NC12 in updates; you must first get NC11 running if you had NC10 on mga5.
  • Nextcloud 12 (12.0.6) is provided (around first of May?) in Mageia 6 updates. Not in backports, because NC11 is already unsupported, and serious Mageia should already have upgraded from unsupported mga5 and NC10 to mga6 and NC11.
  • Subpackages: From NextCloud 12 and on we provide one subpackage for each database alternative: nextcloud-mysql, nextcloud-postgresql, nextcloud-sqlite.

Late ownCloud and Nextcloud clients are compatible with both late servers

In progress in this document

Nextcloud 12 & 13.

To do in this document

  • Write about enabling Nextcloud built-in updater? (Better than #Facilitating_auto_update - also see #File permissions.
  • Update when needed
  • At Mageia 7 clone to a pure Nextcloud page, and remove/rewrite from ownCloud.

Installing

For a short version, see #Brute force reinstall but skip the UNINSTALL section.

Also see the manual for the version you are installing, i.e https://docs.nextcloud.com/server/12/admin_manual/installation/

Database choices

One of three database engines can be used: SQLite, PostgreSQL, MariaDB. From Nextcloud 12 and on we provide one subpackage for each database alternative: nextcloud-mysql, nextcloud-postgresql, nextcloud-sqlite. Choose nextcloud-mysql if you go by this wiki page.

SQLite is deprecated for performance reasons.

For a quick example using PostgreSQL, see test.

This wiki page will use MariaDB as it is most recommended by ownCloud and Nextcloud developers.

Install packages

Basically, we install a LAMP stack, plus ownCloud to run on it. You may also reference http://www.unixmen.com/how-to-install-lamp-stack-on-mageia-5/ When available in Mageia, PHP version 7.x is preferred (after Mageia 6)

Fundamental

All packages in this howto are from Mageia repos

  • MariaDB - recommended database engine
  • php-pdo_mysql - for php to use MariaDB
  • apache-mod_php - php5 for use with apache

So issue urpmi mariadb apache-mod_php php-pdo_mysql php-fileinfo which also pull in all else needed, including Apache and a lot of php.

  • chrony - use ntp so servers time is in sync, so ownCloud can decide correctly which file is elder. -The same goes for the ownCloud client systems! Probably you already have this - it is good to have regardless of ownCloud...

Note: easiest to set up chrony in KDE/Plasma is by right-clicking the clock in system tray -> adjust date and time -> check activate network time protocol - it installs chrony, and in the pulldown there set which NTP server to sync to.

Mageia 5: Latest version is in backports !

i.e http://your_favourite_/mirror/mageia/distrib/5/x86_64/media/core/backports/ - So for new install on mga5 download nextcloud-10.0.5-5.mga5.noarch.rpm from there and then urpmi that file.

Mageia 6: Latest version is in updates

So with updates enabled simply urpmi nextcloud

Suggested

urpmi apache-mod_ssl phpmyadmin webmin

For more functionality

More modules may be needed, see i.e https://doc.owncloud.org/server/9.1/admin_manual/installation/source_installation.html

Configuration

Configure the database engine MariaDB

  • Already taken care of by mageia package php-pdo_mysql : it adds /etc/php.d/73_pdo_mysql.ini containing the line extension=pdo_mysql.so that owncloud install documentation tells us to add to mysql.ini.

All commands below need be entered as root.

  • Start MariaDB (i.e it was just installed) systemctl start mysqld It seems installing the rpm also sets MariaDB to start at boot (should it not, issue 'systemctl enable mysqld' )
  • Issue mysql_secure_installation to set/edit MariaDB administrative "root" password and perform a few security measures - just reply to the questions.
  • Then log in using that password: mysql -uroot -p, and there create the database and define its user and password: enter lines below, but your credentials:

CREATE USER 'OCserverUsername'@'localhost' IDENTIFIED BY 'OCserverPassWD'; - Invent a username and password for ownCloud to use for mariaDB, keep 'localhost'
CREATE DATABASE IF NOT EXISTS owncloud; - Name of the database is good to have as "owncloud"
GRANT ALL PRIVILEGES ON owncloud.* TO 'OCserverUsername'@'localhost' IDENTIFIED BY 'OCserverPassWD';
quit;

File storage

By default user files are stored in /usr/share/owncloud/data/, which is a link to /var/lib/owncloud/

Also owncloud.log is there, and if you chose to use SQLite, its database files.

You may choose to use another location, i.e a dedicated ext4 partition in an LVM so you can extend it and also make snapshots. You may also have that whole LVM encrypted. The cost is a slightly poorer performance. On a raid? Your choice.

For this example lets say you mount it at /mnt/owncloud. You must make a data folder, and following #Upload buffering folder also a tmp folder, and set the correct rights and ownership, example:
mkdir -p /mnt/owncloud/data
mkdir /mnt/owncloud/tmp
chmod -R 770 /mnt/owncloud
chown -R apache:apache /mnt/owncloud

Note: If you do not place your data folder out of direct webserver access like that; if you and keep it under www/ instead: then check that data/.htaccess effectively looks like below. (for apache 2.4 - if 2.2, first line should read "deny from all")

Require all denied
IndexIgnore *

-or else your data may be accessible from internet!

Configure PHP

Php logging

Create the file and set apache as user. As root:
touch /var/log/php-errors.log
chown apache:apache /var/log/php-errors.log

In /etc/php.ini: error_log = /var/log/php-errors.log By default everything else seem correct, i.e log_errors = On .

Upload buffering folder

It is defined in /etc/php.ini By default upload_tmp_dir = /var/tmp . It is a good idea to use a tmp folder in same filesystem as data folder, so following above example set it to /mnt/owncloud/tmp .

In /etc/php.ini you most probably want to to increase (default in parenthesis) upload_max_filesize (16M) , and maybe max_file_uploads (20) .

Configure php timezone

Some php scripts like the apcu web interface (see PHP caching below) will complain a lot in php-errors.log unless timezone is set, so in /etc/php.ini uncomment and modify the line date.timezone so it looks like date.timezone = Europe/Stockholm where the last part is your zone according to http://php.net/manual/en/timezones.php

OwnCloud needs to write

... a few folders (which you may see a complaint of in the above tool), so enter:

cd /usr/share/owncloud
chown apache:apache config data apps

ref: https://doc.owncloud.org/server/9.0/admin_manual/installation/source_installation.html#setting-strong-directory-permissions

Firewall

In Mageia Control Center -> Security -> Personal firerwall the "Webserver" must be checked. ( or define ports manually in the field "advanced" if other ports are used: see #How_to_change_the_port_ownCloud_is_using )

Configure ownCloud

  1. Browse to https://localhost/owncloud,
  2. Invent, note down safely, and and fill in your ownCloud administrator login name and strong password,
  3. Click Storage & Database,
    1. State the location for data storage, per above suggestion it is /mnt/owncloud/data,
    2. Choose MariaDB, and for it state the same as you used in #Configure the database engine MariaDB for OCserverUsername, OCserverPassWD, database name (owncloud), "localhost",
  4. Verify all is entered correctly and press Finish setup After a few seconds you are logged in,
  5. Logged in, in the a pulldown rightmost up: select the Admin}} entry ( direct link: http://localhost/owncloud/index.php/settings/admin),
  6. For better security set enforce https (need apache-mod_ssl, see #Suggested (this option seem to be on/automatic hidden in newer versions),
  7. Disable functions you do not need,
  8. Set send email and test, but first visit Personal in that same dropdown menu top right to set your receive email,
  9. In that drop-down menu select Users to add and manage users and their quota etc,

Most settings are stored in /usr/share/owncloud/config/config.php (linked from /etc/owncloud/config.php. Much more can be set, see https://doc.owncloud.org/server/9.1/admin_manual/configuration_server/config_sample_php_parameters.html

Checking the setup

  • OwnCloud and Nextcloud servers check a lot of things and report problems on the web interface admin page.
  • For external test see #Automated tests
  • For local tests see below:

Built in checks

On the web interface admin page i.e https://localhost/owncloud/index.php/settings/admin at top you may see some warnings in red about security problems and optimisation proposals. They are self-explanatory and at bottom of admin page you have some links to documents, and also search/look around on *this* page you read here ;) Also see https://doc.owncloud.org/server/9.1/admin_manual/configuration_server/security_setup_warnings.html

You most probably see "Some files have not passed the integrity check." which is normal on an install from a package. Explanations [here] and [here]. For more info see https://doc.owncloud.org/server/9.1/admin_manual/issues/code_signing.html#code-signing-fix-warning-label.

Some of the warnings are also shown in orange on top of every page, but only for admins.

Check PHP

Below is a very simple script. You dont need it if you create the #OwnCloud test script as that includes this function.

<?php
phpinfo();
?>

Save as /var/www/html/testphp.php, then restart apache systemctl restart httpd and head your browser to http://localhost/testphp.php (if surfing from other than local machine replace 'localhost' as appropriate.)

OwnCloud test script

This script checks and reports on many aspects of the installation: Get "OwnCloud Tools" from first post http://forum.owncloud.org/viewtopic.php?f=8&t=2921 - As described there: grab the content in the list box, edit in a password on line two, and save as /usr/share/owncloud/tools.php, owner root, permissions -rw-r--r-- . Then go to https://localhost/owncloud/tools.php (modify 'localhost' to owncloud server IP if from another machine) and log in using that password.

Check around that things look OK! Note: it will complain about .htacess not working even when you have moved your data folder away from webserver, see "Prepare storage" above.

Check the logs!

How to find webserver or ownCloud logfile: https://forum.owncloud.org/viewtopic.php?f=17&t=7330 OwnCloud logfile is also viewable and downloadable from its web UI admin page. Default log locations - per install instructions above:

  • ownCloud: /mnt/owncloud/data/owncloud.log (default: /usr/share/owncloud/data/owncloud.log - it is in in the data folder.)
  • MariaDB: /var/log/mysqld/mysqld.log
  • php: /var/log/php-errors.log
  • apache: /var/log/httpd/error_log

Security

(change number for relevant server version in links below)

https://docs.nextcloud.com/server/11/admin_manual/configuration_server/harden_server.html

https://doc.owncloud.org/server/9.1/admin_manual/installation/installation_wizard.html

File permissions

See "Setting Strong Directory Permissions" in the links above. But also look here!; Lately, the recommendation has changed from setting strong protection, to instead promote setting adequate protection so the updater can run, so users update regularly which is more important: 750 on directories, 640 on files. For an *example* of a script for setting permissions, see point 16 here.

Automated tests

Access from internet

Ensure that your ownCloud defaults to HTTPS and does not allow HTTP access. You must have installed package apache-mod_ssl as recommended above for HTTPS to work.

Router port forwarding

Forward both tcp and udp on port 443 (HTTPS) and maybe port 80 (Insecure: HTTP Not recommended) to the computer hosting your OwnCloud. The manual for your router should explain how.

How to change the port ownCloud is using

For some setups i.e other web servers are present, you want this machine to serve web on other ports https://forum.owncloud.org/viewtopic.php?f=17&t=15501 Naturally, also change the firewall setting on the machine accordingly...

Register a name for your Dynamic IP number

If you do not have static IP i suggest registering a name at a site for dynamic DNS (dyndns.org, noip.com. and others... Many modern routers have an inbuilt capability to update the IP number automatically at one or more such sites often - check what your router support.) For the example below, say you register mydynamicsite.dyndnsprovider.biz

Trusted domain

For ownCloud to accept connection from mydynamicsite.dyndnsprovider.biz it have to be set in "trusted_domain" in config.php. An easy way to achieve this is to locally log in as admin, and issue a command in browser address field. Example: log in as an administrator at myserver.LAN.IP.adress/owncloud and then in browser address field issue myserver.LAN.IP.adress/owncloud/index.php/settings/admin?trustDomain=mydynamicsite.dyndnsprovider.biz

How to set upload split size (chunking)

In order to avoid timeouts on larger files uploading from the client on slow connections, see http://forum.owncloud.org/viewtopic.php?f=14&t=24595 https://github.com/owncloud/client/issues/766

It is set to 5MB by default in ownCloud 8.x.

Tips & Tricks

Also see very useful links for optimising, backup and security at bottom of admin page, i.e https://my.ser.ver.ip/owncloud/index.php/settings/admin#admin-tips

The occ command line

The command line is powerful, see https://doc.owncloud.org/server/9.1/admin_manual/configuration_server/occ_command.html . Remember to run it as user "apache".

Maintenance mode

There are different maintenance modes, more elegant than stopping the server completely when doing backups or upgrades. https://doc.owncloud.org/server/9.1/admin_manual/maintenance/enable_maintenance.html

Stop, start

Use for easiest and safest upgrades and backup:

systemctl stop httpd.service

systemctl start httpd.service

Drawback: actually stops/starts Apache, so all other services it run too...

- If you do not want to stop Apache, use #Maintenance mode instead.

Uploading files by other means

In order to load lots of files initially on the server, many have experimented on how to bypass ownCloud and load files directly to the data directory, then let ownCloud index what it have. Examples see https://forum.owncloud.org/viewtopic.php?f=17&t=7236&start=30 and also find tip in the link in Throughput below.

OwnCloud will still work the server very hard as it indexes all these new files. If you are going to store a lot of files, or move them around often, then consider using the mySQL or a similar relational database option rather than SQLite.

Backing up

Consistency between files and database must be guaranteed! Easiest is to stop ownCloud/Nextcloud (actually stop Apache) before backing up. If you do not want to stop Apache, use #Maintenance mode instead.

What to back up

  • The data directory tree!
    • - If you have configured a non default location, you know where it is :)
    • - If instead kept as default installed by Mageia owncloud rpm it is /var/lib/owncloud/, linked to /usr/share/owncloud/data/ , so included if you you back up /usr/share/owncloud/.
    • - A fresh Mageia install of Nextcloud analogously have /var/lib/nextcloud/, linked to /usr/share/nextcloud/data/.
    • NOTE: A Mageia Nextcloud installation migrated from ownCloud still use /var/lib/owncloud/, linked to /usr/share/nextcloud/data/ (see #Migrating OC->NC).
  • Maybe take whole /usr/share/owncloud/ for all apps, theming etc. NOTE:
    • Configuration subfolder config/ is linked from /etc/owncloud/ (config.php)
    • Actual data subfolder may be linked from data/, see above.
  • /etc/owncloud/ (maybe not needed; linked, see above)
  • /var/lib/mysql/ - the database - or better: save database by recommended method: see #Save database
  • /etc/my.cnf , /etc/my.cnf.d/ - MariaDB configuration file/folder (depending on version(?))
  • /etc/httpd/conf/sites.d/owncloud.conf
  • /etc/httpd/conf/httpd.conf - apache configuration file

More info and command examples (change number according to your version) https://doc.owncloud.org/server/9.1/admin_manual/maintenance/backup.html https://docs.nextcloud.com/server/10/admin_manual/maintenance/backup.html

Save database

Use the nice #PhpMyAdmin or #Webmin, or: http://forum.owncloud.org/viewtopic.php?f=26&t=19400 , http://forums.mageia.org/en/viewtopic.php?f=8&t=7187&p=46069 . Backup script for MariaDB http://forums.mageia.org/en/viewtopic.php?f=5&t=7338&p=46877

Useful scripts

https://help.nextcloud.com/t/scripts-for-backup-restore/21433?source_topic_id=30360

Reinstall/Uninstall/Install Applications

https://central.owncloud.org/t/how-to-cleanly-re-install-an-app/859/2

Reinstall

For a total reinstall of ownCloud:

  • Make sure you know what users you have and will want to define again, how much data space they need.
  • If you plan to do a fresh upload of all data, and skip backup od ownCloud data folder: make sure you know if there are data stored only on the server currently...
  • Make sure you know what applications are used, which you would want to use again.
    • NOTE: If you are to migrate to a newer ownCloud/Nextcloud version, some apps (i.e calendar and address book) need to export their data in order to be importable to a newer version
  • Stop using the cloud, stop apache, uninstall ownCloud, start apache. (so all ownCloud data is stable, and apache again runs other services)
  • #Backup
  • Install, per the beginning of this document...
    • For a complete reinstall clean out settings and config files before installing. Hints:, see #Backup. (i.e delete/rename /etc/owncloud/config.php) And create a new fresh database.

For reference: #Brute force reinstall

Have there been problems?

Some ideas before needing reinstall:

  • file ownership and rights problem?
  • if you suspect there have been program version conflicts, reinstall php packages, and maybe more...
  • if database was corrupt try creating an empty one, and then using ownCloud register users again. There have been reports that such have worked even for migrating between databases and users found their content again, but no guarantees! - keep backup.
  • If you do not care about content then you can, of course, remove all data before reinstalling.

Several ways to connect

  • Html browser:
    • log into the WEB UI at https://server/owncloud. Upload, download, create... Manage share folders and files. You can create sharelinks to files or folders, with password. Log in as administrator to manage ownCloud.
    • Receiver of a shared link opens it and get access to the shared file/folder (only)
    • Use web browser as file browser: enter http://server/owncloud/remote.php/webdav/ and log in.
  • Recommended: ownCloud/NExtcloud sync client continuously syncronises selected folders on your computer(s) with your account (more below)
  • There are simpler sync client apps for iOS and Android, that also can do instant uploads of taken photos and videos
  • Use a file browser:

File browser + WebDAV

You can connect your file browser to an ownCloud server using the WebDAV protocol. Example: in Dolphin write webdav://server/owncloud/remote.php/webdav/ , where "server" is your servers IP number or hostname. Append a subdir if you want ( ...webdav/sub/dir/tree ). There will pop up a dialog for username and password, then you browse the files in your ownCloud account!

The ownCloud sync client

Install

Mageia 5:

  • Install the package owncloud-client last version from core_backports repository.

Mageia 6:

  • Install the package nextcloud-client - check backport repo for eventually latest version
  • Optionally nextcloud-client-dolphin / nextcloud-client-nautilus / nextcloud-client-nemo for more integration: shows check marks on synchronised items. Use same version as nextcloud-client.

Client manual - configuration file

Notes

  • Downloaded folders (that did not exist on the client before) get the date of download - their time stamp is not synced. Issue https://github.com/owncloud/core/issues/14008 and more.
  • In the root of each sync root folder there is the Database .csync_journal.db and a log .owncloudsync.log. While the client runs there also exist .csync_journal.db-shm and .csync_journal.db-wal.
  • The clients configuration is by default in ~/.local/share/data/ownCloud - most is plain text.
  • The client can show a log window and also log to file. For more info start ownCloud with command line parameter -h (for help).
  • Change log (same for ownCloud and Nextcloud clients): https://owncloud.org/changelog/desktop/

Tips

Sync with another server

If you now and then want to sync to another server than your usual one, stop the running ownCloud client and start it with another configuration like this: /usr/bin/owncloud --confdir $HOME/.local/share/data/ownCloud-myotherserver. If that folder does not exist it will create a clean one, and you set up ownCloud like usual from the beginning.

It is convenient to copy the launch item from desktop menu and enter the different confdirs in different launch items. Set the one you want to have started at login. (For KDE it is in System Settings -> Start and Shutdown.)

Syncing with more than one server at the same time

Clients 2.x can do that. (in Mageia 5 backport, and Mageia 6 + )

Old clients 1.x can only sync to one server at a time.

Syncing a dual boot system (linux/windows)

Syncing same tree from different OS:es (or users on same system) is officially not supported.

It seem to have worked with clients 1.8.3 though for me (with tricks per link here), but I experienced problems using 2.1.0. http://forum.owncloud.org/viewtopic.php?f=14&t=19672&p=78867#p78867

Client upgrading

Mageia 5: The ownCloud 2.x client is so different from 1.x that it deserved a place in backport on Mageia 5, because it needs user interaction for configuring to work after the update and we do not want automatic update to break anything. The upgrade can be done ASAP on Mageia 5 from backports repo.

Migrating ownCloud 2.x client to Nextcloud client

Mageia 6 have the Nextcloud client. It is fully compatible with ownCloud client, but needs to be configured from scratch OR copy the configuration from ownCloud client if you used version 2 in Mageia 5: ref

Note:

  • The default /etc/ownCloud/sync-exclude.lst may be slightly different to /etc/Nextcloud/sync-exclude.lst
  • If upgrading from client 1.x at the same time as upgrading Mageia from 5 to 6: To ease the procedure uninstall ownCloud client in Mageia 5 before upgrading to Mageia 6, then install Nextcloud client and execute as below

Migrate

  • Make sure ownCloud client is stopped
  • Start Nextcloud client - and close it right when the wizard asks for the server etc. Then issue:

cp -f ~/.local/share/data/ownCloud/owncloud.cfg ~/.local/share/data/Nextcloud/nextcloud.cfg
cp ~/.local/share/data/ownCloud/sync-exclude.lst ~/.local/share/data/Nextcloud/

  • Start the Nextcloud client, enter passwords.

Upgrading

Dragon.png
Here be Dragons!
  • OwnCloud and Nextcloud do not support skipping any x.x version, and migration to Nextcloud should optimally be done on comparable version, so you need to FIRST iterate through all ownCloud updates and then Nextcloud 10 in Mageia 5 core_backports, before upgrading to Mageia 6 !
  • Before starting the Mageia 5 to 6 upgrade, special care is to be taken - see point 5 under procedure below!
  • Some version upgrades need special manual work.
  • Some applications in ownCloud/Nextcloud need special care.
  • Downgrading is not supported and risks corrupting your data.

In Mageia 5, first minor versions updates (x.x.x) up to 8.0.15 is update repository. They after package update only require a user click in the web interface to initiate the actual update. Upgrades to major versions are in core backports repo: ownCloud 8.1.10, 8.2.8, 9.0.9, 9.1.5 and Nextcloud 10.0.5 because they require more manual interaction, Do read #PROCEDURE and #General below !

Mageia 6 have a Nextcloud 11 version in release repository, and Nextcloud 12 in updates. - They too require special care, so read on;

Alternatively

Uninstall ownCloud, delete all its files and database, and then do a full fresh install of latest available Nextcloud (check in core_backports repo) and configure it and users from scratch and upload data from scratch. Some apps such as address book and calendar support exporting data can be imported by a later version.

PROCEDURE

  1. Do read #General below!
  2. Inform users there will be a pause in service due to upgrades.
  3. Take full backups of data, database, settings files. Stop the server (Apache) during this for best quality, alternatively use #Maintenance mode.
  4. For each version:
    1. IMPORTANT: Read documentation about if something specific need be done for that version, see #Per version below.
    2. In the Web UI, disable all apps (logged in as admin, i.e http://localhost/owncloud/index.php/settings/apps)
    3. If you are up to migrating ownCloud to Nextcloud, execute #Migrating OC->NC instead of this point. If upgrading (ownCloud to ownCloud, or Nextcloud to Nextcloud): Just install the update rpm; (urpmi thenextversion) - it seems there is no need to stop the server/Apache for this.
    4. Surf to the Web UI, and initiate the upgrade. It will report the progress and any severe error. You may alternatively use #The occ command line
    5. Check errors, see #Checking the setup, begin with the built-in checks on admin page and see the log there.
    6. Check your configuration files (see #General upgrading cautions)
    7. Enable apps the same way you disabled them. Some may when you enable them pop up a dialogue saying they need an update, some of them ask to update automatically and can do so.
    8. Test file syncing though clients, and if your apps works, and again check server logs for any problems.
    9. Take another backup? (at least after the last update when all is checked OK).
    10. Repeat from sub-paragraph 1 until you have the desired server running;
  5. Only when you run Nextcloud 10, it is possible to upgrade Mageia5 to Mageia 6, but before upgrading Mageia:
    • Disable all plugins - because upgrading to Mageia 6 also brings new Nextcloud version!
    • Add the line /^nextcloud/ to /etc/urpmi/skip.list - to avoid updating to NC12 which is in updates.
  6. Then upgrade to Mageia 6, and then
    1. Perform all Mageia 6 updates.
    2. Remove the line /^nextcloud/ from /etc/urpmi/skip.list, and manually select to install Nextcloud 11 (not 12!).
    3. Follow previous procedure continuing at initiating the upgrade in the Web UI.
    4. When Nextcloud 11 is running OK, perform system update - getting Nextcloud 12, perform actions described at #Nextcloud_12 and again perform the procedure.

Migrating OC->NC

Execute this section only when you are moving from ownCloud to Nextcloud, and do it instead of just installing the upgrade rpm in that point in #PROCEDURE above.

The Mageia Nextcloud rpm imports configuration from ownCloud (replacing its name), but there may be additional configuration you need to think of in your specific case.

  1. Stop ownCloud (really Apache and all services it run...) : Issue systemctl stop httpd.service
  2. Install Nextcloud rpm, it will replace the ownCloud one. (httpd is still off) - Details:
    1. Main folder: ownCloud used /usr/share/owncloud/ -- now Nextcloud use /usr/share/nextcloud/ -- Here is the bulk of ownCloud (Nextcloud) program, including themes and settings which some users may want to move along with some edits, and the apps folder and more... /.htaccess contain just the OC/NC version number. For simplest case: no need to do anything.
    2. The original /etc/httpd/conf/sites.d/nextcloud.conf from its rpm is made identical to the old /etc/httpd/conf/sites.d/owncloud.conf from owncloud rpm - *except* that all instances of "owncloud" is replaced by "nextcloud". That is exactly what we want, and we let it use the new file from nextcloud rpm as it is = no need to do anything. - BUT if you have tweaked the ownCloud version: make sure you tweak this the same way.
    3. If the Mageia nextcloud package install script detects that ownCloud used /var/lib/owncloud/ (linked from /usr/share/owncloud/data), it in config set pointer to /var/lib/owncloud/ so data at the same location is still used. It still create /var/lib/nextcloud/ even if it is not used.
  3. Issue: systemctl start httpd.service

... and continue in #PROCEDURE from the point after where you jumped here.

Nextcloud may show that there exists an upgrade and suggest to run the built-in updater to NC 11, but do not do that.

Beware name- and URL changes!
On the server
All clients
  • Clients now need to connect to /serverIP/nextcloud/ instead of /serverIP/owncloud/
Easiest way to achieve this is to edit the "/url=http..." line(s) in ~/.local/share/data/Nextcloud/nextcloud.cfg while client is shut down.
  • Old given share links have changed URLs
  • Implications on established Federated cloud sharing (sharing between owncloud/nextcloud servers) and i guess also connections to other sharing (i.e Dropbox)

Alternatively to above points maybe a trick like this can be adapted to Mageia? https://help.nextcloud.com/t/desktop-client-cannot-find-owncloud-status-php/4756/8

General upgrading cautions

  • Upstream recommends to never to skip an update, especially major updates 8.0.x -> 8.1.x -> 8.2.x -> 9.0.x -> 9.1.x as there may be large changes. (Make sure not to jump i.e 8.0 to 8.2 or 8.1 to 9.x ; you may need to select rpm manually not to get too big jumps!)
  • Generally, update to next major release from a late point release
  • For Mageia 5: first make sure you have upgraded to 8.0.15 (last version we have in 8.0 series) in normal updates before updating to 8.1.x.
  • Generally update to a late point release. History have shown upgrades & migration bugs/improvements.
  • Downgrading is not supported and is likely to corrupt data.
  • Upgrading is disruptive. Your ownCloud server will be put into maintenance mode, so your users will be locked out until the upgrade is completed. To complete the upgrade surf to the web interface and see instruction there.
  • Disable applications before each upgrade! -- And after each upgrade re-enables them and check that they work. They may need update, automatic (they tell when you enable them) or not. Also, check logs.
  • Third-party apps: Any apps that are not developed by ownCloud show a 3rd party designation. Third-party apps are considered to be more problematic for upgrading, so the above tip to disable them before each upgrade and enable, upgrade and test them after each upgrade is very important.
  • It is generally a good idea to after any upgrade check your configuration files.
  • The .htaccess and index.html files in the data/ directory are now updated after every upgrade. - If you make any modifications to these files they will overwritten at upgrade/migration. - make backups first, like of everything.

General migration cautions

In addition to upgrading cautions:

  • If you have updated ownCloud point release by other means than Mageia rpm, you may have a higher point release than Nextcloud. For late point releases that should not be a problem; i.e before migrating from ownCloud 9.1.6 to Nextcloud 10.0.5: edit the version in config.php to 9.1.5.1.

Per version

-> OwnCloud 8.1

Known issues and FAQ https://forum.owncloud.org/viewtopic.php?f=31&t=29102

-> OwnCloud 8.2

Known issues and FAQ https://forum.owncloud.org/viewtopic.php?f=36&t=31252

Transactional file locking is now in the core and replaces the old File Locking app. The File Locking app has been removed from ownCloud in version 8.2.1. If your ownCloud server still has the File Locking app, you must visit your Apps page to verify that it is disabled; the File Locking app and Transactional File Locking cannot both operate at the same time. (from https://doc.owncloud.org/server/8.2/admin_manual/configuration_files/files_locking_transactional.html )

-> OwnCloud 9.0

Known issues and FAQ https://forum.owncloud.org/viewtopic.php?f=38&t=33274 https://central.owncloud.org/t/owncloud-9-0-x-known-issues-faq-and-upgrade-problems/843

A workaround for the user.ini warning : as root run touch /usr/share/owncloud/.user.ini , chown apache.apache /usr/share/owncloud/.user.ini

After upgrading to ownCloud 9.0 and before continuing to upgrade to 9.1 make sure that all of your and your users Calendars and Addressbooks are migrated correctly. Especially when using the IMAP user backend (other user backends might be also affected) you need to manually run the mentioned occ migration commands described here.

-> OwnCloud 9.1

https://doc.owncloud.org/server/9.1/admin_manual/release_notes.html A couple items from that link:

  • IMPORTANT: (Cited from URI above) Removed dav:migrate-calendars and dav:migrate-addressbooks commands for occ. Users planning to upgrade from oC 9.0 or below to oC 9.1 needs to make sure that their Calendars and Adressbooks are correctly migrated before continuing to upgrade to 9.1.
  • Symlinks pointing outside of the datadir are disallowed. Please use the Configuring External Storage (GUI) with the Local storage backend instead.
  • For .user.ini see #-> OwnCloud 9.0

-> Nextcloud 10

Nextcloud 10 can replace ownCloud 9.1. See #General migration cautions

-> Nextcloud 11

Nextcloud 11.x is an upgrade of Nextcloud 10.x. It can *not* replace ownCloud 10.

-> Nextcloud 12

In the works: https://bugs.mageia.org/show_bug.cgi?id=22936

Changelog: https://nextcloud.com/changelog/#latest12

This is an update over Nextcloud 11 with many security fixes. Also, it can upgrade ownCloud 10 if you manually have updated to that.

On systems running PHP 7, apps will no longer (NC >= 12) be disabled when upgrading. ( If you upgraded PHP further than Mageia 6 or use Mageia >= 7 )

Warning.png
Warning!
  1. The database system is now in separate packages. You have to choose manually according to one you are using: nextcloud-mysql / nextcloud-postgresql / nextcloud-sqlite.
  2. The config file has changed, so system administrators will have to edit it manually.

Our tests showed that it may be enough to add this below at the end of config file:

'log_type' => 'syslog',
 'datadirectory' => '/var/lib/nextcloud/data',
 'updatechecker' => false,
 'check_for_working_htaccess' => false,
 'asset-pipeline.enabled' => false,
 'assetdirectory' => '/var/lib/nextcloud',
 'preview_libreoffice_path' => '/usr/bin/libreoffice',
 'apps_paths' =>
 array (
   0 =>
   array (
     'path' => '/usr/share/nextcloud/apps',
     'url' => '/apps',
     'writable' => false,
   ),
   1 =>
   array (
     'path' => '/var/lib/nextcloud/apps',
     'url' => '/apps-appstore',
     'writable' => true,
   ),
 ), 

-> Nextcloud 13

In Cauldron / Mageia 7 https://nextcloud.com/changelog/#latest13

For optimising, see Manual steps during upgrade. Translated to Mageia this could be (untested):

su apache
php occ maintenance:mode --on   (make sure it is in maintenance mode)
php occ db:add-missing-indice
php occ db:convert-filecache-bigint
php occ maintenance:mode --off   (only if all is ok to run)
exit

Tune performance

Also see https://doc.owncloud.org/server/9.1/admin_manual/configuration_server/oc_server_tuning.html / https://docs.nextcloud.com/server/12/admin_manual/configuration_server/server_tuning.html

  • #Configure the database engine MariaDB instead of using SQLite.
  • Use Cron or Webcron for #Background jobs.
  • PHP opcode caching and optimisation: Package php-opcache is pulled in as recommended for ownCloud package >= 8.1, and should "just work". Settings for it is in /etc/php.ini. Some recommended settings
  • PHP data caching: urpmi php-apcu and add the line 'memcache.local' => '\OC\Memcache\APCu', inside the $CONFIG = array in /usr/share/owncloud/config/config.php
    • APCu settings - if you want to tweak - are in /etc/php.d/99_apcu.ini
    • For monitoring it you can urpmi php-apcu-admin and go to http://localhost/php-apcu/
  • No unnecessary modules: Do not install or at ownCloud admin page activate unnecessary modules. Even when not used some may use much RAM.
  • Logging take some disk and CPU so consider setting logging low in respective settings for ownCloud, PHP, and Apache.
  • Tuning Apache. Examples:
    • In /etc/httpd/conf/httpd.conf you should have an uncommented line EnableSendfile On That way files are sent by kernel instead of Apache = less overhead. NOTE: if you serve from network mounts set both EnableMMAP off and EnableSendfile off !
    • See if you find KeepAlive; On or commented out minimize request delays for multiple files.
  • Redis-based Transactional File Locking
  • Offload encryption to CPU AES extension
  • Enable HTTP/2 In Apache
  • optimize MariaDB/"mysql" settings
  • PHP7 (coming in Mageia 7?) run more efficient.

Background jobs

There are three options for when background jobs are done. You can choose one of three methods in admin page https://myserver/owncloud/index.php/settings/admin#backgroundjobs . There you can also see a warning if jobs have not been run for more than one hour and how many hours since.

  • AJAX (default) : Some job is executed every page load. This is easiest, but may cause excessive server load, or cleaning not being done if no page access is done for long time.
  • Webcron : register at an external webcron service (for example, https://www.easycron.com/) URL to call: http[s]://<domain-of-your-server>/owncloud/cron.php
  • Local cron: To set up a cron job in Mageia for user apache to run owncloud/cron.php every 15 minute: as root issue crontab -u apache -e Now you are in vim editor (help). Paste: */15 * * * * php -f /usr/share/owncloud/cron.php > /dev/null 2>&1 , press ESC and ZZ to exit and write. It will be automatically used from now on. You can check the file with crontab -u apache -l

Issues

Server ( and its web login )

Web login

  • If you at login window get "You are accessing the server from an untrusted domain" (you can web search that plus ownCloud), it may be because ownCloud initial setup was done from another address name than it is running. You can add so you have both "localhost" and the IP of where ownCloud runs in section 'trusted_domains' in /usr/share/owncloud/config/config.php, like this example:

'trusted_domains' =>
array (
0 => 'localhost',
1 => '192.168.0.27',
),

A less secure alternative is to remove that whole section.

Other

  • Clients can not sync, and this error is in logs: PHP Startup: Unable to load dynamic library '/usr/lib64/php/extensions/pdo_mysql.so' - /usr/lib64/php/extensions/pdo_mysql.so: undefined symbol: pdo_parse_params at Unknown#0

Others have found it be due to php version conflicts. A few got it solved by new php versions. For me it got solved by uninstalling then reinstalling all php packages, which pulled three more. (during mageia 5 beta 3)

  • Fail to delete file and CPU stay at 100% with mariadb taking almost half. (got that while trying apcu + xcache on OC7) Successful recovery: stop clients sync: delete the containing folder in web ui, move away that folder from clients sync folder, re-enable sync and let it settle OK, then move back the folder on one of the clients, and it shall propagate.

Clients

Storing Credentials

When starting at desktop login, on some systems ownCloud client fails to read stored credentials.

It helps to add a delay, see https://bugs.mageia.org/show_bug.cgi?id=16525

Useful links

OwnCloud

Main page, Commercial version

Manuals for client and server, FAQ, New forum, Old forum (read-only)

List of resources, Arch Linux wiki

Issue tracker, Changelog, Maintenance and Release Schedule

Nextcloud

Main site, Commercial version

Main support link page; Manuals etc, FAQ & How-to wiki, Forum

Issue trackers, Changelog, Release channels, Maintenance and Release Schedule

[1] example for ubuntu, but interesting

MariaDB

MariaDB in Mageia wiki, Getting, Installing, and Upgrading MariaDB at mariadb.com

PhpMyAdmin

A good tool to read, manage, backup MariaDB data. Install it, then in a web browser go to https://localhost/phpmyadmin and use the administrative login i.e user root and the password you set.

info: http://www.phpmyadmin.net Configuration: /etc/phpmyadmin/config.inc.php ( config.default.inc.php in same folder contain defaults, not supposed to be modified.)

Webmin

Another tool for MariaDB (Webmin can control many things in a system). Install it, then in a web browser go to https://localhost:10000/

Log in as system root, click Servers -> MySQL enter MariaDB administrative login credentials. There is a backup button, and you can also schedule backups. info: http://www.webmin.com

Interesting links

Configuring

Migration script

Not tested on Mageia (?) and may break further upgrades and other stuff made in accordance with this wiki page, but seem very competent, so you may want to try if manual migration from ownCloud to Nextcloud per above fail: https://nextcloud.com/migration/

Other OS

Nextcloud Linux packages status

Nextcloud on RaspberryPi

Appendix

Brute force reinstall

For reference this is a dump of my commands for testing reinstall of ownCloud

Be careful and do not execute without thinking first, what is correct for *your* install!

All commands are executed as root. Some can be copy-pasted several at a time into a terminal, some can not!

UNINSTALL: Save old config and ownCloud and php logs, new PHP log, remove ownCloud

systemctl stop httpd
mv -f /etc/owncloud/config.php /root/config.php.last_install
mv -f /mnt/owncloud/data/owncloud.log /root/owncloud.log.last_install
mv -f /var/log/php-errors.log /root/php-errors.log.last_install
touch /var/log/php-errors.log
chown apache:apache /var/log/php-errors.log
urpme owncloud 
rm -rf /usr/share/owncloud/
rm -rf /etc/owncloud/
rm -f /etc/httpd/conf/sites.d/owncloud.conf
systemctl start httpd

STORAGE: Fresh data storage: (Variant: separately mounted filesystem)

rm -rf /var/lib/owncloud/ # default storage contain at least some initial junk
rm -rf /mnt/owncloud/*
mkdir /mnt/owncloud/data
mkdir /mnt/owncloud/tmp
chmod -R 770 /mnt/owncloud
chown -R apache:apache /mnt/owncloud

DATABASE: New MariaDB database: ( /!\ removes all databases )

systemctl stop mysqld.service
urpme mariadb
rm -rf /var/lib/mysql/ 
rm -f /etc/my.cnf
rm -rf /etc/my.cnf.d/
urpmi mariadb
systemctl start mysqld
mysql_secure_installation
mysql -uroot -p
 CREATE DATABASE owncloud;
 CREATE USER 'ocserver'@'localhost' IDENTIFIED BY 'myp4ssw0rd';
 GRANT ALL PRIVILEGES ON owncloud.* TO 'ocserver'@'localhost' IDENTIFIED BY 'myp4ssw0rd';
 quit

INSTALL:

urpmi owncloud-9.0.9
touch /usr/share/owncloud/.user.ini # see heading "-> OwnCloud 9.0 "
chown apache:apache /usr/share/owncloud/{config,data,apps,.user.ini}
systemctl restart httpd

...and goto http://localhost/owncloud for basic configuring. See other parts of document for security and performance tuning etc.

Facilitating auto update

If for any reason you want to use the built in auto updater, I used this on Nextcloud 10 in order for the updater to proceed:

chown -R apache:apache /usr/share/nextcloud/
chmod -R 770 /usr/share/nextcloud/
rm /usr/share/nextcloud/resources/config/ca-bundle.crt # soft link to ../../../../../etc/pki/tls/certs/ca-bundle.crt

I also removed the #OwnCloud test script.

After the update, all seem OK, and file integrity check does not complain about anything.

For production, use adjust the ownership and rights better, and maybe reinstate that link and test script.

Notepad.png
Please note!
  1. Above is a quicky. For better values and more info see #File permissions, and https://help.nextcloud.com/t/please-help-with-right-permissions-for-nc12/13780/4
  2. Updating this way is not originally intended by the Mageia package - you are on your own i.e regarding uninstalling, and remember to NOT install an updated rpm, and take special actions when upgrading Mageia to next version!

An idea for a script: https://bugs.mageia.org/attachment.cgi?id=9449

Warning.png
Warning!
Untested! Errors may wreck your system! Scrutinise the script carefully yourself, and adapt to your system