Building your ownCloud

Store your files, folders, contacts, photo galleries, calendars and more on a server of your own. Access that folder wherever you are from your mobile device, your desktop, or a web browser.
Keep your files, contacts, photo galleries, calendars and more synchronized amongst your devices.
Share your data with others, and give them access to your latest photo galleries, your calendar, your music, or anything else you want them to see. Share it publicly, or privately. It is your data, do what you want with it.


Tired of uploading and delete my photos and docs on dropbox, google drive etc. I stumbled upon this open source project, which is one of the most mature and well documented, and realized that the time to switch off all my existing proprietary clouds had come :)

What follows was tested on a Slackware 14.1 environment, where I have manually installed apache 2.4 and php 5.6. I think that the installation should not be much different for another Linux distribution provided that you install the required packages.

Download and extract:

cd /path/to/your/webserver/document-root
wget --no-check-certificate
tar xjf owncloud-7.0.3.tar.bz2
ln -s owncloud-7.0.3 owncloud
chown -R root:root owncloud

Move the data dir outside the document root, so that it is not accessibile from the web:

mv owncloud/data ./owncloud-data

Now modify your config/config.php accordingly:

'datadirectory' => '/path/to/your/webserver/document-root/owncloud/data',
'datadirectory' => '/path/to/your/webserver/document-root/owncloud-data',

Check the requirements from the manual installation web page.

This is my php-5.6 configuration:

./configure \
        --with-mysql=/usr/local/mariadb \
        --with-mysqli=/usr/local/mariadb/bin/mysql_config \
        --with-pdo-mysql=/usr/local/mariadb \
        --with-mysql-sock=/usr/local/mariadb/tmp/mysql.sock \
        --with-mcrypt \
        --enable-mbstring \
        --enable-ftp \
        --with-zlib \
        --with-bz2 \
        --enable-zip \
        --enable-bcmath \
        --with-mhash \
        --with-curl \
        --with-gd \
        --with-jpeg-dir=/usr \
        --with-png-dir=/usr \
        --enable-gd-native-ttf \
        --with-freetype-dir=/usr \
        --with-t1lib \
        --enable-exif \
        --with-gettext=/usr \
        --enable-sockets \
        --with-xsl \
        --with-xmlrpc \
        --with-openssl \
        --enable-intl \
        --enable-soap \
        --with-pspell \
        --with-gmp \

Create a virtualHost on apache. Here is my configuration for apache-2.4:

<VirtualHost *:443 *:80>
        # adjust this accoording to your ssl config
        Include my-ssl-stuff.conf

        ServerName cloud.yourdomain.xy
        DocumentRoot /path/to/your/webserver/document-root/owncloud

        ErrorLog /path/to/logs/owncloud_error.log
        LogLevel warn
        CustomLog /path/to/logs/owncloud_access.log combined

        <Directory /path/to/your/webserver/document-root/owncloud>
                AllowOverride All
                Options +Indexes +FollowSymLinks +MultiViews
                Require all granted
                # add any possibly required additional directives here
                # e.g. the Satisfy directive (see below for details):
                Satisfy Any

        <IfModule mod_headers.c>
                Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains"

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars

        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

Preparae a mysql/mariadb database and user, because during the setup you will be requested for a database access.

Now it's time to connect to your owncloud site looking for https://cloud.yourdomain.xy. It's easy to create your first account and set up the mysql database.

You can adjust your configuration editing the config/config.php file. For example, you may want to configure the default language. This is my config.php file:

