Creating And Configuring OwnCloud (Self-hosted Cloud Storage)

From Nick's Personal Wiki
Jump to navigation Jump to search

Prerequisites

Before installing OwnCloud onto a server, OwnCloud requires the entire LAMP stack be installed beforehand. LAMP stands for Linux, Apache, MySQL, and PHP. Refer to this page here to complete those prerequisites.

Installation

Create The MariaDB (MySQL) Database

Log in to the MariaDB console:

sudo mysql -u USER -p PASSWORD

Create the database:

CREATE DATABASE DATABASE_NAME;

Create a new database user with the needed privileges and a strong password.

GRANT ALL ON DATABASE_NAME.* TO 'USER_NAME'@'localhost' IDENTIFIED BY 'PASSWORD';

Flush the privileges of your database:

FLUSH PRIVILEGES;

Exit the MariaDB console:

exit

The database has now been created.

Download The Latest OwnCloud Version

Confirm the most recent version of OwnCloud on the OwnCloud website before continuing, the OwnCloud installation files will be referred to as OwnCloud-Latest from this point forward, replace that with the correct package/version name.


Install the 'wget' utility if it is not already:

Ubuntu/Debian
sudo apt update && apt install wget
CentOS/RHEL/Fedora
sudo dnf install wget


Pull down the latest OwnCloud version that was located above:

wget https://download.owncloud.com/server/stable/OwnCloud-Latest.tar.bz2

Extract the file:

tar -xjf OwnCloud-Latest.tar.bz2

Move the extracted directory to the Apache document root, typically at /var/www/html/:

sudo mv owncloud /var/www/html/

Modify the permissions and change the ownership of the extracted/relocated directory:

sudo chown -R apache: /var/www/html/owncloud


Configuration

Create An Apache Config File

Because Apache requires a virtual host config file to host an OwnCloud instance, create one for the OwnCloud instance:

sudo nano /etc/httpd/conf.d/owncloud.conf

Enter the following into the config file as a good starting point:

Alias /owncloud "/var/www/html/owncloud/"
<Directory /var/www/html/owncloud/>
  Options +FollowSymlinks
  AllowOverride All

<IfModule mod_dav.c>
  Dav off
</IfModule>

SetEnv HOME /var/www/html/owncloud
SetEnv HTTP_HOME /var/www/html/owncloud

</Directory>

Restart the Apache service for the changes to take effect:

sudo systemctl restart httpd

Configure SELinux to allow for Apache to write to the OwnCloud directory:

sudo setsebool -P httpd_unified 1

OwnCloud Configuration Via The WebGUI

Now the server, and OwnCloud instance, should be accessible via a browser. Navigate to the server address or domain name of the server in a browser to verify this:

http://example.com/owncloud or http://A.B.C.D/owncloud

After accessing the WebGUI installer for OwnCloud, follow the prompts to create a username and password for the admin user.

Click the 'Storage & Database' drop-down arrow and select 'MySQL/MariaDB' as the database.

Now that the database section is available, fill in the available information using the credentials from the database configured earlier:

Database user: USER

Database password: PASSWORD

Database: DATABASE_NAME

Localhost: Leave the Default.


Select 'Finish Setup'.

After completing the initial install, OwnCloud should prompt for a login, enter the admin credentials from above.

A basic installation of OwnCloud is now complete. OwnCloud-Client and Mobile apps can now be configured to access and sync with this hosted instance.