Manual Installation on Linux

Installing ownCloud on Linux from the openSUSE Build Service packages is the preferred method (see Preferred Linux Installation Method). These are maintained by ownCloud engineers, and you can use your package manager to keep your ownCloud server up-to-date. If there are no packages for your Linux distribution, or you prefer installing from sources, 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 MySQL.

Prerequisites

Note

This tutorial assumes you have terminal access to the machine you want to install ownCloud on. Although this is not an absolute requirement, installation without it is likely to require contacting your hoster (e.g. for installing required modules). Consult the PHP manual for information on modules.Your Linux distribution should have packages for all required modules.

To run ownCloud, your web server must have the following installed:

  • php5 (>= 5.3.8, we highly recommended 5.4+ as 5.3 is old and has many problems. See Red Hat Enterprise Linux 6, CentOS 6, and PHP 5.4)
  • PHP module ctype
  • PHP module dom
  • PHP module GD
  • PHP module iconv
  • PHP module JSON
  • PHP module libxml
  • PHP module mb multibyte
  • PHP module SimpleXML
  • PHP module XMLWriter
  • PHP module zip
  • PHP module zlib

Database connectors (pick at least one):

  • PHP module sqlite (>= 3, usually not recommended for performance reasons)
  • PHP module mysql
  • PHP module pgsql (requires PostgreSQL >= 9.0)

Recommended packages:

  • PHP module curl (highly recommended, some functionality, e.g. http user authentication, depends on this)
  • PHP module fileinfo (highly recommended, enhances file analysis performance)
  • PHP module bz2 (recommended, required for extraction of apps)
  • PHP module intl (increases language translation performance and fixes sorting of non-ASCII characters)
  • PHP module mcrypt (increases file encryption performance)
  • PHP module openssl (required for accessing HTTPS resources)

Required for specific apps:

  • PHP module ldap (for LDAP integration)
  • smbclient (for SMB storage / external user authentication)
  • PHP module ftp (for FTP storage / external user authentication)
  • PHP module imap (for external user authentication)

Recommended for specific apps (optional):

  • PHP module exif (for image rotation in pictures app)
  • PHP module gmp (for SFTP storage)

For enhanced server performance (optional / select only one of the following):

  • PHP module apc
  • PHP module apcu
  • PHP module xcache

For preview generation (optional):

  • PHP module imagick

  • avconv or ffmpeg

  • OpenOffice or LibreOffice

  • Please check your distribution, operating system or hosting partner documentation on how to install and enable these modules.

  • Make sure your distribution’s PHP version fulfills the version requirements specified above. If it doesn’t, there might be custom repositories you can use. If you are e.g. running Ubuntu 10.04 LTS, you can update your PHP using a custom PHP PPA:

    sudo add-apt-repository ppa:ondrej/php5
    sudo apt-get update
    sudo apt-get install php5
  • You don’t need the WebDAV module for your web server (i.e. Apache’s mod_webdav) to access your ownCloud data via WebDAV. ownCloud has a built-in WebDAV server of its own, SabreDAV.

Red Hat Enterprise Linux 6, CentOS 6, and PHP 5.4

RHEL 6 and CentOS still ship with PHP 5.3.x. It is highly recommended to upgrade to 5.4 because 5.3.x has many deprecated functions, and will cause problems with your ownCloud installation. To upgrade to PHP 5.4 without violating your RHEL support agreement you must use the Software Collections (SCL) repository. Follow these steps on RHEL 6:

subscription-manager repos --enable rhel-server-rhscl-6-eus-rpms

Then install PHP 5.4 and these modules:

yum install php54 php54-php php54-php-gd php54-php-mbstring

You must also install the updated database module for your database. This installs the new PHP 5.4 module for MySQL/MariaDB:

yum install php54-php-mysqlnd

Activate the new PHP version permanently:

source /opt/rh/php54/enable

Disable loading the old PHP 5.3 Apache module:

mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf/old

You should have a /etc/httpd/conf.d/php54-php.conf file, which loads the correct PHP 5.4 module for Apache.

Then restart Apache:

service httpd restart

Verify with phpinfo that your Apache server is using PHP 5.4 and loading the correct modules.

The steps for CentOS 6 are slightly different. First install the SCL repo:

yum install centos-release-SCL

Then install PHP 5.4 and these modules:

yum install php54 php54-php php54-php-gd php54-php-mbstring

You must also install the updated database module. This installs the new PHP 5.4 module for MySQL/MariaDB:

yum install php54-php-mysqlnd

Activate the new PHP version permanently:

source /opt/rh/php54/enable

Disable loading the old PHP 5.3 Apache module:

mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf/old

You should now have a /etc/httpd/conf.d/php54-php.conf file, which loads the correct PHP 5.4 module for Apache.

Finally, restart Apache:

service httpd restart

Verify with phpinfo that your Apache server is using PHP 5.4 and loading the correct module.

Example installation on Ubuntu 14.04 LTS Server

On a machine running a pristine Ubuntu 14.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:

