keepcalculator

06 Numbers and Powers

Create Your OwnCloud Cloud Server: Step-by-Step

Card No. 06·64988 · Updated · Standard formula, shown below

This guide walks you through setting up your own OwnCloud server on a Linux VPS or dedicated machine, giving you full control over your files and data. You’ll end up with a private cloud where you can sync, share, and access files from any device, without relying on third-party services. We’ll cover installation, configuration, and initial setup using Ubuntu Server (the most common choice), but the steps are similar for other Debian-based distributions.

What You’ll Need

  • A server running Ubuntu 22.04 or 24.04 (or another Debian-based Linux). This can be a VPS from any provider, a home server, or even a Raspberry Pi (though performance will be limited).
  • Root or sudo access to the server.
  • A domain name pointing to your server’s IP address (optional but recommended for HTTPS). If you don’t have one, you can use the server’s IP address with a self-signed certificate.
  • A basic familiarity with the Linux command line (navigating directories, editing files with nano or vim).
  • An email address that can receive mail (for the admin account setup).

Step-by-Step

  1. Update your system. Log in to your server via SSH and run:
    sudo apt update && sudo apt upgrade -y
    This ensures all existing packages are up to date, preventing conflicts.
  2. Install required packages. OwnCloud needs a web server (Apache or Nginx), PHP, and a database (MySQL/MariaDB or SQLite). For a production setup, use MariaDB. Install them with:
    sudo apt install apache2 mariadb-server libapache2-mod-php php-gd php-mysql php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-imagick php-zip -y
  3. Configure MariaDB. Secure the database and create a database and user for OwnCloud. Run:
    sudo mysql_secure_installation
    Follow the prompts (set a root password, remove anonymous users, etc.). Then create the database:
    sudo mysql -u root -p
    In the MariaDB prompt, run:
    CREATE DATABASE owncloud;
    CREATE USER 'owncloud'@'localhost' IDENTIFIED BY 'your_strong_password';
    GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
  4. Download OwnCloud. Go to the official OwnCloud download page to get the latest tarball URL (or use the direct link for the latest stable version). Then download and extract it to the web root:
    cd /tmp
    wget https://download.owncloud.org/community/owncloud-latest.tar.bz2
    sudo tar -xjf owncloud-latest.tar.bz2 -C /var/www/
    This creates /var/www/owncloud.
  5. Set permissions. OwnCloud needs to write to its data directory (we’ll set that later) and the config directory. Give the web server user ownership:
    sudo chown -R www-data:www-data /var/www/owncloud
  6. Configure Apache. Create an Apache virtual host file. Use nano or vim to edit:
    sudo nano /etc/apache2/sites-available/owncloud.conf
    Paste the following (adjust ServerName to your domain or IP):
    <VirtualHost *:80>
        ServerName your-domain.com
        DocumentRoot /var/www/owncloud
        <Directory /var/www/owncloud>
            Options FollowSymlinks
            AllowOverride All
            Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/owncloud_error.log
        CustomLog ${APACHE_LOG_DIR}/owncloud_access.log combined
    </VirtualHost>

    Enable the site and required modules:
    sudo a2ensite owncloud
    sudo a2enmod rewrite headers env dir mime
    Then restart Apache:
    sudo systemctl restart apache2

  7. Complete the web installer. Open your browser and go to http://your-server-ip/owncloud (or your domain). You’ll see the OwnCloud setup page. Enter an admin username and password. For “Storage & Database”, choose “MySQL/MariaDB” and enter the database name, user, and password you created. Leave the database host as “localhost”. Click “Finish setup”.
  8. Set up HTTPS (recommended). Use Let’s Encrypt to get a free SSL certificate. Install Certbot:
    sudo apt install certbot python3-certbot-apache -y
    Then run:
    sudo certbot --apache
    Follow the prompts to obtain and install the certificate. This will automatically redirect HTTP to HTTPS.
  9. Configure trusted domains. After installation, you may need to add your domain/IP to the config file. Edit /var/www/owncloud/config/config.php and add your server’s address to the trusted_domains array:
    sudo nano /var/www/owncloud/config/config.php
    Find the line with 'trusted_domains' and add your domain or IP as a new array element, e.g.:
    'trusted_domains' => array (
        0 => 'localhost',
        1 => 'your-domain.com',
    ),
  10. Set up cron jobs (optional but recommended). OwnCloud background jobs should run via cron instead of AJAX for better performance. Add a cron job to run every 5 minutes:
    sudo crontab -u www-data -e
    Add this line:
    */5 * * * * php -f /var/www/owncloud/cron.php
    Then in OwnCloud admin settings, set “Background jobs” to “Cron”.

Common Mistakes

  • Forgetting to set permissions on the owncloud directory causes blank pages or “forbidden” errors. Always run chown -R www-data:www-data.
  • Using the wrong PHP extensions – missing php-intl or php-imagick can cause warnings or failure during installation. Double-check the install command.
  • Not configuring trusted domains – you’ll get an “Access through untrusted domain” error. Always add your domain/IP to config.php.
  • Ignoring the data directory location – by default, OwnCloud stores data in /var/www/owncloud/data, which is web-accessible. For security, move it outside the web root (e.g., /var/owncloud-data) and update the datadirectory in config.php.

Tips

  • Use a dedicated data directory – as mentioned, keep it outside the web root to prevent accidental exposure.
  • Enable caching – install Redis or APCu for better performance. For APCu: sudo apt install php-apcu and add 'memcache.local' => '\OC\Memcache\APCu' to config.php.
  • Set up backups – regularly back up the config folder and the data directory. Use rsync or a cron job to copy to an external drive.
  • Use a strong admin password and enable two-factor authentication for admin users if you plan to expose the server to the internet.

Troubleshooting

  • Blank page after installation – check Apache error logs (/var/log/apache2/error.log) for PHP errors. Often it’s missing PHP modules. Re-run the install command.
  • “Access through untrusted domain” – edit config.php and add the domain/IP to trusted_domains as shown in Step 9.
  • Cannot connect to database – verify that MariaDB is running (sudo systemctl status mariadb) and that the database user has the correct privileges. Try connecting manually: mysql -u owncloud -p.
  • Files not syncing – check that cron is running (sudo -u www-data php /var/www/owncloud/cron.php) and that the background jobs setting is set to Cron.

Frequently Asked Questions

Can I use SQLite instead of MariaDB?

Yes, for small personal use, SQLite works. However, MariaDB is recommended for production because it handles concurrent connections better and is more scalable.

How do I update OwnCloud?

Backup your config and data, then replace the owncloud directory with the new version. Run sudo -u www-data php /var/www/owncloud/occ upgrade from the command line, then clear the browser cache.

Can I access my files via WebDAV?

Yes, OwnCloud supports WebDAV. You can mount it as a network drive using https://your-domain.com/owncloud/remote.php/webdav.

Is OwnCloud free?

Yes, the Community Edition is free and open-source. There are also commercial enterprise editions with extra support and features.

How do I move the data directory?

Stop the web server, move the data folder to a new location, then edit config.php to change 'datadirectory' to the new path. Set proper permissions (chown -R www-data:www-data) and restart Apache.

What are the minimum server requirements?

For a small instance, 1 GB RAM and 1 CPU core is enough. For larger setups, more RAM is beneficial, especially if you enable preview generation or multiple users.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →