Manual Installation on Linux

Installing ownCloud on Linux from our Open Build Service packages is the preferred method (see Linux Package Manager Installation). These are maintained by ownCloud engineers, and you can use your package manager to keep your ownCloud server up-to-date.


Enterprise customers should refer to Installing & Upgrading ownCloud Enterprise Edition

If there are no packages for your Linux distribution, or you prefer installing from the source tarball, you can setup ownCloud from scratch using a classic LAMP stack (Linux, Apache, MySQL/MariaDB, PHP). This document provides a complete walk-through for installing ownCloud on Ubuntu 14.04 LTS Server with Apache and MariaDB, using the ownCloud .tar archive.


Admins of SELinux-enabled distributions such as CentOS, Fedora, and Red Hat Enterprise Linux may need to set new rules to enable installing ownCloud. See SELinux for a suggested configuration.


The ownCloud tar archive contains all of the required third-party PHP libraries. As a result, no extra ones are, strictly, necessary. However, ownCloud does require that PHP has a set of extensions installed, enabled, and configured.

This section lists both the required and optional PHP extensions. If you need further information about a particular extension, please consult the relevant section of the extensions section of the PHP manual.

If you are using a Linux distribution, it should have packages for all the required extensions. You can check the presence of a module by typing php -m | grep -i <module_name>. If you get a result, the module is present.


PHP Version

PHP (5.6+, 7.0, 7.1, & 7.2)


ownCloud recommends the use of PHP 7.2 in new installations. Sites using a version earlier than PHP 7.2 are strongly encouraged to migrate to PHP 7.2.

PHP Extensions

Name Description
Ctype For character type checking
cURL Used for aspects of HTTP user authentication
DOM For operating on XML documents through the DOM API
GD For creating and manipulating image files in a variety of different image formats, including GIF, PNG, JPEG, WBMP, and XPM.
HASH Message Digest Framework For working with message digests (hash).
iconv For working with the iconv character set conversion facility.
intl Increases language translation performance and fixes sorting of non-ASCII characters
JSON For working with the JSON data-interchange format.
libxml This is required for the _DOM_, _libxml_, _SimpleXML_, and _XMLWriter_ extensions to work. It requires that libxml2, version 2.7.0 or higher, is installed.
Multibyte String For working with multibyte character encoding schemes.
OpenSSL For symmetric and asymmetric encryption and decryption, PBKDF2, PKCS7, PKCS12, X509 and other crypto operations.
PDO This is required for the pdo_msql function to work.
Phar For working with PHP Archives (.phar files).
POSIX For working with UNIX POSIX functionality.
SimpleXML For working with XML files as objects.
XMLWriter For generating streams or files of XML data.
Zip For reading and writing ZIP compressed archives and the files inside them.
Zlib For reading and writing gzip (.gz) compressed files.


The Phar, OpenSSL, and cUrl extensions are mandatory if you want to use Make to setup your ownCloud environment, prior to running either the web installation wizard, or the command line installer.

Database Extensions

Name Description
pdo_mysql For working with MySQL & MariaDB.
pgsql For working with PostgreSQL. It requires PostgreSQL 9.0 or above.
sqlite For working with SQLite. It requires SQLite 3 or above. This is, usually, not recommended, for performance reasons.

Required For Specific Apps

Name Description
ftp For working with FTP storage
sftp For working with SFTP storage
imap For IMAP integration
ldap For LDAP integration
smbclient For SMB/CIFS integration


SMB/Windows Network Drive mounts require the PHP module smbclient version 0.8.0+; see SMB/CIFS.


Extension Reason
Bzip2 Required for extraction of applications
Fileinfo Highly recommended, as it enhances file analysis performance
Mcrypt Increases file encryption performance
OpenSSL Required for accessing HTTPS resources
imagick Required for creating and modifying images and preview thumbnails

For MySQL/MariaDB

The InnoDB storage engine is required, and MyISAM is not supported, see: MySQL / MariaDB storage engine.

Install the Required Packages

On Ubuntu 16.04 LTS Server

On a machine running a pristine Ubuntu 16.04 LTS server, install the required and recommended modules for a typical ownCloud installation, using Apache and MariaDB, by issuing the following commands in a terminal:

# If the add-apt-repository command is not available install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

sudo apt-get install -y apache2 mariadb-server libapache2-mod-php7.2 \
    openssl php-imagick php7.2-common php7.2-curl php7.2-gd \
    php7.2-imap php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring \
    php7.2-mysql php7.2-pgsql php-smbclient php-ssh2 \
    php7.2-sqlite3 php7.2-xml php7.2-zip

Please note:

  • php7.2-common provides: ftp, Phar, posix, iconv, ctype
  • The Hash extension is available from PHP 5.1.2 by default
  • php7.2-xml provides DOM, SimpleXML, XML, & XMLWriter
  • php7.2-zip provides zlib

Installing smbclient

To install smbclient, you can use the following script. It first installs PEAR, which at the time of writing only installs version 1.9.4. However, smbclient requires version 1.9.5. So the final two commands upgrade PEAR to version 1.9.5 and then install smbclient using Pecl.

spawn wget -O /tmp/go-pear.phar
expect eof

spawn php /tmp/go-pear.phar

expect "1-11, 'all' or Enter to continue:"
send "\r"
expect eof

spawn rm /tmp/go-pear.phar

pear install PEAR-1.9.5
pecl install smbclient

Installing SSH2

To install SSH2, which provides SFTP, you can use the following command:

spawn pecl install ssh2

Running Additional Apps?

If you are planning on running additional apps, keep in mind that you might require additional packages. See Prerequisites for details.


During the installation of the MySQL/MariaDB server, you will be prompted to create a root password. Be sure to remember your password as you will need it during ownCloud database setup.

Additional Extensions

apt-get install -y php-apcu php-redis redis-server php7.2-ldap

RHEL (RedHat Enterprise Linux) 7.2

Required Extensions

# Enable the RHEL Server 7 repository
subscription-manager repos --enable rhel-server-rhscl-7-eus-rpms

# Install the required packages
sudo yum install httpd mariadb-server php72 php72-php \
  php72-php-gd php72-php-mbstring php72-php-mysqlnd

Optional Extensions

sudo yum install -y epel-release yum-utils \
  && sudo yum-config-manager --enable remi-php72 \
  && sudo yum update -y \
  && sudo yum install -y php72-pecl-apcu \
    redis php72-php-pecl-redis php72-php-ldap \
    mariadb-server mariadb

Centos 7

sudo yum install -y -q epel-release yum-utils \
&& sudo yum-config-manager --enable remi-php72 \
&& sudo yum update -y -q \
&& sudo yum install -y -q \
   httpd mariadb-server php72 php72-php php72-php-gd \
   php72-php-mbstring php72-php-mysqlnd php72-php-cli \
   php72-pecl-apcu redis php72-php-pecl-redis php72-php-common \
   php72-php-ldap mariadb-server mariadb \
&& sudo scl enable php72 bash

SLES (SUSE Linux Enterprise Server) 12

Required Extensions

zypper install -y apache2 apache2-mod_php7 php7-gd php7-openssl \
  php7-json php7-curl php7-intl php7-sodium php7-zip php7-zlib

Optional Extensions

zypper install -y php7-ldap

We are not aware of any officially supported APCu package for SLES 12. However, if you want or need to install it, then we suggest the following steps:

wget server:php:extensions.repo -O /etc/zypp/repos.d/memcached.repo
zypper refresh
zypper install -y php7-APCu

The latest versions of Redis servers have shown to be incompatible with SLES 12. Therefore it is currently recommended to download and install version 2.2.7 or a previous release from: Keep in mind that version 2.2.5 is the minimum version which ownCloud supports.

If you want or need to install it, we suggest the following steps:

zypper refresh
zypper install -y php7-redis

Install ownCloud

Now download the archive of the latest ownCloud version:

  • Go to the ownCloud Download Page.

  • Go to Download ownCloud Server > Download > Archive file for server owners and download either the tar.bz2 or .zip archive.

  • This downloads a file named owncloud-x.y.z.tar.bz2 or (where x.y.z is the version number).

  • Download its corresponding checksum file, e.g. owncloud-x.y.z.tar.bz2.md5, or owncloud-x.y.z.tar.bz2.sha256.

  • Verify the MD5 or SHA256 sum:

    md5sum -c owncloud-x.y.z.tar.bz2.md5 < owncloud-x.y.z.tar.bz2
    sha256sum -c owncloud-x.y.z.tar.bz2.sha256 < owncloud-x.y.z.tar.bz2
    md5sum  -c <
    sha256sum  -c <
  • You may also verify the PGP signature:

    gpg --import owncloud.asc
    gpg --verify owncloud-x.y.z.tar.bz2.asc owncloud-x.y.z.tar.bz2
  • Now you can extract the archive contents. Run the appropriate unpacking command for your archive type:

    tar -xjf owncloud-x.y.z.tar.bz2
  • This unpacks to a single owncloud directory. Copy the ownCloud directory to its final destination. When you are running the Apache HTTP server, you may safely install ownCloud in your Apache document root:

    cp -r owncloud /path/to/webserver/document-root

    where /path/to/webserver/document-root is replaced by the document root of your Web server:

    cp -r owncloud /var/www