apt-get install apache2 mariadb-server libapache2-mod-php5
apt-get install php5-gd php5-json php5-mysql php5-curl
apt-get install php5-intl php5-mcrypt php5-imagick
  • This installs the packages for the ownCloud core system. If you are planning on running additional apps, keep in mind that they might require additional packages. See the Prerequisites section (above) for details.
  • At the execution of each of the above commands you might be prompted whether you want to continue; press “Y” for Yes (that is if your system language is English. You might have to press a different key if you have a different system language).
  • At the installation of the MySQL server, you will be prompted to create a root password. Be sure to remember the password you enter there for later use as you will need it during ownCloud database setup.

Now download the archive of the latest ownCloud version:

  • Go to the ownCloud Installation Page.

  • Click the Archive file for server owners button.

  • Click Download Unix.

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

  • Save this file on the machine you want to install ownCloud on.

  • Verify the MD5 or SHA256 sum:

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

    wget https://download.owncloud.org/community/owncloud-x.y.z.tar.bz2.asc
    wget https://www.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. Open a terminal, navigate to your download directory, and run:

    tar -xjf owncloud-x.y.z.tar.bz2
  • Copy the ownCloud files to their final destination in the document root of your web server:

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

    where /path/to/webserver/document-root is replaced by the document root of your Web server. On Ubuntu systems this /var/www/owncloud, so your copying command is:

    cp -r owncloud /var/www/

Installation Wizard

Finish setting up your ownCloud server by following the Installation Wizard.

After running the Installation Wizard your ownCloud installation is complete. However, you should perform the following steps to improve your server’s security.

Setting Strong Directory Permissions

We recommend setting the directory permissions in your ownCloud installation as strictly as possible for stronger security. Please refer to the Setting Strong Directory Permissions section of Installation Wizard.

SELinux

See SELinux Configuration for a suggested configuration for SELinux-enabled distributions such as Fedora and CentOS.

Apache is the recommended Web server.

Configuration notes to php.ini files

Keep in mind that changes to php.ini may have to be done on more than one ini file. This can be the case, as example, for the date.timezone setting.

php.ini - used by the webserver:

  /etc/php5/apache2/php.ini
or
  /etc/php5/fpm/php.ini
or ...

php.ini - used by the php-cli and so by ownCloud CRON jobs:

/etc/php5/cli/php.ini

Apache Web Server Configuration

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.

Enabling SSL

An 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 according site. Open a terminal and run:

a2enmod ssl
a2ensite default-ssl
service apache2 reload

If you are using a different distribution, check your documentation on how to enable SSL.

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 commercial signing authority. Check with your domain name registrar or hosting service, if you’re using one, for good deals on commercial certificates.

Configuring ownCloud

Since there was a change in the way versions 2.2 and 2.4 are configured, you’ll have to find out which Apache version you are using.

Usually you can do this by running one of the following commands:

apachectl -v
apache2 -v

Example output:

Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jul 22 2014 14:36:38

Example config for Apache 2.2:

<Directory /path/to/owncloud>
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

Example config for Apache 2.4:

<Directory /path/to/owncloud>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
  • This configuration entry needs to go into the configuration file of the “site” you want to use.

  • On a Ubuntu system, this typically is the “default-ssl” site (to be found in the /etc/apache2/sites-available/default-ssl.conf).

  • Add the entry shown above immediately before the line containing:

    </VirtualHost>

    (this should be one of the last lines in the file).

  • A minimal site configuration file on Ubuntu 14.04 might look like this:

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
        ServerName YourServerName
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
        SSLEngine on
        SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
        SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
                SSLOptions +StdEnvVars
        </Directory>
        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
        <Directory /var/www/owncloud>
                Options Indexes FollowSymLinks
                AllowOverride All
                Allow from all
                Require all granted
                Dav Off
                Satisfy Any
        </Directory>
</VirtualHost>
</IfModule>
  • For ownCloud to work correctly, we need the module mod_rewrite. Enable it by running:

    a2enmod rewrite
  • In distributions that do not come with a2enmod, the module needs to be enabled manually by editing the Apache config files, usually /etc/httpd/httpd.conf. Consult the Apache documentation or your Linux distribution’s documentation.

  • In order for the maximum upload size to be configurable, the .htaccess in the ownCloud folder needs to be made writable by the server (this should already be done, see section Set the Directory Permissions).

  • You should make sure that any built-in WebDAV module of your web server is disabled (at least for the ownCloud directory), as it will interfere with ownCloud’s built-in WebDAV support.

    If you need the WebDAV support in the rest of your configuration, you can turn it off specifically for the ownCloud entry by adding the following line in the <Directory section for your ownCloud server. Add the following line directly after the allow from all / Require all granted line:

    Dav Off
  • 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 turn off the authentication specifically for the ownCloud entry. Following the above example configuration file, add the following line directly after the allow from all / Require all granted line in the <Directory section:

    Satisfy Any
  • When using ssl, take special note on 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.

Note

By default, the certificates’ CommonName will be set to the host name at the time the ssl-cert package was installed.

  • Finally, restart Apache.

    • On Ubuntu systems run:

      service apache2 restart
    • On systemd systems (Fedora, Arch Linux, OpenSUSE), run:

      systemctl restart httpd.service

Other Web Servers

Microsoft Internet Information Server (IIS)

See Windows 7 and Windows Server 2008 for further instructions.

Nginx Configuration

See Nginx Configuration

Lighttpd Configuration

See Lighttpd Configuration

Yaws Configuration

See Yaws Configuration

Hiawatha Configuration

See Hiawatha Configuration