How to Install ownCloud on Debian 9

how to install owncloud on debian 9

owncloud installation on debian 9In this tutorial, we will show you how to install ownCloud on Debian 9. ownCloud is an open-source, self-hosted platform which provides sync and share capabilities across multiple devices. It allows users to easily manage their files, contacts, calendars, to-do lists, and more, making it a great alternative to the popular Google Drive, Dropbox, iCloud, etc. cloud platforms.

Requirements:

    • root access via SSH to your VPS;
    • MySQL or MariaDB 5.5+ or PostgreSQL;
    • PHP version 5.6 or above;
    • Apache 2.4 with prefork Multi-Processing Module (MPM) and mod_php;

1. Connect to your server

To connect to your server via SSH as user root, use the following command:

ssh root@IP_ADDRESS -p PORT_NUMBER

and replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number.

Once logged in, make sure that your server is up-to-date by running the following commands:

apt-get update
apt-get upgrade

2. Install Apache web server

Check whether Apache is already installed and running on your server. The following command will help you in that matter:

dpkg -l apache2

In case you already have an Apache web server on your system then you can skip these steps.

apt install apache2

Once installed, start the Apache server and enable it to start at server boot.

systemctl start apache2
systemctl enable apache2

3. Install PHP

Install PHP together with some PHP modules that are required by ownCloud with the following command:

sudo apt install php7.0 php7.0-common libapache2-mod-php7.0 \
    openssl php-imagick php7.0-curl php7.0-gd php7.0-mcrypt \
    php7.0-imap php7.0-intl php7.0-json php7.0-ldap php7.0-mbstring \
    php7.0-mysql php7.0-pgsql php-smbclient php-ssh2 \
    php7.0-sqlite3 php7.0-xml php7.0-zip php-redis php-apcu

4. Install MariaDB and create a database

In this tutorial, we will use MariaDB as a database engine. We can Install MariaDB server from Debian base repository using the following command:

sudo apt update
sudo apt -y install mariadb-server

When the installation is complete, run the following commands to start and enable the MariaDB service :

sudo systemctl start mariadb
sudo systemctl enable mariadb

To secure your installation and to set up the root password execute the following command on your server.

sudo mysql_secure_installation

If you did not set any password during the installation, you can just leave it blank and press Enter.

Next step is to log in to the MariaDB server as ‘root’ user and creates a database and user for ownCloud.

mysql -u root -p
MariaDB [(none)]> CREATE DATABASE owncloud CHARACTER SET utf8;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'localhost' IDENTIFIED BY 'Password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit

It is recommended to replace ‘Password’ with a strong password which will be a combination of letters and numbers and at least 10 characters long.

5. Install ownCloud

The ownCLoud 10 package is not available in default Debian 9 repositories so we will install the package from the official ownCloud repositories. First, add the ownCloud GPG key to the apt sources keyring:

wget -qO- https://download.owncloud.org/download/repositories/stable/Debian_9.0/Release.key | sudo apt-key add -

once the key is added run the following command to enable the ownCloud repository:

echo 'deb https://download.owncloud.org/download/repositories/stable/Debian_9.0/ /' | sudo tee /etc/apt/sources.list.d/owncloud.list

Before installing the ownCloud package we need to enable HTTPS transport for the Debian apt tool by installing the following package:

sudo apt install apt-transport-https

Update the apt cache list and install the ownCloud package with the following command:

sudo apt update 
sudo apt install owncloud-files

The command above will install the ownCloud files in the /var/www/owncloud directory.

6. Create Apache Virtual Host

To access the ownCloud with a domain name you need to create a virtual host. Open a new configuration file using nano or your favorite text editor with the following command:

nano /etc/apache2/sites-available/your_domain.com.conf

Don’t forget to modify the your_domain.com and add the following lines:

Alias /owncloud "/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>
ErrorLog /var/log/apache2/owncloud-error_log
CustomLog /var/log/apache2/owncloud-access_log common

Save the file.

Enable the Apache ownCloud configuration:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
sudo a2ensite your_domain.com.conf

Remember to replace your ‘your_domain.com’ with your actual domain name. Save the changes and restart the Apache web server for the changes to take effect:

systemctl reload apache2

6. Finish the ownCloud installation

In the last step of this guide, we need to access to ownCloud Web Interface and finish the installation.

To finish the installation open your browser and navigate to

http://your_server_ip_address/owncloud/

installing owncloud on debian 9

After completing setup you will get admin dashboard.

install owncloud on debian 9

That’s it. If you followed all of the instructions properly now you should be able to access your ownCloud with your domain name on your Debian 9 server.

You don’t need to Install ownCloud on Debian 9 if you use one of our ownCloud Hosting services, in which case you can simply ask our expert Linux admins to set up ownCloud on your Debian 9 server for you. They are available 24×7 and will take care of your request immediately. You can also refer to this guide How to Install ownCloud on Debian 10 for updates.

PS. If you liked this post, on How To Install ownCloud 14 on Debian 9, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment