How to install ownCloud server on Debian 7


ownCloud is an online file storage solution that facilitates the synchronization of your files between your computers and mobile devices.

ownCloud is similar with Dropbox, the differences are that ownCloud allows you full control of the web application by hosting and maintaining it yourself.

By installing ownCloud you will have your own file drive in the cloud which will provide storing and synchronization of files, managing your own calendar, image library and many more functionalities.

At the end of this guide you will have an ownCloud server and at least a client connected securely to the server. This setup will be ready for storing and synchronizing your files between the server and the client.


– a Debian 7 VPS
– root access to the system

Step 1 – Installing the owncloud package

In this section we will add the ownCloud repository to your apt setup and install the `owncloud` server package from that repository.

If you are not already logged in as root user now it is time to log in as root in order to perform the installation process.

Using the following command will log you in as, root user:


Change to the home directory of the root user:


Now download the release key associated with ownCloud software:


Then add the key to apt so it can validate the downloaded files:

apt-key add - > Release.key

After we added the release key we remove it from our home directory.

rm Release.key

Now we add the ownCloud repository to our sources.list.d configuration files.

echo 'deb /' >> /etc/apt/sources.list.d/owncloud.list

At this point a refresh of the apt sources is needed. So we will refresh the repositories using the following command:

apt-get update

Now we are ready to install `owncloud` by typing:

apt-get install owncloud

This command will trigger the installation of `owncloud` and its requirements. If you are on a fresh VPS among the packages installed are the Apache2 web server and the MySQL database server.
So ahead and accept the installation of those packages by typing “Y” and hit Enter.

Step 2 – Setting up the database

This section will describe the process of setting up the database from installation to a ready-to-use state.

During the installation of owncloud package we will be prompted for a MySQL root user password. Type in a new password for the mysql root user and hit Enter then repeat the password and hit Enter again.

After the installation is done we need to create a database for ownCloud.

We will first create an user named “owncloud” that will be used to connect to the Owncloud database. It is recommended to avoid using the root user for connecting to the database.

So first we log in to the mysql console:

mysql -p

Now we type the MySQL root password which we’ve set up earlier.

At this point we will create the database:


Next we will create the “owncloud” database user and give the user all rights for the “owncloud” database.

GRANT ALL ON owncloud.* TO owncloud@localhost IDENTIFIED BY 'yourpassword';

Next we exit the mysql prompt


Step 3 – Setting up ownCloud

Now, if we open a browser and navigate to our IP address or domain name followed by “/owncloud” in your browser, we will see a page that looks like this:

Fill in the credentials for our ownCloud admin user then choose “Storage & database”, leave the “Data folder” at it’s default value. From the “Configure the database” section choose “MySQL/MariaDB” and fill in with MySQL credentials.

Database user: owncloud
Database password: yourpassword
Database name: owncloud
Database host: localhost

Then click “Finish setup”

Securing the connection to ownCloud

We are going to create and sign an SSL certificate for the Apache2 server so we can use ownCloud securely.

First we are going to enable SSL module in Apache2.

a2enmod ssl

Debian already comes with a self signed SSL certificate so we do not need to create a new one.
We just need to enable de default configuration with the following command:

a2ensite default-ssl

then restart the apache2 server so that the changes will take effect

service apache2 restart

One thought on “How to install ownCloud server on Debian 7”

Leave a Reply

Your email address will not be published. Required fields are marked *