ownCloud is a software application provide self hosted file hosting services. You can install owncloud application on your server and use it as your own file server. Where you can easily upload/sync files from the client machine. It also provides options to sync and share across devices—all under your control. This tutorial will help you to set up your own file hosting server with the ownCloud on the CentOS 8 Linux system.
Prerequsites
- New system’s recommended to follow initial server setup.
- Shell access to the CentOS 8 system
Step 1 – Disable SELinux
Before starting, it is a good idea to disable the SELinux in your system.
To disable SELinux, open the /etc/selinux/config file:
nano /etc/selinux/config
Change the following line:
SELINUX=disabled
Step 2 – Install Apache/MySQL/PHP
To set up ownCloud you must have running LAMP server on your CentOS 8 system. If you already have running LAMP stack skip this step else use the following commands to install it.
Install Apache2
sudo dnf install httpd
Install MySQL
sudo dnf install @mysql sudo mysql_secure_installation
Use this tutorial for the complete MySQL installation steps on CentOS 8.
Install PHP
Let’s start with the installation of PHP 5.6 or higher version.
sudo dnf install php php-gd php-curl php-zip php-dom php-xml php-simplexml php-mbstring php-intl php-json
Step 3 – Download ownCloud Source
After successfully configuring lamp server on your system, Let’s download latest ownCloud from its official website.
cd /tmp wget https://download.owncloud.org/community/owncloud-10.4.0.tar.bz2
Next, extract downloaded archive under the website document root and set up appropriate permissions on files and directories.
cd /var/www sudo tar xjf /tmp/owncloud-10.4.0.tar.bz2 sudo chown -R apache:apache owncloud sudo chmod -R 755 owncloud
ownCloud keep its data under the separate directory. We suggest to keep this outside of ownCloud application directory. So create directory like below, and set proper permission to allow web server to write files.
mkdir -p /var/owncloud/data sudo chown -R apache:apache owncloud sudo chmod -R 755 owncloud
Step 4 – Create MySQL User and Database
After extracting code, let’s create a MySQL database and user account for configuring ownCloud. Use following set of command to login to MySQL server and create database and user.
mysql -u root -p Enter password: mysql> CREATE DATABASE owncloud; mysql> CREATE USER 'owncloud'@'localhost' IDENTIFIED BY '_password_'; mysql> GRANT ALL ON owncloud.* to 'owncloud'@'localhost'; mysql> FLUSH PRIVILEGES; mysql> quit
Step 5 – Configure Apache
Now, create a Apache configuration file and setup owncloud alias. This will allow us to access ownCloud as sub-directory url.
Create and edit file:
sudo vim /etc/httpd/conf.d/owncloud.conf
Add the below content:
Alias /owncloud “https://tecadmin.net/var/www/owncloud” <Directory /var/www/owncloud> Options FollowSymlinks AllowOverride All <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/owncloud SetEnv HTTP_HOME /var/www/owncloud </Directory> |
Save and close file. Then restart the Apache service to reload configuration file.
sudo systemctl restart httpd
Step 6 – Run ownCloud Web Installer
Now access the ownCloud in the web browser as below. Change the webhost.tecadmin.net to your server IP address or domain name.
http://webhost.tecadmin.net/owncloud/
Enter new admin credentials to create an admin account and provide the location of the data folder.
Now slide your page down and input the database credentials and click on Finish Setup.
After completing the setup you will get the admin dashboard. Where you can create a user, groups, assigned them permissions, etc.
Conclusion
Congratulations, You have a working ownCloud instance on your CentOS 8 Linux system.