How to Install ownCloud on AlmaLinux 9

ownCloud is a self-hosted open source file server that enables secure storage, collaboration, and sharing. ownCloud lets you access your files, calendar, contacts, and other data and they are available on any device and can be shared with a few clicks. You can synchronize everything between your devices and share files with others.

Prerequisites

  • The LAMP stack should be installed and running, Click here for Instructions to Install the LAMP stack on the server.

Currently ownCloud supports PHP 7.4

Installing the EPEL and Remi Repository

For this, we use the PHP 7.4 packaged by Remi,

First, let us install the EPEL repository,

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm

Installing PHP 7.4

Now, let's install PHP 7.4 via the remi repository,

dnf module install php:remi-7.4

Output:

[root@server ~]# dnf module install php:remi-7.4
Last metadata expiration check: 0:00:12 ago on Thu Jun  2 18:18:29 2022.
Dependencies resolved.
================================================================================
 Package             Arch      Version                    Repository       Size
================================================================================
Installing group/module packages:
 php-cli             x86_64    7.4.29-1.el9.remi          remi-modular    4.5 M
 php-common          x86_64    7.4.29-1.el9.remi          remi-modular    787 k
 php-fpm             x86_64    7.4.29-1.el9.remi          remi-modular    1.6 M
 php-mbstring        x86_64    7.4.29-1.el9.remi          remi-modular    519 k
 php-xml             x86_64    7.4.29-1.el9.remi          remi-modular    172 k
Installing dependencies:
 libxslt             x86_64    1.1.34-9.el9               appstream       240 k
 oniguruma5php       x86_64    6.9.8-1.el9.remi           remi-safe       219 k
 php-json            x86_64    7.4.29-1.el9.remi          remi-modular     38 k

You can update your system and install packages at any time by running the following command,

dnf install php

Check Installed PHP Version

Now that we have installed PHP 7.4 via the remi repository, we can verify the version installed by running the php -v command,

php -v

Output:

[root@server ~]# php -v
PHP 7.4.29 (cli) (built: Apr 12 2022 10:55:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

Installing Required PHP Modules

For OwnCloud to work seamlessly some additional PHP modules are required, let's install them with the following command,

dnf install php-curl php-gd php-intl php-json php-ldap php-mbstring php-mysqlnd php-xml php-zip php-opcache

Create a Database for ownCloud

Command to login MariaDB database.

mysql -u root -p

Create a database for ownCloud.

CREATE DATABASE owncloud_db;

Create a User and grant permissions on the nextcloud-db database,

Note: Replace Enter-A-Password-Here with a strong and secure password.

GRANT ALL ON owncloud_db.* TO 'owncloud_user'@'localhost' IDENTIFIED BY 'Enter-A-Password-Here';

After creating a user and database for ownCloud Flush Privileges and exit the MariaDB database.

FLUSH PRIVILEGES;

EXIT;

Installing ownCloud

Enter the following command to Download the ownCloud.

dnf install wget
wget https://download.owncloud.com/server/stable/owncloud-complete-latest.tar.bz2

Extract into the /var/www/ directory with the following command,

dnf install tar
dnf install bzip2
tar -jxf owncloud-complete-latest.tar.bz2 -C /var/www/

To enable permission for Apache webserver to access the ownCloud files.

chown -R apache: /var/www/owncloud

Create a configuration file for ownCloud for Apache webserver to serve ownCloud.

dnf install nano
nano /etc/httpd/conf.d/owncloud.conf

Add the following lines to the configuration file and save and exit.

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>

Restart the apache webserver to reflect the changes,

systemctl restart httpd

Command to check the status for Webserver

systemctl status httpd

Output:

[root@server ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: d>
    Drop-In: /usr/lib/systemd/system/httpd.service.d
             └─php-fpm.conf
     Active: active (running) since Fri 2022-06-03 16:28:54 CEST; 4s ago
       Docs: man:httpd.service(8)
   Main PID: 6450 (httpd)
     Status: "Started, listening on: port 80"
      Tasks: 213 (limit: 5912)
     Memory: 37.8M
        CPU: 153ms
     CGroup: /system.slice/httpd.service
             ├─6450 /usr/sbin/httpd -DFOREGROUND
             ├─6451 /usr/sbin/httpd -DFOREGROUND
             ├─6452 /usr/sbin/httpd -DFOREGROUND
             ├─6453 /usr/sbin/httpd -DFOREGROUND
             └─6454 /usr/sbin/httpd -DFOREGROUND

Command to check if SELinux is enabled and running

sestatus

Output:


[root@server ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      33

If SELinux is enabled, execute the following command to allow the Apache webserver to write to Owncloud’s directory.

setsebool -P httpd_unified 1

ownCloud is successfully installed, open the ownCloud on the browser and complete the final steps.

URL to open the ownCloud on the web browser.

http://server-ip/owncloud

In browser,

  • Enter Username and Password to create account.
  • Next click on Storage and Database and select MySQL/MariaDB
  • Fill in all the database details i.e database user, password, and database name.
  • And click the Finish Setup button to complete the setup.

Output:

Once the Setup is completed successfully, Login Page will appear, and enter the Username and Password that you specified earlier to get access.

Output:

After login, you will be presented with options for installing the ownCloud app on different platforms and this is what the dashboard looks like

This Concludes how you install ownCloud on AlmaLinux 9.

If you can not configure and face any technical difficulties, kindly reach out to us via Support Ticket.