From Fedora Project Wiki

(→‎Resources: Nginx added)
 
(19 intermediate revisions by 7 users not shown)
Line 1: Line 1:
ownCloud is a AGPLv3 private file server
[https://www.owncloud.org ownCloud] is a web application that implements "cloud" services such as file storage and sharing, contact and calendar hosting and more. This page will help you set up an ownCloud server running on a Fedora system. See also the [http://doc.owncloud.org/ official documentation] (though we advise against using upstream's ownCloud packages from the Open Build Service: this guide uses Fedora's own ownCloud packages).


== Features ==
== Features ==
Line 5: Line 5:
* Online file storage
* Online file storage
* Android compatibility
* Android compatibility
* Contacts(CarDAV) and calendar (CalDAV) synchronization
* Contacts (CardDAV) and calendar (CalDAV) synchronization
* Music streaming
* Music streaming
* Many more
* Many more
Line 11: Line 11:
== Installation ==
== Installation ==


=== Requirements ===
You most likely want to install one of {{package|owncloud-httpd}} or {{package|owncloud-nginx}}, depending on the web server you wish to use, and at least one of {{package|owncloud-mysql}}, {{package|owncloud-postgresql}} and {{package|owncloud-sqlite}} depending on the database you wish to use. For example:


The following software must be installed and configured
# dnf install owncloud-httpd owncloud-mysql


<ol><li>A database management system
If you wish to run ownCloud on [[Apache_HTTP_Server|Apache]] and use a [[MariaDB]] / MySQL database.
* [[MariaDB]]</li>


<li>A web server
=== Enabling and starting the web server ===
* [[Apache HTTP Server]]</li></ol>


=== Install owncloud ===
You will need to enable and start the web server. For Apache:


<pre>$ su root
# systemctl enable --now httpd
$ yum install owncloud owncloud-mysql owncloud-httpd</pre>


A configuration file named <code>/etc/httpd/conf.d/owncloud.conf</code> should have been created


Start [[MariaDB]] and [[Apache HTTP Server]] if they weren't already
For nginx:
<pre>$ systemctl start httpd
$ systemctl start mariadb</pre>


If Apache was already running restart it
# systemctl enable --now nginx php-fpm
<pre>$ systemctl restart httpd</pre>


=== Create a database ===
See the [[Apache_HTTP_Server|Apache page]] or [[Nginx|Nginx page]] for more detailed instructions on installing and configuring of web server.


Log in as root
=== Enabling, starting and configuring the database server ===
<pre>$ mysql -u root -p</pre>


Create a new databse
If you choose to use SQLite, no special configuration is required. However, please be aware that SQLite is not a good choice for even moderately-sized or public deployments, and should really only be used for small private deployments or testing.
<pre>CREATE DATABASE IF NOT EXISTS owncloud;</pre>


Create a new user and grant him privileges
==== [[MariaDB]] / MySQL ====
<pre>CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON owncloud.* TO 'username'@'localhost' IDENTIFIED BY 'password';</pre>


Reload privileges and quit
If you use MariaDB / MySQL, you will need to enable and start the database server. It is then strongly recommended to secure the server configuration.
<pre>FLUSH PRIVILEGES;
quit</pre>


=== Setup owncloud ===
# systemctl enable --now mysqld
$ mysql_secure_installation


Open <code>localhost/owncloud</code> in your browser and create the admin account. Also configure owncloud database parameters set previously.
You should then create a database and a user for ownCloud to use.


Then your owncloud server should be available under your <code>localhost/owncloud</code>. Unless configured otherwise it won't be available from outside.
$ mysql -u root -p
  CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
  CREATE DATABASE IF NOT EXISTS owncloud;
  GRANT ALL PRIVILEGES ON owncloud.* TO 'username'@'localhost' IDENTIFIED BY 'password';
  FLUSH PRIVILEGES;


{{admon/warning | This exposes your installation to the Internet and potential attackers. Secure your installation properly before exposing your server to the Internet.}}
Set the username as you like (but 'owncloud' is always a safe choice...), and choose a strong password (it will be saved in your ownCloud configuration, so there's no need to worry about convenience in re-typing or remembering it).


Once owncloud is properly configured you can make it available from outside. Edit <code>/etc/httpd/conf.d/owncloud.conf</code> such that
For more information on MariaDB / MySQL deployment and configuration on Fedora, see [[MariaDB]]. You can also refer to the excellent [https://mariadb.com/kb/en/mariadb/documentation/ upstream documentation].
<pre>    <IfModule mod_authz_core.c>
    # Apache 2.4
    #Require local
    Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
    # Apache 2.2
    Order Deny,Allow
    #Deny from all
    #Allow from 127.0.0.1
    #Allow from ::1
    Allow from all
    </IfModule>
</pre>


This however enables owncloud for all your virtual hosts under <code>hostname/owncloud</code>. If this is not what you want, comment out this line
==== [[PostgreSQL]] ====
<pre># Alias /owncloud /usr/share/owncloud</pre>


And for example, let's say that you want to create a virtual host for owncloud using the domain <code>owncloud.hostname</code> with SSL support. If /etc/httpd/conf.d/hostname.conf doesn't exist, create it, and paste this
If you use PostgreSQL, you will need to initialize the server before enabling and starting it.
<pre>
<VirtualHost *:80>
    ServerName hostname
    DocumentRoot /usr/share/owncloud
</VirtualHost>


<VirtualHost *:443>
# postgresql-setup initdb
    ServerName hostname
# systemctl enable --now postgresql
    DocumentRoot /usr/share/owncloud
    SSLEngine On
    SSLCertificateFile /etc/pki/tls/certs/hostname.crt
    SSLCertificateKeyFile /etc/pki/tls/private/hostname.key
</VirtualHost>
</pre>


ownCloud onfiguration file is <code>/etc/owncloud/config.php</code>
You will also need to configure SELinux to allow the web server to connect to the PostgreSQL server via TCP/IP:


== Troubleshooting ==
# setsebool -P httpd_can_network_connect_db on


=== Dynamic IP adress ===
and configure PostgreSQL to use password authentication for local TCP/IP connections. To do this, edit {{filename|/var/lib/pgsql/data/pg_hba.conf}} and change the mechanism from 'ident' to 'password' on the lines that configure TCP/IP connections from localhost, 127.0.0.1, and ::0. The line for the 'local' TYPE does not apply to ownCloud, as it does not use local socket access to PostgreSQL servers. More information on this file can be found in the [http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html PostgreSQL documentation].


If you have a dynamic IP address you can configure a dynamic DNS client, for example install [[inadyn-mt]]
Now you will need to create a database and user for ownCloud to use.


== Links ==
# su - -c "psql" postgres
* [http://doc.owncloud.org/server/6.0/admin_manual/contents.html ownCloud Administrators Manual]
  CREATE USER username WITH PASSWORD 'password';
  CREATE DATABASE owncloud TEMPLATE template0 ENCODING 'UNICODE';
  ALTER DATABASE owncloud OWNER TO username;
  GRANT ALL PRIVILEGES ON DATABASE owncloud TO username;
 
Set the username as you like (but 'owncloud' is always a safe choice...), and choose a strong password (it will be saved in your ownCloud configuration, so there's no need to worry about convenience in re-typing or remembering it).
 
It is also a good idea to set a password for the postgres user within PostgreSQL, which you can do with {{command|\password postgres}} from the PostgreSQL prompt.
 
For more details on PostgreSQL deployment and configuration on Fedora, see [[PostgreSQL]]. You can also refer to the excellent [http://www.postgresql.org/docs/current upstream documentation].
 
=== TLS certificate configuration ===
 
See the [[Apache_HTTP_Server|Apache page]] or [[Nginx|Nginx page]] for details on configuring TLS/SSL for your web server.
 
If you wish, you can configure your ownCloud server to only use TLS/SSL connections. Create a file {{filename|/etc/owncloud/forcessl.config.php}} with these contents:
 
<?php
$CONFIG = array (
  'forcessl' => true,
);
 
Now whenever someone tries to connect to any ownCloud page without using TLS/SSL, they will be automatically redirected to the appropriate TLS/SSL URL.
 
=== Initial ownCloud setup ===
 
To perform initial ownCloud configuration, browse to http://localhost or https://localhost (adding a trust exception for your self-signed certificate, if you used one) from the server. If you wish to perform initial configuration from a browser running on a different machine, you will need to refer to [[Apache_HTTP_Server#webapp-access-control|these instructions for broadening access to ownCloud]] and [[Apache_HTTP_Server#firewall-configuration|these instructions for opening firewall ports]]. Please ensure you do not expose the initial configuration wizard to public access!
 
In initial configuration, you will set an administrator username and password, and set your database configuration. If using MariaDB / MySQL or PostgreSQL, enter the appropriate username and password for the database you created earlier.
 
In case of trouble, try restarting the Apache service:
 
# systemctl restart httpd
 
== Grant remote access to the server ==
 
Once you have run initial configuration on your server, you can refer to [[Apache_HTTP_Server#webapp-access-control|these instructions for broadening access to ownCloud]] and [[Apache_HTTP_Server#firewall-configuration|these instructions for opening firewall ports]] in order to allow access to your server from any host. Remember that if your server is running behind a NAT router and you wish to allow access from outside your local network, you will need to configure the router to forward the HTTP and HTTPS ports to your server. Configuring DNS is outside the scope of this documentation.
 
== ownCloud package update policy ==
 
Fedora's ownCloud packages may (and often will) receive major version bumps within a stable release. For instance, ownCloud 7.x may be shipped as an update to ownCloud 6.x within a single Fedora release. We believe this update policy is an appropriate reflection of the upstream development practices:
 
* Old major versions are quickly deprecated, often receiving few, infrequent or even no updates immediately after a new major version ships
* Upgrades across more than one major release are not supported and frequently fail, meaning it would be dangerous for us to release Fedora X with ownCloud 7 and Fedora X+1 with ownCloud 9
 
This policy will be adjusted as appropriate to changes in upstream's practices: if upstream ever adopts an approach more friendly to conservative upgrade policies, we may change to only doing major version bumps between Fedora releases.
 
As ownCloud is not on the [[Critical_path_package|critical path]], we consider this approach acceptable under the [[Updates_Policy#All_other_updates|updates policy]] - we consider it not to be practically "at all possible" to "[a]void Major version updates, ABI breakage or API changes".
 
== Resources ==
 
* [[Apache_HTTP_Server]]
* [[Nginx]]
* [[MariaDB]]
* [[PostgreSQL]]
* [http://doc.owncloud.org/ ownCloud documentation]

Latest revision as of 10:10, 15 February 2017

ownCloud is a web application that implements "cloud" services such as file storage and sharing, contact and calendar hosting and more. This page will help you set up an ownCloud server running on a Fedora system. See also the official documentation (though we advise against using upstream's ownCloud packages from the Open Build Service: this guide uses Fedora's own ownCloud packages).

Features

  • Online file storage
  • Android compatibility
  • Contacts (CardDAV) and calendar (CalDAV) synchronization
  • Music streaming
  • Many more

Installation

You most likely want to install one of Package-x-generic-16.pngowncloud-httpd or Package-x-generic-16.pngowncloud-nginx, depending on the web server you wish to use, and at least one of Package-x-generic-16.pngowncloud-mysql, Package-x-generic-16.pngowncloud-postgresql and Package-x-generic-16.pngowncloud-sqlite depending on the database you wish to use. For example:

# dnf install owncloud-httpd owncloud-mysql

If you wish to run ownCloud on Apache and use a MariaDB / MySQL database.

Enabling and starting the web server

You will need to enable and start the web server. For Apache:

# systemctl enable --now httpd


For nginx:

# systemctl enable --now nginx php-fpm

See the Apache page or Nginx page for more detailed instructions on installing and configuring of web server.

Enabling, starting and configuring the database server

If you choose to use SQLite, no special configuration is required. However, please be aware that SQLite is not a good choice for even moderately-sized or public deployments, and should really only be used for small private deployments or testing.

MariaDB / MySQL

If you use MariaDB / MySQL, you will need to enable and start the database server. It is then strongly recommended to secure the server configuration.

# systemctl enable --now mysqld
$ mysql_secure_installation

You should then create a database and a user for ownCloud to use.

$ mysql -u root -p
  CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
  CREATE DATABASE IF NOT EXISTS owncloud;
  GRANT ALL PRIVILEGES ON owncloud.* TO 'username'@'localhost' IDENTIFIED BY 'password';
  FLUSH PRIVILEGES;

Set the username as you like (but 'owncloud' is always a safe choice...), and choose a strong password (it will be saved in your ownCloud configuration, so there's no need to worry about convenience in re-typing or remembering it).

For more information on MariaDB / MySQL deployment and configuration on Fedora, see MariaDB. You can also refer to the excellent upstream documentation.

PostgreSQL

If you use PostgreSQL, you will need to initialize the server before enabling and starting it.

# postgresql-setup initdb
# systemctl enable --now postgresql

You will also need to configure SELinux to allow the web server to connect to the PostgreSQL server via TCP/IP:

# setsebool -P httpd_can_network_connect_db on

and configure PostgreSQL to use password authentication for local TCP/IP connections. To do this, edit /var/lib/pgsql/data/pg_hba.conf and change the mechanism from 'ident' to 'password' on the lines that configure TCP/IP connections from localhost, 127.0.0.1, and ::0. The line for the 'local' TYPE does not apply to ownCloud, as it does not use local socket access to PostgreSQL servers. More information on this file can be found in the PostgreSQL documentation.

Now you will need to create a database and user for ownCloud to use.

# su - -c "psql" postgres
  CREATE USER username WITH PASSWORD 'password';
  CREATE DATABASE owncloud TEMPLATE template0 ENCODING 'UNICODE';
  ALTER DATABASE owncloud OWNER TO username;
  GRANT ALL PRIVILEGES ON DATABASE owncloud TO username;

Set the username as you like (but 'owncloud' is always a safe choice...), and choose a strong password (it will be saved in your ownCloud configuration, so there's no need to worry about convenience in re-typing or remembering it).

It is also a good idea to set a password for the postgres user within PostgreSQL, which you can do with \password postgres from the PostgreSQL prompt.

For more details on PostgreSQL deployment and configuration on Fedora, see PostgreSQL. You can also refer to the excellent upstream documentation.

TLS certificate configuration

See the Apache page or Nginx page for details on configuring TLS/SSL for your web server.

If you wish, you can configure your ownCloud server to only use TLS/SSL connections. Create a file /etc/owncloud/forcessl.config.php with these contents:

<?php
$CONFIG = array (
  'forcessl' => true,
);

Now whenever someone tries to connect to any ownCloud page without using TLS/SSL, they will be automatically redirected to the appropriate TLS/SSL URL.

Initial ownCloud setup

To perform initial ownCloud configuration, browse to http://localhost or https://localhost (adding a trust exception for your self-signed certificate, if you used one) from the server. If you wish to perform initial configuration from a browser running on a different machine, you will need to refer to these instructions for broadening access to ownCloud and these instructions for opening firewall ports. Please ensure you do not expose the initial configuration wizard to public access!

In initial configuration, you will set an administrator username and password, and set your database configuration. If using MariaDB / MySQL or PostgreSQL, enter the appropriate username and password for the database you created earlier.

In case of trouble, try restarting the Apache service:

# systemctl restart httpd

Grant remote access to the server

Once you have run initial configuration on your server, you can refer to these instructions for broadening access to ownCloud and these instructions for opening firewall ports in order to allow access to your server from any host. Remember that if your server is running behind a NAT router and you wish to allow access from outside your local network, you will need to configure the router to forward the HTTP and HTTPS ports to your server. Configuring DNS is outside the scope of this documentation.

ownCloud package update policy

Fedora's ownCloud packages may (and often will) receive major version bumps within a stable release. For instance, ownCloud 7.x may be shipped as an update to ownCloud 6.x within a single Fedora release. We believe this update policy is an appropriate reflection of the upstream development practices:

  • Old major versions are quickly deprecated, often receiving few, infrequent or even no updates immediately after a new major version ships
  • Upgrades across more than one major release are not supported and frequently fail, meaning it would be dangerous for us to release Fedora X with ownCloud 7 and Fedora X+1 with ownCloud 9

This policy will be adjusted as appropriate to changes in upstream's practices: if upstream ever adopts an approach more friendly to conservative upgrade policies, we may change to only doing major version bumps between Fedora releases.

As ownCloud is not on the critical path, we consider this approach acceptable under the updates policy - we consider it not to be practically "at all possible" to "[a]void Major version updates, ABI breakage or API changes".

Resources