dotlinux blog

How to Install OwnCloud on Rocky Linux and AlmaLinux

OwnCloud is a self-hosted, open-source cloud storage solution that lets you store, sync, and share files securely—without relying on third-party services like Google Drive or Dropbox. It’s ideal for individuals, businesses, or organizations that value data privacy and control over their infrastructure.

Rocky Linux and AlmaLinux are popular enterprise-grade Linux distributions, both binary-compatible with Red Hat Enterprise Linux (RHEL). They’re stable, secure, and perfect for hosting services like OwnCloud.

In this detailed guide, we’ll walk you through every step of installing OwnCloud on Rocky Linux or AlmaLinux—from setting up the required software stack (LAMP) to securing your instance with HTTPS. By the end, you’ll have a fully functional, production-ready OwnCloud server.

2026-03

Table of Contents#

  1. Prerequisites
  2. Step 1: Update System Packages
  3. Step 2: Install the LAMP Stack
  4. Step 3: Configure MariaDB for OwnCloud
  5. Step 4: Download and Install OwnCloud
  6. Step 5: Configure Apache for OwnCloud
  7. Step 6: Complete Installation via Web Wizard
  8. Step 7: Post-Installation Configuration
  9. Troubleshooting Common Issues
  10. Conclusion
  11. References

Prerequisites#

Before you start, ensure you have:

  • A server running Rocky Linux 8/9 or AlmaLinux 8/9 (we’ll use Rocky Linux 9 in examples).
  • At least 2 GB of RAM (4 GB recommended for better performance).
  • 20 GB of disk space (more if you plan to store large files).
  • Root or sudo privileges.
  • A registered domain name (optional but recommended for HTTPS).
  • A stable internet connection.

Step 1: Update System Packages#

Always start by updating your system to ensure you have the latest security patches and dependencies:

sudo dnf update -y

This command will:

  • Refresh your package repositories.
  • Upgrade all installed packages to their latest versions.

Step 2: Install the LAMP Stack#

OwnCloud requires a LAMP stack (Linux, Apache, MariaDB, PHP) to run. We’ll install each component one by one.

2.1 Install Apache Web Server#

Apache is the most widely used web server for hosting PHP applications like OwnCloud.

  1. Install Apache:

    sudo dnf install httpd -y
  2. Enable and start the Apache service:

    sudo systemctl enable --now httpd
  3. Allow HTTP (port 80) and HTTPS (port 443) through the firewall:

    sudo firewall-cmd --add-service=http --permanent
    sudo firewall-cmd --add-service=https --permanent
    sudo firewall-cmd --reload

