Share on Social Media

ownCloud is a free and open source software for creating and using file hosting services. In this article, you will learn to install ownCloud on Linux 8. #centlinux #linux #saas

What is ownCloud? :

OwnCloud is an open-source file sync, share and content collaboration software that lets teams work on data easily from anywhere, on any device.

The Server Edition of ownCloud is free and open-source, thereby allowing anyone to install and operate it without charge on their own private server. You can build your own cloud storage by using this software.

ownCloud functionally has similarities to the widely used Dropbox. The primary functional difference between ownCloud and Dropbox is that ownCloud is primarily server software.

ownCloud supports extensions that allow it to work like Google Drive, with online office suite document editing, calendar and contact synchronization, and more.

Its openness avoids enforced quotas on storage space or the number of connected clients, instead of having hard limits (for example on storage space or number of users) limits are determined by the physical capabilities of the server. (Source: Wikipedia)

Recommended Book: Getting Started with ownCloud Kindle Edition (PAID LINK) by Aditya Patawari

Environment Specification:

We are using a minimal RHEL 8 virtual machine with following specification.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 100 GB
  • Operating System – Red Hat Enterprise Linux 8.4
  • Hostname – owncloud-01.centlinux.com
  • IP Address – 192.168.116.238 /24

Update Your Linux Operating System:

Connect with owncloud-01.centlinux.com as root user by using a ssh client.

Before installing a new software, it is a best practice to update existing packages in your Linux operating system.

# dnf update -y

If the above command installs a new Linux Kernel, then you should reboot your Linux operating system with the new Kernel.

# reboot

Verify the Linux operating system and Kernel versions in use.

# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.4 (Ootpa)

# uname -r
4.18.0-305.12.1.el8_4.x86_64

Install ownCloud Prerequisites:

ownCloud is written in PHP programming language, therefore, you are required a LAMP or LEMP server to deploy this application. Here, we are installing a LAMP server.

All of the ownCloud prerequisite packages are available in standard yum repositories. Therefore, you can install all these software packages by using a single dnf command.

# dnf install -y httpd mariadb-server mariadb php php-curl php-gd php-intl php-json php-ldap php-mbstring php-mysqlnd php-xml php-zip php-opcache wget bzip2

Enable and start LAMP services.

# systemctl enable --now httpd php-fpm mariadb
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

Configure initial settings and security of MySQL database server.

# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Connect with MySQL database server as root user.

# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 16
Server version: 10.3.28-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>

Create a database, that serves as the back end repository for ownCloud server.

MariaDB [(none)]> CREATE DATABASE oc_db;
Query OK, 1 row affected (0.001 sec)

Create a database user for accessing the ownCloud database.

MariaDB [(none)]> CREATE USER 'oc_user'@'localhost' IDENTIFIED BY 'P@ssw0rd';
Query OK, 0 rows affected (0.001 sec)

Grant complete privileges on oc_db database to oc_user.

MariaDB [(none)]> GRANT ALL ON oc_db.* TO 'oc_user'@'localhost';
Query OK, 0 rows affected (0.001 sec)

Reload privileges tables and exit from MySQL shell.

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> EXIT
Bye

Install ownCloud on Linux:

ownCloud file hosting server is available for free download at their official website. You can get the download link of the latest version from there and use the wget command to download it on your Linux server machine.

# wget https://download.owncloud.org/community/owncloud-complete-20210721.tar.bz2
--2021-08-24 12:49:19--  https://download.owncloud.org/community/owncloud-complete-20210721.tar.bz2
Resolving download.owncloud.org (download.owncloud.org)... 167.233.14.167, 2a01:4f8:1c1d:3d1::1
Connecting to download.owncloud.org (download.owncloud.org)|167.233.14.167|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 37541418 (36M) [application/x-bzip2]
Saving to: ‘owncloud-complete-20210721.tar.bz2’

owncloud-complete-2 100%[===================>]  35.80M  29.8KB/s    in 14m 30s

2021-08-24 13:03:51 (42.1 KB/s) - ‘owncloud-complete-20210721.tar.bz2’ saved [37541418/37541418]

We have downloaded the BZIP compressed Tar file. ALternatively, you can choose to download other formats.

Execute the following tar command to extract downloaded file in /var/www directory.

# tar xjf owncloud-complete-20210721.tar.bz2 -C /var/www/

Give the ownership of extracted files to Apache user.

# chown -R apache: /var/www/owncloud

Create a Apache configuration file to deploy ownCloud application. You can use vim text editor for this purpose.

# vi /etc/httpd/conf.d/owncloud.conf

Add following Apache directives in this file.

Alias /owncloud "/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 exit from vim text editor.

Execute following command to test your Apache configurations.

# httpd -t
Syntax OK

Restart Apache service to load changes.

# systemctl restart httpd

Apache process requires explicit read/write access to ownCloud software directory. You can either configure this by defining a SELinux fcontext by using semanage command. or by enabling the httpd_unified SELinux boolean.

Here, we are enabling SELinux boolean by using setsebool command.

# setsebool -P httpd_unified 1

To make your storage cloud accessible across the network, you need to allow the Apache default service port in Linux firewall.

# firewall-cmd --permanent --add-service=http
success
# firewall-cmd --reload
success

Open URL http://owncloud-01.centlinux.com/owncloud in a web browser.

owncloud create admin page

Create an admin user and set the data directory for ownCloud application.

owncloud configure database page

Provide database credentials for connectivity between ownCloud and MySQL server.

Click on ‘Finish Setup’.

owncloud login prompt

Login as admin user.

owncloud dashboard

You have reached at the dashboard of ownCloud application.

Conclusion – Install ownCloud on Linux 8:

In this article, you have learned how to install owncloud on Linux 8. The same steps are also good for installation on Rocky Linux, Alma Linux or Oracle Linux. You can now build your own cloud storage.

Leave a Reply

Your email address will not be published. Required fields are marked *