Site icon DesignLinux

How to Install OwnCloud in Debian 10

Owncloud is a market-leading online file sharing system that lets you back up and shares your files with ease. If you are not a fan of DropBox or Google Drive, then OwnCloud is a cool alternative.

In this article, we walk you through the installation of OwnCloud in Debian 10.

Step 1: Install LAMP Stack on Debian

Since OwnCloud runs on the browser and the back-end too by storing data on the database, we need to first install the LAMP stack. LAMP is a popular free and open-source hosting stack used by developers for hosting their web applications. It stands for Linux, Apache, MariaDB / MySQL, and PHP.

First, let’s update system repositories.

$ sudo apt update && sudo apt upgrade
Update Debian System Packages

Update Debian System Packages

Next, install the Apache web server and MariaDB database server by running the command.

$ sudo apt install apache2 mariadb-server mariadb-client

Install Apache and MariaDB

After the installation is complete, proceed and install PHP 7.2. At the time of penning down this guide, PHP 7.3 is not yet supported, so our best shot is using PHP 7.2.

So, enable the PHP repository as shown.

$ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg  https://packages.sury.org/php/apt.gpg
$ sudo echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list

Once you are done creating the repository for PHP, update your system packages & repositories for the new PHP repository to take effect.

$ sudo apt update

Now install PHP and the required dependencies as shown.

$ sudo apt install php7.2 libapache2-mod-php7.2 php7.2-{mysql,intl,curl,json,gd,xml,mb,zip}

Install PHP in Debian

Once installed, check the PHP version using the command.

$ php -v

Also, verify that the Apache webserver is running by running the command.

$ systemctl status apache2

If Apache is up and running, you should get output similar to the one shown below, indicating that it is ‘active’.

Check Apache Status in Debian

If Apache is not started, start and enable it on boot by running the commands.

$ systemctl start apache2
$ systemctl enable apache2

Step 2: Create a Database for OwnCloud Files

The next step will be to create a database to handle OwnCloud’s files during and after the installation.

Login to the MariaDB server.

$ mysql -u root -p

Once logged in, create a database for OwnCloud.

MariaDB [(none)]> CREATE DATABASE owncloud;

Create a user for the OwnCloud database and grant all privileges to the user.

MariaDB [(none)]> GRANT ALL ON owncloud.* TO 'owncloud_user'@'localhost' IDENTIFIED BY '[email protected]';

Finally, flush privileges and exit.

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Create OwnCloud Database

Step 3: Install OwnCloud in Debian

By default, OwnCloud is not included in Debian 10 repositories. Nevertheless, OwnCloud maintains a repository for each distribution. The repository for Debian 10 has not yet been released, and therefore, we will use the repository of Debian 9.

First, install the PGP signing key.

$ sudo curl https://download.owncloud.org/download/repositories/10.2.1/Debian_9.0/Release.key | apt-key add -

Once the signing key is installed, go ahead and enable OwnCloud’s repository.

$ sudo echo 'deb http://download.owncloud.org/download/repositories/10.2.1/Debian_9.0/ /' > /etc/apt/sources.list.d/owncloud.list

Once again update your system to resynchronize the system packages and install Owncloud.

$ sudo apt update
$ sudo apt-get install owncloud-files

Step 4: Configure Apache for OwnCloud

Upon installation, OwnCloud stores its files in the /var/www/owncloud directory. We, therefore, need to configure our web server to serve OwnCloud’s files.

So, create a virtual host file for Owncloud as shown.

$ sudo vim /etc/apache2/sites-available/owncloud.conf

Add the configuration below and save.

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>

To enable the OwnCloud site, just as you would any virtual host run the command:

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

Next, enable additional Apache modules that are required by OwnCloud and restart the Apache webserver to reload the configuration and effect the changes.

$ sudo a2enmod rewrite mime unique_id
$ sudo systemctl restart apache2

Step 5: Finalizing OwnCloud Installation

To complete OwnCloud setup, browse your server’sIP address as shown below:

http://server-ip

The welcome interface will greet you as shown. You will be required to provide the username and password.

Create Owncloud Admin Account

Next, click on the ‘Storage and database’ and provide the database details such as database user, database name and password.

Add OwnCloud Database Settings

Finally, click on ‘Finish Setup’.

Finish OwnCloud Setup

This takes you to the login page. Enter your username and password and hit ENTER.

Owncloud Admin Login

Initially, you will get a pop-up with information about OwnCloud’s Desktop, Android and iOS app that you can install on your devices. This allows you to access your data on the go.

OwnCloud Device Apps

Here’s the dashboard.

OwnCloud Dashboard Window

And we have finally come to the end of this tutorial. You can now save and share your files with ease using OwnCloud. Thanks for taking the time.

Sharing is Caring…
Share on FacebookShare on TwitterShare on LinkedinShare on Reddit
Exit mobile version