On other HTTP servers, it is recommended to install ownCloud outside of the document root.

Configure Apache Web Server

On Debian, Ubuntu, and their derivatives, Apache installs with a useful configuration, so all you have to do is create a /etc/apache2/sites-available/owncloud.conf file with these lines in it, replacing the Directory and other file paths with your own file paths:

Alias /owncloud "/var/www/owncloud/"

<Directory /var/www/owncloud/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off

 SetEnv HOME /var/www/owncloud
 SetEnv HTTP_HOME /var/www/owncloud


Then create a symlink to /etc/apache2/sites-enabled:

ln -s /etc/apache2/sites-available/owncloud.conf /etc/apache2/sites-enabled/owncloud.conf

Additional Apache Configurations

  • For ownCloud to work correctly, we need the module mod_rewrite. Enable it by running:

    a2enmod rewrite

    Additional recommended modules are mod_headers, mod_env, mod_dir and mod_mime

    a2enmod headers
    a2enmod env
    a2enmod dir
    a2enmod mime


    If you want to use the OAuth2 app, then mod_headers must be installed and enabled.

  • You must disable any server-configured authentication for ownCloud, as it uses Basic authentication internally for DAV services. If you have turned on authentication on a parent folder (via, e.g., an AuthType Basic directive), you can disable the authentication specifically for the ownCloud entry. Following the above example configuration file, add the following line in the <Directory section

    Satisfy Any
  • When using SSL, take special note of the ServerName. You should specify one in the server configuration, as well as in the CommonName field of the certificate. If you want your ownCloud to be reachable via the internet, then set both of these to the domain you want to reach your ownCloud server.

  • Now restart Apache

    service apache2 restart
  • If you’re running ownCloud in a sub-directory and want to use CalDAV or CardDAV clients make sure you have configured the correct Service discovery URLs.

Multi-Processing Module (MPM)

Apache prefork has to be used. Don’t use a threaded MPM like event or worker with mod_php, because PHP is currently not thread safe.

Enable SSL


You can use ownCloud over plain HTTP, but we strongly encourage you to use SSL/TLS to encrypt all of your server traffic, and to protect user’s logins and data in transit.

Apache installed under Ubuntu comes already set-up with a simple self-signed certificate. All you have to do is to enable the ssl module and the default site. Open a terminal and run:

a2enmod ssl
a2ensite default-ssl
service apache2 reload


Self-signed certificates have their drawbacks - especially when you plan to make your ownCloud server publicly accessible. You might want to consider getting a certificate signed by a commercial signing authority. Check with your domain name registrar or hosting service for good deals on commercial certificates.

Run the Installation Wizard

After restarting Apache, you must complete your installation by running either the Graphical Installation Wizard or on the command line with the occ command. To enable this, temporarily change the ownership on your ownCloud directories to your HTTP user (see Set Strong Directory Permissions to learn how to find your HTTP user):

chown -R www-data:www-data /var/www/owncloud/


Admins of SELinux-enabled distributions may need to write new SELinux rules to complete their ownCloud installation; see SELinux.

To use occ see Command Line Installation. To use the graphical Installation Wizard see The Installation Wizard.


Please know that ownCloud’s data directory must be exclusive to ownCloud and not be modified manually by any other process or user.

Set Strong Directory Permissions

After completing the installation, you must immediately set the directory permissions in your ownCloud installation as strictly as possible for stronger security. After you do so, your ownCloud server will be ready to use.

Managing Trusted Domains

All URLs used to access your ownCloud server must be whitelisted in your config.php file, under the trusted_domains setting. Users are allowed to log into ownCloud only when they point their browsers to a URL that is listed in the trusted_domains setting.


This setting is important when changing or moving to a new domain name. You may use IP addresses and domain names.

A typical configuration looks like this:

'trusted_domains' => [
   0 => 'localhost',
   1 => '',
   2 => '',

The loopback address,, is automatically whitelisted, so as long as you have access to the physical server you can always log in. In the event that a load-balancer is in place, there will be no issues as long as it sends the correct X-Forwarded-Host header.


For further information on improving the quality of your ownCloud installation, please see the Configuration Notes & Tips guide.

All documentation licensed under the Creative Commons Attribution 3.0 Unported license.