[owncloud-devel] Tip for the Pi: use the autoconfig.php feature

Johan Ouwerkerk jm.ouwerkerk at gmail.com
Fri Dec 18 12:48:36 GMT 2015

So for all the other folks working on their RPi proposals, take a look
at: <owncloud_root>/config/autoconfig.php file.

This allows you to prepopulate the initial set up page form (indeed,
values that you preset will be hidden in the form from the end-user)
of owncloud.
What this script should do is define an associative array called
$AUTOCONFIG with keys mirroring those found in the $CONFIG array.

And that's hugely useful because for everybody looking to do a
end-user friendly image, you can use this to tie owncloud config to
partitioning scheme to DB config.
For example:

 * Auto-configuration snippet to set up owncloud with postgresql by default.
$AUTOCONFIG = array (
    "dbname"        => "owncloud",
     * Example snippets from the owncloud admin guide/documentation
suggest it should be "datadirectory",
     * but, whatever the case, the Debian owncloud package uses the
'directory' key instead.
    "directory" => "/srv/owncloud/data", // where user data will be
stored; should point to the md array partition.
     * On Debian (and derivative) systems postgresql will run with
peer authentication set up by default.
     * Apache2 runs as the www-data user, owncloud will be run with
apache2 -> dbuser = apache2
    "dbuser"        => "www-data",
    "dbpassword"    => "", // irrelevant
    "dbhost"        => "/var/run/postgresql", // necessary to make
owncloud use the local Unix socket.
    "dbtableprefix" => "oc_", // probably not necessary, but can't
hurt to namespace owncloud tables anyway.
    "dbtype"        => "pgsql",

This snippet put in /etc/owncloud/autoconfig.php on a Debian
installation will ensure that the user can still set up the admin
account username + password, but nothing else and
deploy owncloud to a preconfigured owncloud DB running on postgresql.
It also sets up login info (the default postgresql auth method is
'peer' which means that it does auto log in
based on what is effectively a reference to the system user account).

More information about the Devel mailing list