Verify Apache is running by visiting your server’s IP address in a browser (e.g., http://your-server-ip). You should see the default Apache test page.

2.2 Install MariaDB Database Server#

MariaDB is a drop-in replacement for MySQL and is required to store OwnCloud’s data (users, files, settings).

  1. Install MariaDB:

    sudo dnf install mariadb-server -y
  2. Enable and start MariaDB:

    sudo systemctl enable --now mariadb
  3. Secure MariaDB (critical for production):
    Run the mysql_secure_installation script to:

    • Set a root password.
    • Remove anonymous users.
    • Disallow remote root login.
    • Remove the test database.
    sudo mysql_secure_installation

    Follow the prompts:

    • Enter current password for root (leave blank if new: press Enter).
    • Set a strong root password (e.g., MyS3cr3tP@ssw0rd).
    • Answer Y to all remaining questions.

2.3 Install PHP and Required Extensions#

OwnCloud requires PHP 8.1 or higher (as of 2024). Rocky Linux 9/AlmaLinux 9’s default AppStream repository includes PHP 8.0, so we’ll use the Remi repository to install PHP 8.1.

  1. Install the Remi repository:

    sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
  2. Reset the PHP module and enable PHP 8.1:

    sudo dnf module reset php -y
    sudo dnf module enable php:remi-8.1 -y
  3. Install PHP and required extensions:
    OwnCloud needs specific PHP extensions to handle files, databases, and media. Install them with:

    sudo dnf install php php-gd php-json php-mbstring php-curl php-intl php-mysqlnd php-imagick php-xml php-zip php-opcache php-redis -y

    Here’s what each extension does:

    • php-gd: Image manipulation.
    • php-mysqlnd: MySQL/MariaDB support.
    • php-imagick: Advanced image processing.
    • php-redis: Redis caching (optional but recommended).
  4. Adjust PHP settings for OwnCloud:
    Edit the php.ini file (location: /etc/php.ini) to optimize performance:

    sudo nano /etc/php.ini

    Change the following values (use Ctrl+W to search):

    • memory_limit = 512M (increase from 128M for larger files).
    • upload_max_filesize = 10G (allow large file uploads).
    • post_max_size = 10G (match upload_max_filesize).
    • max_execution_time = 300 (increase from 30 for long-running tasks).

    Save and exit (Ctrl+O, Enter, Ctrl+X).

  5. Restart Apache to apply PHP changes:

    sudo systemctl restart httpd

Step 3: Configure MariaDB for OwnCloud#

Next, create a dedicated database and user for OwnCloud (never use the root user for applications).

  1. Log in to MariaDB as root:

    mysql -u root -p

    Enter the root password you set earlier.

  2. Create a database (e.g., owncloud_db):

    CREATE DATABASE owncloud_db CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
    • utf8mb4 ensures support for emojis and non-Latin characters.
  3. Create a database user (e.g., owncloud_user) with a strong password:

    CREATE USER 'owncloud_user'@'localhost' IDENTIFIED BY 'YourStrongPassword123!';
  4. Grant full privileges on the database to the user:

    GRANT ALL PRIVILEGES ON owncloud_db.* TO 'owncloud_user'@'localhost';
  5. Flush privileges and exit:

    FLUSH PRIVILEGES;
    EXIT;

Step 4: Download and Install OwnCloud#

  1. Navigate to the web root directory (/var/www/html):

    cd /var/www/html
  2. Download the latest stable OwnCloud release:

    sudo wget https://download.owncloud.com/server/stable/owncloud-latest.tar.bz2
  3. Verify the download (optional but secure):
    OwnCloud provides SHA256 checksums to ensure the file isn’t corrupted. Download the checksum file and verify:

    sudo wget https://download.owncloud.com/server/stable/owncloud-latest.tar.bz2.sha256
    sudo sha256sum -c owncloud-latest.tar.bz2.sha256

    You should see:

    owncloud-latest.tar.bz2: OK
    
  4. Extract the tarball:

    sudo tar -xjf owncloud-latest.tar.bz2
  5. Set proper file permissions:
    OwnCloud requires the Apache user (apache) to read/write to critical directories (e.g., data, config).

    sudo chown -R apache:apache /var/www/html/owncloud
    sudo chmod -R 750 /var/www/html/owncloud
    sudo chmod -R 770 /var/www/html/owncloud/data
    • 750: Directories are readable/writable by the owner (apache) and group (apache), but not by others.
    • 770: The data directory needs write access for file uploads.

Step 5: Configure Apache for OwnCloud#

Apache needs a virtual host to serve OwnCloud. A virtual host tells Apache how to handle requests for your domain (or IP).

  1. Create a virtual host file:

    sudo nano /etc/httpd/conf.d/owncloud.conf
  2. Paste the following configuration (replace your-domain.com with your actual domain or IP):

    <VirtualHost *:80>
        ServerName your-domain.com
        ServerAlias www.your-domain.com
        DocumentRoot /var/www/html/owncloud
        ErrorLog /var/log/httpd/owncloud_error.log
        CustomLog /var/log/httpd/owncloud_access.log combined
     
        <Directory /var/www/html/owncloud>
            AllowOverride All
            Require all granted
            Options FollowSymLinks MultiViews
            <IfModule mod_dav.c>
                Dav off
            </IfModule>
        </Directory>
    </VirtualHost>

    Key settings:

    • ServerName: Your domain name (e.g., cloud.your-domain.com).
    • DocumentRoot: Path to the OwnCloud installation.
    • AllowOverride All: Enables .htaccess files (required for OwnCloud’s URL rewriting).
  3. Test the Apache configuration:

    sudo apachectl configtest

    You should see Syntax OK. If not, fix any syntax errors in the virtual host file.

  4. Restart Apache to apply changes:

    sudo systemctl restart httpd

Step 6: Complete Installation via Web Wizard#

Now access the OwnCloud web interface to finalize the setup.

  1. Open a browser and go to:

    • If using a domain: http://your-domain.com
    • If using an IP: http://your-server-ip
  2. Fill out the form:

    • Create an admin account: Enter a username (e.g., admin) and strong password.
    • Configure the database:
      • Select MySQL/MariaDB.
      • Database user: owncloud_user
      • Database password: The password you set for owncloud_user.
      • Database name: owncloud_db
      • Host: localhost

    Example:
    OwnCloud Web Installer

  3. Click Finish setup.

OwnCloud will now create tables in the database and set up the admin account. Once done, you’ll be redirected to the dashboard!

Step 7: Post-Installation Configuration#

These steps are critical for security, performance, and reliability.

7.1 Secure with HTTPS (Let’s Encrypt)#

HTTPS encrypts data between your browser and the server—never skip this for production. We’ll use Let’s Encrypt (free SSL certificates).

  1. Install the EPEL repository (required for Certbot):

    sudo dnf install epel-release -y
  2. Install Certbot and the Apache plugin:

    sudo dnf install certbot python3-certbot-apache -y
  3. Run Certbot to obtain a certificate:

    sudo certbot --apache

    Follow the prompts:

    • Enter your email (for renewal notifications).
    • Agree to the Let’s Encrypt terms of service.
    • Choose whether to share your email (optional).
    • Select your domain (e.g., your-domain.com).

Certbot will:

  • Automatically install the SSL certificate.
  • Update your Apache virtual host to redirect HTTP to HTTPS.
  • Schedule automatic certificate renewals (Let’s Encrypt certificates expire every 90 days).

Verify HTTPS works by visiting https://your-domain.com—you should see a padlock in the browser bar.

7.2 Set Up Cron Jobs for Background Tasks#

OwnCloud uses background jobs to handle tasks like:

  • File synchronization.
  • Email notifications.
  • Log rotation.

The default method (AJAX) is unreliable for production. Instead, use system cron (more efficient).

  1. Create a cron job for the Apache user:

    sudo crontab -u apache -e
  2. Add the following line (runs the cron job every 15 minutes):

    */15 * * * * php -f /var/www/html/owncloud/cron.php
  3. Save and exit (Ctrl+O, Enter, Ctrl+X).

  4. Enable cron in OwnCloud:

    • Log in to OwnCloud as admin.
    • Go to Settings > Basic Settings.
    • Under Background Jobs, select Cron.
    • Click Save.

Redis is an in-memory data store that speeds up OwnCloud by caching frequent requests (e.g., user sessions, file metadata).

  1. Install Redis:

    sudo dnf install redis -y
  2. Enable and start Redis:

    sudo systemctl enable --now redis
  3. Configure OwnCloud to use Redis:
    Edit the OwnCloud config file (/var/www/html/owncloud/config/config.php):

    sudo nano /var/www/html/owncloud/config/config.php

    Add these lines (replace with your Redis settings if using a remote server):

    'memcache.local' => '\OC\Memcache\Redis',
    'memcache.distributed' => '\OC\Memcache\Redis',
    'memcache.locking' => '\OC\Memcache\Redis',
    'redis' => [
        'host' => 'localhost',
        'port' => 6379,
    ],
  4. Restart Apache:

    sudo systemctl restart httpd

7.4 Adjust SELinux Policies (If Enabled)#

SELinux (Security-Enhanced Linux) is enabled by default on Rocky/AlmaLinux. It can block Apache from accessing OwnCloud’s files if not configured correctly.

  1. Check if SELinux is enabled:

    sestatus

    If you see SELinux status: enabled, proceed.

  2. Allow Apache to read/write OwnCloud directories:

    sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data(/.*)?'
    sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config(/.*)?'
    sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps(/.*)?'
    sudo restorecon -Rv /var/www/html/owncloud/
  3. Allow Apache to connect to MariaDB:

    sudo setsebool -P httpd_can_network_connect_db 1
  4. Allow Apache to use unified processes:

    sudo setsebool -P httpd_unified 1

Step 8: Test OwnCloud#

Log in to your OwnCloud dashboard (https://your-domain.com) and test basic functionality:

  • Upload a file (e.g., a photo or document).
  • Create a new user (Settings > Users).
  • Share a file with another user (right-click the file > Share).

If everything works, congratulations—you have a fully functional OwnCloud server!

Troubleshooting Common Issues#

Here are fixes for the most frequent problems:

1. “Permission Denied” Errors#

  • Cause: Incorrect file ownership/permissions.
  • Fix: Reapply permissions:
    sudo chown -R apache:apache /var/www/html/owncloud
    sudo chmod -R 750 /var/www/html/owncloud

2. PHP Extension Missing#

  • Cause: A required PHP extension isn’t installed.
  • Fix: Install the missing extension (e.g., php-imagick):
    sudo dnf install php-imagick -y
    sudo systemctl restart httpd

3. Database Connection Error#

  • Cause: Incorrect database credentials in the web installer.
  • Fix: Recheck the database name, user, and password in Step 3.

4. SELinux Blocking Access#

  • Cause: SELinux policies are too strict.

  • Fix: Temporarily disable SELinux to test (only for debugging):

    sudo setenforce 0

    If the issue resolves, re-enable SELinux and adjust policies (Step 7.4).

5. Apache Error Logs#

Always check Apache’s error log for clues:

sudo tail -f /var/log/httpd/owncloud_error.log

Conclusion#

You’ve successfully installed OwnCloud on Rocky Linux or AlmaLinux! You now have a private, self-hosted cloud storage solution with:

  • Secure HTTPS encryption.
  • Automatic background tasks (cron).
  • Redis caching for speed.
  • Regular security updates.

Next steps:

  • Explore OwnCloud apps (e.g., calendar, contacts, office integration).
  • Back up your OwnCloud data (Settings > Backup).
  • Configure two-factor authentication (Settings > Security) for extra security.

References#

Let me know if you have any questions—happy hosting! 🚀