Manual Installation on Linux

Install the Required Packages

When Are Stable Channel Packages Updated?

Packages in the supported distributions’ stable channels are not immediately updated following a release. This is because we need to make sure that the release is sufficiently stable, as many people use automatic updates. By waiting a number of business days after a tarball has been released, we are able to make this assessment, based on a number of criteria which include the submitted bug reports from systems administrators.

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

Ubuntu 18.04 LTS Server

To prepare your Ubuntu 18.04 server for the use with ownCloud, follow the Ubuntu 18.04 preparation guide.

RHEL (RedHat Enterprise Linux) 7.2

Required Extensions

# Enable the RHEL Server 7 repository
sudo 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-opcache \
    php72-php-gd php72-php-mbstring php72-php-mysqlnd

Optional Extensions

sudo yum install -y epel-release http://rpms.remirepo.net/enterprise/remi-release-7.rpm 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 http://rpms.remirepo.net/enterprise/remi-release-7.rpm 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-opcache \
    php72-php-ldap mariadb-server mariadb \
  && sudo scl enable php72 bash

SLES (SUSE Linux Enterprise Server) 12

Required Extensions

sudo 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

sudo zypper install -y php7-ldap
APCu

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 http://download.opensuse.org/repositories/server:/php:/extensions/SLE_12_SP1/ server:php:extensions.repo -O /etc/zypp/repos.d/memcached.repo
zypper refresh
zypper install php5-APCu
Redis

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: https://pecl.php.net/package/redis. 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 owncloud-x.y.z.zip (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 owncloud-x.y.z.zip.md5 < owncloud-x.y.z.zip
    sha256sum  -c owncloud-x.y.z.zip.sha256 < owncloud-x.y.z.zip
  • You may also verify the PGP signature:

    wget https://download.owncloud.org/community/owncloud-x.y.z.tar.bz2.asc
    wget https://owncloud.org/owncloud.asc
    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 unzip owncloud-x.y.z.zip

* 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 the Web Server

=== Configure Apache

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

[source,apache]
....
Alias /owncloud "/var/www/owncloud/"

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

 <IfModule mod_dav.c>
  Dav off
 </IfModule>

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

