Introduction

What is the best way to install and maintain ownCloud?
The answer to that is, as always: 'it depends'.

This is because every ownCloud customer has their own particular needs and IT infrastructure.
However, both ownCloud and the LAMP stack are highly-configurable.
Given that, in this document we present a set of general recommendations, followed by three typical scenarios, and finish up with making best-practice recommendations for both software and hardware.

The recommendations presented here are based on a standard ownCloud installation, one without any particular
apps, themes, or code changes. But, server load is dependent upon the number of clients, files, and
user activity, as well as other usage patterns.
Given that, these recommendations are only a rule of thumb based on our experience, as well as that of one of our customers.

Consider setting up a scale-out deployment, or using Federated Cloud Sharing to keep individual ownCloud instances to a manageable size.

Whatever the size of your organization, always keep one thing in mind: The amount of data stored in ownCloud will only grow. So plan ahead.

ownCloud Administrators Must Have Command Line or Cron Access

We only recommend using hosts that provide command-line or Cron access (ideally both) to ownCloud administrators, for three key reasons:

Without command-line access, OCC commands, required for administrative tasks such as repairs and upgrades, are not available.

Without Crontab access, you cannot run background jobs reliably.
ajax/cron.php
is available, but it is not reliable enough, because it only runs when people are using the web UI.
Additionally, ownCloud relies heavily on background jobs especially for long-running operations, which will likely cause PHP timeouts.

PHP timeout values are often low.
Having low timeout settings can break long-running operations, such as moving a huge folder.

Scenario 1: Small Workgroups and Departments

This recommendation applies if you meet the following criteria:

Option

Value

Number of users

Up to 150 users

Storage size

100 GB to 10TB

High availability level

Zero-downtime backups via Btrfs snapshots, component

failure leads to interruption of service. Alternate

backup scheme on other filesystems: nightly backups

— with service interruption.

Recommended System Requirements

One machine running the application, web, and database server, as well as local storage.
Authentication via an existing LDAP or Active Directory server.

Components

One server with at least 2 CPU cores, 16GB RAM, and local storage as needed.

Operating system

Enterprise-grade Linux distribution with full support from an operating system vendor.
We recommend both RedHat Enterprise Linux and SUSE Linux Enterprise Server 12.

SSL Configuration

Load Balancer

None.

Database

MySQL, MariaDB, or PostgreSQL.
We currently recommend MySQL / MariaDB,
as our customers have had good experiences when moving to a Galera cluster to scale the DB.
If using either MySQL or MariaDB, you must use the InnoDB storage engine as MyISAM is not supported, see:
MySQL / MariaDB storage engine

If you are using MaxScale/Galera, then you need to use at least version 1.3.0.
In earlier versions, there is a bug where the value of last_insert_id is not routed to the master node.
This bug can cause loops within ownCloud and corrupt database rows.
You can find out more information in the issue documentation.

Backup

Install ownCloud, the ownCloud data directory, and database on a Btrfs filesystem.
Make regular snapshots at desired intervals for zero downtime backups.
Mount DB partitions with the "nodatacow" option to prevent fragmentation.

Alternatively, you can make nightly backups — with service interruption — as follows:

Shut down Apache.

Create database dump.

Push data directory to backup.

Push database dump to backup.

Start Apache.

After these steps have been completed, then, optionally, rsync the backup to either an external backup storage or tape backup.
See the Maintenance section of the Administration manual for tips on backups and restores.

Authentication

User authentication via one or several LDAP or Active Directory (AD) servers.
See User Authentication with LDAP for information on configuring ownCloud to use LDAP and AD.

Session Management

Local session management on the application server.
PHP sessions are stored in a temporary filesystem, mounted at the operating system-specific session storage location.
You can find out where that is by running grep -R 'session.save_path' /etc/php* and then add it to the /etc/fstab file, for example:

Backup

Minimum daily backup without downtime.
All MySQL/MariaDB statements should be replicated to a backup MySQL/MariaDB slave instance.

Create a snapshot on the NFS storage server.

At the same time stop the MySQL replication.

Create a MySQL dump of the backup slave.

Push the NFS snapshot to the backup.

Push the MySQL dump to the backup.

Delete the NFS snapshot.

Restart MySQL replication.

Authentication

User authentication via one or several LDAP or Active Directory servers.
See User Authentication with LDAP for information on configuring ownCloud to use LDAP and AD.

Session Management

Session management on the application server.
PHP sessions are stored in a temporary filesystem, mounted at the operating system-specific session storage location.
You can find out where that is by running grep -R 'session.save_path' /etc/php* and then add it to the /etc/fstab file, for example:

ownCloud Edition

Redis Configuration

Redis in a master-slave configuration is a hot failover setup, and is usually sufficient.
A slave can be omitted if high availability is provided via other means.
And when it is, in the event of a failure, restarting Redis typically occurs quickly enough.
Regarding Redis cluster, we don’t, usually, recommend it, as it requires a greater level of both maintenance and management in the case of failure.
A single Redis server, however, just needs to be rebooted, in the event of failure.

Known Issues

Deadlocks When Using MariaDB Galera Cluster

If you’re using MariaDB Galera Cluster with your ownCloud installation, you may encounter deadlocks when you attempt to sync a large number of files. You may also encounter database errors, such as this one:

Set wsrep_sync_wait to 1 on all Galera Cluster nodes

What the parameter does

When enabled, the node triggers causality checks in response to certain types of queries.
During the check, the node blocks new queries while the database server catches up with all updates made in the cluster to the point where the check begun.
Once it reaches this point, the node executes the original query.

Why enable it

A Galera Cluster write operation is sent to the master while reads are retrieved from the slaves.
Since Galera Cluster replication is, by default, not strictly synchronous it could happen that items are requested before the replication has actually taken place.