Manual Installation on Linux¶
Installing ownCloud on Linux from our Open 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.
Note
Enterprise customers should refer to
../enterprise_installation/linux_installation
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.
- Prerequisites
- Example Installation on Ubuntu 16.04 LTS Server
- BINLOG_FORMAT = STATEMENT
- Apache Web Server Configuration
- Enabling SSL
- Installation Wizard
- Setting Strong Directory Permissions
- SELinux Configuration Tips
- php.ini Configuration Notes
- php-fpm Configuration Notes
- other_HTTP_servers_label
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 SELinux Configuration Tips 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 required. 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.
Required¶
PHP >= 5.6
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 | For working with message digests (hash). |
Digest Framework | |
iconv | For working with the iconv character set conversion facility. |
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. |
PDO | This is required for the pdo_msql function to work. |
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. |
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 |
Note
SMB/Windows Network Drive mounts require the PHP module smbclient version 0.8.0+; see SMB/CIFS.
Optional¶
Extension | Reason |
---|---|
Bzip2 | Required for extraction of applications |
Fileinfo | Highly recommended, as it enhances file analysis performance |
intl | Increases language translation performance and fixes sorting of non-ASCII characters |
Mcrypt | Increases file encryption performance |
OpenSSL | Required for accessing HTTPS resources |
imagick | Required for creating and modifying images and preview thumbnails |
Recommended¶
For Specific Apps¶
Extension | Reason |
---|---|
Exif | For image rotation in the pictures app |
GMP | For working with arbitrary-length integers |
For Server Performance¶
For enhanced server performance consider installing one of the following cache extensions:
See Configuring Memory Caching to learn how to select and configure a memcache.
For Preview Generation¶
- avconv or ffmpeg
- OpenOffice or LibreOffice
For Command Line Processing¶
Extension | Reason |
---|---|
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, SabreDAV.
If mod_webdav
is enabled you must disable it for ownCloud. (See
Apache Web Server Configuration for an example configuration.)
MySQL/MariaDB Require InnoDB¶
The InnoDB storage engine is required, and MyISAM is not supported, see: MySQL / MariaDB storage engine.
Example Installation 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:
apt-get install apache2 mariadb-server libapache2-mod-php7.0
apt-get install php7.0-gd php7.0-json php7.0-mysql php7.0-curl
apt-get install php7.0-intl php7.0-mcrypt php-imagick
apt-get install php7.0-zip php7.0-xml php7.0-mbstring
The remaining steps are analogous to the installation on Ubuntu 14.04 as shown below.
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.
libapache2-mod-php5
provides the following PHP extensions:bcmath bz2 calendar Core ctype date dba dom ereg exif fileinfo filter ftp gettext hash iconv libxml mbstring mhash openssl pcre Phar posix Reflection session shmop SimpleXML soap sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter zip zlib
. If you are planning on running additional apps, keep in mind that they might require additional packages. See Prerequisites for details. - At 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.
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.
BINLOG_FORMAT = STATEMENT¶
If your ownCloud installation fails and you see this in your ownCloud log:
An unhandled exception has been thrown: exception ‘PDOException’ with message
'SQLSTATE[HY000]: General error: 1665 Cannot execute statement: impossible to
write to binary log since BINLOG_FORMAT = STATEMENT and at least one table
uses a storage engine limited to row-based logging. InnoDB is limited to
row-logging when transaction isolation level is READ COMMITTED or READ
UNCOMMITTED.'
Apache Web Server Configuration¶
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
</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
Additional recommended modules are
mod_headers
,mod_env
,mod_dir
andmod_mime
:a2enmod headers a2enmod env a2enmod dir a2enmod mime
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 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.
Enabling 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.
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 Setting Strong Directory Permissions 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 SELinux Configuration Tips.
To use occ
see Installing ownCloud from the Command Line.
To use the graphical Installation Wizard see Installation Wizard.
Setting Strong Directory Permissions¶
After completing installation, you must immediately set the directory permissions in your ownCloud installation as strictly as possible for stronger security. Please refer to Setting Strong Directory Permissions.
Now your ownCloud server is ready to use.
SELinux Configuration Tips¶
See SELinux Configuration for a suggested configuration for SELinux-enabled distributions such as Fedora and CentOS.
php.ini Configuration Notes¶
Several core PHP settings have to be configured correctly, otherwise ownCloud may
not work properly. Known settings causing issues are listed here. Please note that
there might be other settings causing unwanted behaviours. In general it is recommended
to keep the php.ini
at their defaults.
session.auto_start && enable_post_data_reading¶
Ensure that session.auto_start is set to 0
or Off
and enable_post_data_reading
to 1
or On
in your configuration. If not, you may have issues logging in
to ownCloud via the WebUI, where you see the error: “Access denied. CSRF check
failed”.
session.save_path¶
In addition to setting session.auto_start
and enable_post_data_reading
correctly, ensure that, if session.save_handler
is set to files
, that
session.save_path
is set to a path on the filesystem which the web server
process, or process which PHP is running as, can read from and write to.
post_max_size¶
Please ensure that you have post_max_size
configured with at least the minimum
amount of memory for use with ownCloud, which is 512 MB.
Important
Please be careful when you set this value if you use the byte value shortcut as it is very specific. Use K for kilobyte, M for megabyte and G for gigabyte. KB, MB, and GB do not work!
Note
Keep in mind that changes to php.ini
may have to be configured in more
than one ini file. This can be the case, for example, for the
date.timezone
setting.
php.ini - used by the Web server:
/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
php-fpm Configuration Notes¶
System environment variables
When you are using php-fpm
, system environment variables like
PATH
, TMP
or others are not automatically populated in the same way as
when using php-cli
. A PHP call like getenv('PATH');
can therefore
return an empty result. So you may need to manually configure environment
variables in the appropriate php-fpm
ini/config file.
Here are some example root paths for these ini/config files:
Ubuntu/Mint | CentOS/Red Hat/Fedora |
/etc/php5/fpm/ |
/etc/php-fpm.d/ |
In both examples, the ini/config
file is called www.conf
, and depending
on the distribution or customizations which you have made, it may be in
a sub-directory.
Usually, you will find some or all of the environment variables already in the file, but commented out like this:
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp
Uncomment the appropriate existing entries. Then run printenv PATH
to
confirm your paths, for example:
$ printenv PATH
/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:
/sbin:/bin:/
If any of your system environment variables are not present in the file then you must add them.
When you are using shared hosting or a control panel to manage your ownCloud virtual machine or server, the configuration files are almost certain to be located somewhere else, for security and flexibility reasons, so check your documentation for the correct locations.
Please keep in mind that it is possible to create different settings for
php-cli
and php-fpm
, and for different domains and Web sites.
The best way to check your settings is with PHP Version and Information.
Maximum upload size
If you want to increase the maximum upload size, you will also have to modify
your php-fpm
configuration and increase the upload_max_filesize
and
post_max_size
values. You will need to restart php5-fpm
and your HTTP
server in order for these changes to be applied.
.htaccess notes for Apache
ownCloud comes with its own owncloud/.htaccess
file. Because php-fpm
can’t
read PHP settings in .htaccess
these settings and permissions must be set
in the owncloud/.user.ini
file.
No basic authentication headers were found
This error is shown in your data/owncloud.log
file.
Some Apache modules like mod_fastcgi
, mod_fcgid
or mod_proxy_fcgi
are not passing the needed authentication headers to PHP and so the login to ownCloud via WebDAV, CalDAV and CardDAV clients is failing.
Information on how to correctly configure your environment can be found in the forums but we generally recommend against the use of these modules and recommend mod_php instead.