$CONFIG = array (
  'maintenance' => false,
  'instanceid' => 'xxxxxxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => 'cloud.yourdomain.xy',
  'datadirectory' => '/path/to/your/webserver/document-root/owncloud-data',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'owncloud',
  'dbhost' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'xxxxxxxx',
  'dbpassword' => 'xxxxxxxxx',
  'installed' => true,
  'forcessl' => true,
  'mail_from_address' => 'noreply',
  'mail_smtpmode' => 'php',
  'mail_domain' => 'yourdomain.xy',
  'default_language' => 'it',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/path/to/your/webserver/document-root/owncloud/apps',
      'url' => '/apps',
      'writable' => false,
    1 =>
    array (
      'path' => '/path/to/your/webserver/document-root/owncloud/apps2',
      'url' => '/apps2',
      'writable' => true,
  'preview_libreoffice_path' => '/usr/bin/libreoffice',
  'loglevel' => '2',

Post installation tasks

At this point you may want to install some reccomended php modules such as apcu and imagick via PECL:

/path/to/php/bin/pecl install apcu
/path/to/php/bin/pecl install imagick-3.2.0RC1

as you can see I decided to install the latest candidate release of imagick; I'll explain why later.

Now enable them adding those 2 lines in your php.ini:

To satisfy image magick's requirements, you have to install ghostscipt and tons of libraries which should be already available in your distro. Slackware users should install (almost) everything in the "l" and "x" series.

To be able to generate previews of video and office documents you have to install ffmpeg and libreoffice (or openoffice) packages as well.


Set up the cronjob adding a line like this in your crontab and enabling the "system cron" in the "admin" panel

*/15 * * * * /path/to/php/bin/php /path/to/your/webserver/document-root/owncloud/cron.php >> /var/log/cron 2>&1

Don't forget to give the exec flag to cron.php:

chmod +x /path/to/your/webserver/document-root/owncloud/cron.php

Setting the file manager

If you want owncloud to let you upload big files you have to set write permissions to your .htaccess file


Set up a logrotate process adding something like this in your /etc/logrotate.d/owncloud (the location may depend on your distribution):

/path/to/your/webserver/document-root/owncloud-data/owncloud.log {
    rotate 5
    create 644 apache apache

Desktop owncloud-client

  • version: 2.0.1
  • download here the package for your distro

In the link above you can download and install the package for the most common distribution. If you are a Slackware user you are used to do build the packages bu yourself :). In this case you can find the needed slackbuilds in the SBo repo.

Before you build (or manually compile) the package you must satisfy these requirements:

  • check (slackware users can get the slackbuild from SBo)
  • iniparser (slackware users can get the slackbuild from SBo)
  • ocsync (slackware users can get the slackbuild from SBo)
  • QtKeychain (slackware users get the slackbuild from the Alien Bob's repository)


  • If your apache server is behind a DMZ create a record in the DMZ of your Name Server, otherwise you'll get an error like this in your log:
{"app":"core","message":"isWebDAVWorking: NO - Reason: [CURL] Error while making request: Couldn't resolve host '' (error code: 6) (Sabre\\DAV\\Exception)","level":2,"time":"2014-07-26T16:44:50+00:00"}
  • In a Slackware-14.0 server solved a ghostscript/image magick problem upgrading both to the latest version and installing the RC version of the php module as mentioned above
{"app":"core","message":"Postscript delegate failed `\/tmp\/9b10e620ac5c9d2ac0a3bd770193be5cpdf': No such file or directory @error\/pdf.c\/ReadPDFImage\/669","level":3,"time":"2014-07-29T12:26:00+00:00"}

So I have the following version working version here:

  • ghostscript-9.14
  • imagemagick-6.8.9_6
  • php module: imagick-3.2.0RC1

To troubleshoot if imagemagick is working you have to be sure that the convert script is usable by apache making your web server run a script like this:

echo "<pre>";
exec("/usr/bin/convert /path/to/your/webserver/document-root/owncloud/temp/test-0.jpg /path/to/your/webserver/document-root/owncloud/owncloud/temp/test.jpg 2>&1", $array);  
echo "<br>".print_r($array)."<br></pre>";

Try also to convert pdf documents.

You can always print how image magick is configured (especially the delegates) with a script like this


// Build the array of items to be used
exec("convert -list list", $IMarray, $code);

// Start the loop to find and display the results
foreach ($IMarray as $value) {
echo "<br>system (\"convert -list $value\")";
echo "<pre>";
system("convert -list $value");
echo "</pre><hr>";

Installing apc on php-5.6.0 I got this compilation error:

cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root9f66KR/APC-3.1.13/include -I/tmp/pear/temp/pear-build-root9f66KR/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/local/php-5.6/include/php -I/usr/local/php-5.6/include/php/main -I/usr/local/php-5.6/include/php/TSRM -I/usr/local/php-5.6/include/php/Zend -I/usr/local/php-5.6/include/php/ext -I/usr/local/php-5.6/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_cache.c  -fPIC -DPIC -o .libs/apc_cache.o
/tmp/pear/temp/APC/apc_cache.c: In function '_apc_cache_user_update':
/tmp/pear/temp/APC/apc_cache.c:818:63: error: 'IS_CONSTANT_INDEX' undeclared (first use in this function)
/tmp/pear/temp/APC/apc_cache.c:818:63: note: each undeclared identifier is reported only once for each function it appears in
/tmp/pear/temp/APC/apc_cache.c:820:22: error: 'IS_CONSTANT_ARRAY' undeclared (first use in this function)
make: *** [apc_cache.lo] Error 1
ERROR: `make' failed

So I decided to install apcu inetad of apc, which has been patched to correct the error. You have to install the beta version of apcu in this way:

pecl install apcu-4.0.6

remember to add "" to your php.ini.

Increasing the default file size upload limit

Ownclous comes with a limit of 512MB, which can be unsufficient. Basically you would have to adjust the files .htaccess or .user.ini, but in that case you will get an annoying "integrity check error" in the new 9.0 version. So I suggest not to modify but to act in your php.ini file adding lines like these:

upload_max_filesize = 2G
post_max_size = 2G


NB: I have tested this procedure until the version 8.1.3, both for major and minor releases.

First of all, put your owncloud in maintenance mode modifing your config.php like this:

'maintenance' => true,

Follow the instructions on the official site at

This is what I do after

  • the backup of my database
  • the backup of the data directory (I do this just in case of major release
cd /path/to/your/webserver/document-root
# delete the symbolic link
rm owncloud
wget --no-check-certificate
tar xjf owncloud-x.x.x.tar.bz2
chown -R apache:apache owncloud
mv owncloud owncloud-x.x.x
cd owncloud-x.x.x
# restore from the old dir
cp -rp ../owncloud-old/apps2 .
cd config
mv config.php config.php.BAK
cp -p ../../owncloud-old/config/config.php .
cd ..
chmod +x cron.php
cd ..
# restore the symbolic link
ln -s owncloud-x.x.x owncloud

Now proceed to the upgrade/update from the command line:

cd owncloud
/path/to/php/bin/php occ upgrade

Now you can switch off the maintenance mode and connect to your cloud via web and proceed to the upgrade.