How to Install and Configure ownCloud on Debian 11

ownCloud is an open source project that can be installed on your server to securely store and access files.

Prerequisites

Debian 11 installed and root access to the server.

ownCloud requires either a LAMP Stack (Apache) or LEMP Stack (Nginx) installed and running.

In this case, We are going with LAMP (Apache, MariaDB and PHP) Stack.

Update the system

Update the Debian system and all it's packages with below command,

apt update
apt upgrade

Install and Setup LAMP Stack

To begin with, run the commands below to install Apache and MariaDB.

apt install apache2 mariadb-server -y

Install PHP and other Required Modules.

Run the below command to install PHP and it's modules

apt install php libapache2-mod-php php-{mysql,intl,curl,json,gd,xml,mbstring,zip} -y

Install ownCloud Server on Debian 11

Install ownCloud repository

Owncloud is not included by default on Debian 11 repositories. ownCloud maintains it's own repository for different kinds of Linux distributions.

There are different packages available for various Debian releases.

Click the following link to install ownCloud repositories for Debian 11 server from opensuse.org.

apt install curl gnupg2 -y

echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/server:/10/Debian_11/ /' > /etc/apt/sources.list.d/isv:ownCloud:server:10.list

curl -fsSL https://download.opensuse.org/repositories/isv:ownCloud:server:10/Debian_11/Release.key | gpg --dearmor >/etc/apt/trusted.gpg.d/isv_ownCloud_server_10.gpg

Once the GPG key is added, proceed with the below command.

echo 'deb http://download.owncloud.org/download/repositories/10.4.1/prod/Debian_10/ /' > /etc/apt/sources.list.d/owncloud.list

Run a system update once again,

apt update

Once the update is done, install owncloud.

apt install owncloud-complete-files -y

Configure Apache for ownCloud

Once the ownCloud is installed, the contents are placed in /var/www/owncloud directory.

You will have to create an ownCloud apache configuration for the Apache web server to serve the contents,

Copy and paste the command below to create owncloud.conf configuration file.

cat > /etc/apache2/sites-available/owncloud.conf << 'EOL'
Alias / "/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>
EOLcat > /etc/apache2/sites-available/owncloud.conf << 'EOL'
Alias / "/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>
EOL

Enable ownCloud site via apache.

ln -s /etc/apache2/sites-available/owncloud.conf /etc/apache2/sites-enabled/

Disable default Apache site;

a2dissite 000-default.conf

Enable additional recommended Apache modules.

a2enmod rewrite mime unique_id

Verify Apache configuration syntax.

apachectl -t

Restart Apache if the configuration is fine.

systemctl restart apache2

Create ownCloud Database and User

Run the mysql_secure_installation script to set root password, disable remote root login, remove test databases.

mysql_secure_installation

Login to MariaDB database server and create ownCloud database and database user.

mysql

If you already enabled password authentication, then login via;

mysql -u root -p

Next, execute the commands below to create ownCloud database and it's user.

CREATE DATABASE ownclouddb;

GRANT ALL ON ownclouddb.* TO ocadmin@localhost IDENTIFIED BY "StrongP@ss";

FLUSH PRIVILEGES;

QUIT

Finalize ownCloud Configuration

Open your browser and navigate to http://<server-IP>.

This will load the ownCloud Panel and prompts you to configure some of the things like below,

  • Creating Admin user account with password, Configure the DataBase with the information that was used earlier during the setup.

image

  • Click on the Finish Setup button to complete the configuration.

Next, login with the Admin user created moments ago and you will enter the ownCloud Dashboard.

When configuration completes, you will get to a login page.

Enter your admin user login details to login to ownCloud dashboard.

image

image

This concludes our guide on installing ownCloud on Debian 11 system.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS