Installing ownCloud 9 on Debian 8

The process of installing ownCloud on Debian 8 is similar with installing it on Debian 7.
So I will explain it straight forward.

First we log in as root executing the su command.
Then visit the ownCloud repository page, and get the updated repository links.
So first we will install the owncloud debian repository key.

wget -nv https://download.owncloud.org/download/repositories/stable/Debian_8.0/Release.key -O Release.key
apt-key add - < Release.key

Then we create a new apt repository file in the sources.list.d directory.

echo 'deb http://download.owncloud.org/download/repositories/stable/Debian_8.0/ /' >> /etc/apt/sources.list.d/owncloud.list

And we update the apt sources.

apt-get update

Now we are ready to install ownCloud.
There are two packages we could install: owncloud and owncloud-files. The difference is that if we install owncloud, then it will automatically install apache2, mysql and php5. We are going to install owncloud-files and setup a MariaDB server with Apache2 and PHP.
OwnCloud files will be stored in /var/www/owncloud directoy.

apt-get install owncloud-files

If you do not have a GLAMP stack yet you can set up MariaDB, PHP5 and Apache2 by following this guide.
In order to have each site under a folder with the domain name as its name I renamed the owncloud folder and created a symlink from the owncloud to my folder.

mv /var/www/owncloud/ /var/www/example.com
ln -s /var/www/example.com /var/www/owncloud

Now we need to setup a virtual host that will use the example.com folder.

nano /etc/apache2/sites-available/example.com.conf
<VirtualHost *:80>
  ServerAdmin email@example.com
  ServerName example.com
  DocumentRoot /var/www/example.com
  DirectoryIndex index.php
</VirtualHost>

Then we enable our site:

a2ensite example.com
service apache2 reload

Now feel free to test your site by pointing your browser to its domain name.
You will notice that there are a few dependencies missing. So we need to install them:

apt-get install php5-curl php5-gd
service apache2 reload

Then we visit the site again and we fill in the required details.
We also need to create a database for owncloud.
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:

CREATE DATABASE owncloud;

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';
FLUSH PRIVILEGES;

Next we exit the mysql prompt

exit

After you finish the installation wizard you will have an instance of owncloud up and running.

Installing a GLAMP stack on Debian 8 Jessie

In this post I will explain how to install a GLAMP stack (GNU/Linux + Apache + MariaDB + PHP) on Debian 8 Jessie.
We begin by logging in as root with the su command
Then type in your root password and then run the following command which will install an Apache server with php5 support, a MariaDB server and a client.

apt-get install apache2 mariadb-server mariadb-client php5 libapache2-mod-php5 php5-mysql

When prompted for the MariaDB Root password type the wished password.

Now it’s time to finish the MariaDB installation by running:

mysql_secure_installation

Then login with your MariaDB root password and follow the on-screen installer.
This is a list of Q&A prompted by the installer

Change the root password? [Y/n] n
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Lets configure the Apache2 server.
First we need to disable the default apache website.

a2dissite 000-default
service apache2 reload

Now let’s configure a virtual host for Apache2. So we create a new configuration file in the sites-available folder with the name of our domain name.

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

The contents of the file are as follows:

<VirtualHost *:80>
  ServerAdmin email@example.com
  ServerName example.com
  DocumentRoot /var/www/example.com
  DirectoryIndex index.php
</VirtualHost>

Now we have to create the folder /var/www/example.com and put an index.php file inside.

mkdir /var/www/example.com
touch /var/www/example.com/index.php

You can of course put some content in the index.php to see it in action.
Now we enable our site:

a2ensite example.com
service apache2 reload

This was the installation of a GLAMP stack. From now on you have to configure your website the way you want it to.