Guides 11792 Published by

This guide walks you through a clean, credit‑card‑free method to deploy OwnCloud on fresh Ubuntu 21.10 or Debian 11 installations. It starts by updating the system, installing the LAMP stack with PHP 7.4 and MariaDB, and enabling Apache’s rewrite module so everything resolves correctly. Then it downloads the 10.x OwnCloud bundle, places it in the web root, secures file permissions for www‑data, creates a dedicated database user, and writes an Apache virtual host that allows overrides and follows symlinks. Finally, you finish the setup with the web wizard, optionally harden the server with HTTPS or external storage mounts, and your own‑hosted sync service is ready to accept files.



Install and configure OwnCloud on Ubuntu 21 or Debian 11

If you want a self‑hosted file sync solution that won’t ask for your credit card, OwnCloud is the way to go. Below you’ll find a straightforward recipe that works on fresh installs of Ubuntu 21.10 or Debian 11.

Step 1: Get the system ready
sudo apt update && sudo apt upgrade -y

Skipping this step? I’ve seen servers stumble halfway through the install because packages were out‑of‑date, and you end up with broken PHP modules. Updating first keeps the dependency tree clean.

Step 2: Install the LAMP stack
sudo apt install apache2 libapache2-mod-php7.4 php7.4 \
    php7.4-gd php7.4-json php7.4-mysql php7.4-curl \
    php7.4-xml php7.4-mbstring mariadb-server -y

Why each piece?

  • Apache is the web server OwnCloud expects.
  • The PHP 7.4 packages are the minimum required runtime; newer versions aren’t officially supported yet on Ubuntu 21/ Debian 11.
  • MariaDB gives you a lightweight, reliable database.

After installation enable Apache’s rewrite module and restart:

sudo a2enmod rewrite
sudo systemctl restart apache2
Step 3: Set up the database

Open the MySQL shell:

sudo mysql -u root

Create a user and database for OwnCloud:

CREATE DATABASE owncloud;
GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud_user'@'localhost' IDENTIFIED BY 'StrongPassword!23';
FLUSH PRIVILEGES;
EXIT;

If you’ve ever tried installing OwnCloud without a dedicated DB user, you’ll know the pain of permission errors later on.

Step 4: Download and extract OwnCloud
cd /tmp
wget https://download.owncloud.org/community/owncloud-10.8.1.tar.bz2
tar -xjf owncloud-10.8.1.tar.bz2
sudo mv owncloud /var/www/html/

The 10.x branch is the last one that plays nicely with PHP 7.4 on Debian 11. Using a newer version will run into deprecation warnings that slow the install.

Step 5: Give Apache the right permissions
sudo chown -R www-data:www-data /var/www/html/owncloud
sudo find /var/www/html/owncloud -type d -exec chmod 750 {} \;
sudo find /var/www/html/owncloud -type f -exec chmod 640 {} \;

I’ve seen people set everything to 777, thinking “why not?” and ended up with a security hole that let anyone tamper with your files. Stick to the defaults: owner is www‑data, group gets execute rights on dirs.

Step 6: Configure Apache for OwnCloud

Create a virtual host file:

sudo nano /etc/apache2/sites-available/owncloud.conf

Paste this:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/html/owncloud

    <Directory /var/www/html/owncloud/>
        Require all granted
        AllowOverride All
        Options FollowSymlinks MultiViews
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/owncloud_error.log
    CustomLog ${APACHE_LOG_DIR}/owncloud_access.log combined
</VirtualHost>

Enable the site and reload Apache:

sudo a2ensite owncloud.conf
sudo systemctl reload apache2

If you forget AllowOverride All, the built‑in web installer will refuse to run because it can’t write its configuration file.

Step 7: Finish the setup through the web wizard

Navigate to http://your‑server-ip (or your domain). You’ll see the OwnCloud installation screen. Fill in:

  • Data folder – leave the default /var/www/html/owncloud/data or point it somewhere larger.
  • Database user – owncloud_user
  • Password – whatever you set above
  • Database name – owncloud

Click Finish setup and OwnCloud will create its tables. Once done, log in with the admin account you just created.

Optional: Harden the installation
  • Enable HTTPS (use Let’s Encrypt or a self‑signed cert).
  • Turn on App “External Storage” if you want to mount NAS drives.
  • Regularly run sudo apt upgrade and review OwnCloud updates via its web UI.

That’s it—OwnCloud is up, running, and ready for you to drop files into. If you hit a snag, check the Apache error log or OwnCloud logs in /var/www/html/owncloud/data.