</Directory>
....

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`.
Additionally recommended modules are `mod_headers`, `mod_env`, `mod_dir`, `mod_mime`, and `mod_unique_id`.
To enable them, run the following commands:
+
....
  a2enmod headers
  a2enmod env
  a2enmod dir
  a2enmod mime
  a2enmod unique_id
....
+
NOTE: If you want to use https://marketplace.owncloud.com/apps/oauth2[the OAuth2 app], then http://httpd.apache.org/docs/current/mod/mod_headers.html[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 xref:configuration/general_topics/general_troubleshooting.adoc#service-discovery[Service Discovery] URLs.
    
    ==== Apache Mod_Unique_Id Configuration
    
    http://httpd.apache.org/docs/current/mod/mod_unique_id.html[mod_unique_id]:
    
    > Provides a magic token for each request which is guaranteed to be unique across "all" requests under very specific conditions.
    
    If you enable the module, there is nothing else that you have to do, as ownCloud automatically includes the `UNIQUE_ID` environment variable, which the module makes available, in ownCloud's log file.
    
    To confirm that it's working though, check that the `UNIQUE_ID` environment variable is being set, by running `phpinfo()` (as in the screenshot below).
    
    image:installation/webservers/apache/mod_unique_id/phpinfo.png[phpinfo() showing that Apache is sending the UNIQUE_ID value from mod_unique_id]
    
    Next, compare the value set for `UNIQUE_ID` in the output of `phpinfo()` with the value in ownCloud's log file, to ensure that they're the same.
    In the example below, you can see an example log entry, where ownCloud is logging the unique id provided by Apache, as the value for the first key `reqId` in the record.
    
    [source,json]

    { "reqId": "XDyankIou@F-GwxW82dx7QAAAAo", "level": 3, "time": "2019-01-14T14:20:14+00:00", "remoteAddr": "127.0.0.1", "user": "--", "app": "PHP", "method": "GET", "url": "\/index.php\/apps\/files\/?dir=\/Documents&fileid=26", "message": "…​" }

=== Enable SSL

NOTE: 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

NOTE: 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.

=== Multi-Processing Module (MPM)

https://httpd.apache.org/docs/2.4/mod/prefork.html[Apache prefork] has to be used.
Don’t use a threaded `MPM` like `event` or `worker` with `mod_php`, because PHP is currently https://secure.php.net/manual/en/install.unix.apache2.php[not thread safe].

=== Configure NGINX

==== NGINX Unique_Id Configuration

NGINX supports functionality similar to Apache’s mod_unique_id, called {nginx-app-tracing-url}[Application Tracing].
To enable it, please add the following code to the server block of your ownCloud NGINX configuration.

fastcgi_param UNIQUE_ID $request_id;

TIP: For more details, please refer to {nginx-app-tracing-url}[Application Tracing with NGINX and NGINX Plus].

== 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

TIP: Refer to the xref:set-strong-directory-permissions[Set Strong Directory Permissions] section to learn how to find your HTTP user):

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

NOTE: Admins of SELinux-enabled distributions may need to write new SELinux rules to complete their ownCloud installation; see xref:installation/configuration_notes_and_tips.adoc#config-notes-and-tips-selinux[the SELinux guide] for a suggested configuration.

To use `occ` refer to the xref:installation/command_line_installation.adoc[command-line installation details].
To use the graphical Installation Wizard refer to xref:installation/installation_wizard.adoc[the installation_wizard].

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

== Headers

NOTE: ownCloud has a mechanism to set headers programmatically.
These headers are set with the `always` directive to avoid errors when there are additional headers set in the web servers configuration file like `http.conf`.
More information on headers can be found {mod_headers-url}[in the `mod_headers` documentation].

== Set Strong Directory Permissions

After completing the installation, you must immediately xref:installation/installation_wizard.adoc#post-installation-steps[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 white-listed 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.

NOTE: 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:

[source,php]
----
'trusted_domains' => [
   0 => 'localhost',
   1 => 'server1.example.com',
   2 => '192.168.1.50',
],
----

The loopback address, `127.0.0.1`, is automatically white-listed, 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.

NOTE: For further information on improving the quality of your ownCloud installation, please see xref:installation/configuration_notes_and_tips.adoc[the configuration notes and tips guide].

NOTE: 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 xref:installation/configuration_notes_and_tips.adoc#config-notes-and-tips-selinux[SELinux] for a suggested configuration.

== Prerequisites

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 http://php.net/manual/en/extensions.php[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.

=== Required

==== PHP Version

PHP {supported-php-versions}

[IMPORTANT]
====
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

[width="100%",cols="28%,72%",options="header",]
|=======================================================================
| Name                                                         | Description
| https://secure.php.net/manual/en/book.ctype.php[Ctype]  | For character type checking
| https://php.net/manual/en/book.curl.php[cURL]           | Used for aspects of HTTP user authentication
| https://secure.php.net/manual/en/book.dom.php[DOM]      | For operating on XML documents through the DOM API
| https://php.net/manual/en/book.image.php[GD]            | For creating and manipulating image files in a variety
of different image formats, including GIF, PNG, JPEG, WBMP, and XPM.
| http://php.net/manual/en/function.hash.php[HASH Message]
http://php.net/manual/en/function.hash.php[Digest Framework] | For working with message digests (hash).
| https://php.net/manual/en/book.iconv.php[iconv]      | For working with the iconv character set conversion facility.
| https://php.net/manual/en/book.intl.php[intl]        | Increases language translation performance and fixes
sorting of non-ASCII characters
| https://php.net/manual/en/book.json.php[JSON]        | For working with the JSON data-interchange format.
| https://php.net/manual/en/book.libxml.php[libxml]    | This is required for the
https://secure.php.net/manual/en/book.dom.php[DOM],
https://php.net/manual/en/book.libxml.php[libxml],
https://php.net/manual/en/book.simplexml.php[SimpleXML], and
https://php.net/manual/en/book.xmlwriter.php[XMLWriter] extensions to work.
It requires that libxml2, version 2.7.0 or higher, is installed.
| https://php.net/manual/en/book.mbstring.php[Multibyte String] | For working with multibyte character
encoding schemes.
| https://php.net/manual/en/book.openssl.php[OpenSSL]  | For symmetric and asymmetric encryption and decryption,
PBKDF2, PKCS7, PKCS12, X509 and other crypto operations.
| https://secure.php.net/manual/en/book.pdo.php[PDO]   | This is required for the pdo_msql function to work.
| https://secure.php.net/manual/en/book.phar.php[Phar] | For working with PHP Archives (.phar files).
| https://php.net/manual/en/book.posix.php[POSIX]      | For working with UNIX POSIX functionality.
| https://php.net/manual/en/book.simplexml.php[SimpleXML] | For working with XML files as objects.
| https://php.net/manual/en/book.xmlwriter.php[XMLWriter] | For generating streams or files of XML data.
| https://php.net/manual/en/book.zip.php[Zip]          | For reading and writing ZIP compressed archives and the files inside them.
| https://php.net/manual/en/book.zlib.php[Zlib]        | For reading and writing gzip (.gz) compressed files.
|=======================================================================

NOTE: The _Phar_, _OpenSSL_, and _cUrl_ extensions are mandatory if you want to use https://www.gnu.org/software/make/[Make] xref:developer_manual:general/devenv.adoc[to setup your ownCloud environment], prior to running either the web installation wizard, or the command line installer.

==== Database Extensions

[cols=",",options="header",]
|=======================================================================
| Name                                                               | Description
| https://secure.php.net/manual/en/ref.pdo-mysql.php[pdo_mysql] | For working with MySQL & MariaDB.
| https://secure.php.net/manual/en/ref.pgsql.php[pgsql]         | For working with PostgreSQL.
It requires PostgreSQL 9.0 or above.
| https://secure.php.net/manual/en/ref.sqlite.php[sqlite]       | For working with SQLite.
It requires SQLite 3 or above. This is, usually, not recommended for performance reasons.
|=======================================================================

=== Required For Specific Apps

[cols=",",options="header",]
|=======================================================================
| Name                                                      | Description
| https://secure.php.net/manual/en/book.ftp.php[ftp]   | For working with FTP storage
| https://secure.php.net/manual/de/book.ssh2.php[sftp] | For working with SFTP storage
| https://secure.php.net/manual/en/book.imap.php[imap] | For IMAP integration
| https://secure.php.net/manual/en/book.ldap.php[ldap]  | For LDAP integration
| https://pecl.php.net/package/smbclient[smbclient]    | For SMB/CIFS integration
|=======================================================================

NOTE: SMB/Windows Network Drive mounts require the PHP module smbclient version 0.8.0+.
See xref:configuration/files/external_storage/smb.adoc[SMB/CIFS].

=== Optional

[cols=",",options="header",]
|=======================================================================
| Extension                                                  | Reason
| https://php.net/manual/en/book.bzip2.php[Bzip2]       | Required for extraction of applications
| https://php.net/manual/en/book.fileinfo.php[Fileinfo] | Highly recommended,
as it enhances file analysis performance
| https://php.net/manual/en/book.mcrypt.php[Mcrypt]     | Increases file encryption performance
| https://php.net/manual/en/book.openssl.php[OpenSSL]   | Required for accessing HTTPS resources
| https://secure.php.net/manual/en/book.imagick.php[imagick] | Required for creating and modifying
images and preview thumbnails
|=======================================================================

=== Recommended

==== For Specific Apps

[cols=",",options="header",]
|=======================================================================
| Extension                                          | Reason
| https://php.net/manual/en/book.exif.php[Exif] | For image rotation in the pictures app
| https://php.net/manual/en/book.gmp.php[GMP]   | For working with arbitrary-length integers
|=======================================================================

==== For Server Performance

For enhanced server performance consider installing one of the following cache extensions:

* https://secure.php.net/manual/en/book.apcu.php[apcu]
* https://secure.php.net/manual/en/book.memcached.php[memcached]
* https://pecl.php.net/package/redis[redis] (>= 2.2.6+, required for transactional file locking)

See xref:configuration/server/caching_configuration.adoc[Caching Configuration] to learn how to select and configure Memcache.

==== For Preview Generation

* https://libav.org/[avconv] or https://ffmpeg.org/[ffmpeg]
* https://www.openoffice.org/[OpenOffice] or https://www.libreoffice.org/[LibreOffice]

==== For Command Line Processing

[cols=",",options="header",]
|=======================================================================
| Extension                                                   | Reason
| https://secure.php.net/manual/en/book.pcntl.php[PCNTL] | Enables command interruption by pressing `ctrl-c`
|=======================================================================

NOTE: You don’t need the WebDAV module for your Web server (i.e., Apache’s `mod_webdav`), as ownCloud has a built-in WebDAV server of its own, http://sabre.io/[SabreDAV].
If `mod_webdav` is enabled you must disable it for ownCloud.
See xref:configure-apache-web-server[the Apache Web Server configuration] for an example configuration.

=== For MySQL/MariaDB

The InnoDB storage engine is required, and MyISAM is not supported, see xref:configuration/database/linux_database_configuration.adoc#mysql-mariadb-storage-engine[MySQL / MariaDB storage engine] for more information.