Creating And Configuring OwnCloud (Self-hosted Cloud Storage)
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 [link coming soon] 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