How to install Owncloud 6 on Ubuntu 14.04 LTS Server

In this tutorial we will learn about, how to install Owncloud 6 on Ubuntu 14.04 LTS Server. Owncloud now a days very popular in Internet World. It is one the awesome alternate for Drop Box. Moreover it is free and Open Source software, primarily using for ‘file hosting’.

In case you are looking for creating your Own file hosting Server, Owncloud is more suitable for you. It is free and Open source, has many great features.

You can find many apps developed by Owncloud team and many volunteers in owncloud apps repository. You can also write the apps for Owncloud and submit in the repository . It will be great help to Owncloud community.

Currently, Owncloud has released version 6 series. You can read about the new features of Owncloud 6 from this link.

Installing Owncloud 6 on Ubuntu 14.04 LTS Server (Trusty Tahr)

In this practical, the installation has been done on Single Server, where Owncloud, Apache and MySQL are installed.

Requirements :
(1) Database Server : MySQL (version 5.6)
(2) Web Server : Apache (version 2.4)
(3) Operating System : Ubuntu 14.04 LTS Server Edition
(4) Web Application : Owncloud version 6.x
(5) Knowledge of IP based and Name based Virtual Hosting in Apache

Follow the given below steps to install Owncloud 6 on Ubuntu 14.04 LTS (Trusty Tahr)

(Step 1): Install MySQL Server

You can install MySQL 5.6 on Ubuntu 14.04 LTS . At the time of writing this post, it is the latest and stable release. The latest MySQL 5.6 version is available in Ubuntu repository, hence it can be installed via using apt-get command .

sudo apt-get update
sudo apt-get install mysql-server-5.6

(Step 2) : Create MySQL user for Owncloud server

Now create mysql user for Owncloud server. The MySQL user will help the Owncloud Server to connect with Database. We also give full privilege to this MySQL user on Owncloud’s database.

The given below are the details which will create in MySQL Server.

Database Name : owncloud
MySQL User Name : ownclouduser
MySQL User’s Password : Password

Login into MySQL Server with root user (Use MySQL root password here).

mysql -u root -p
After login you will get the mysql prompt like this
mysql >
Now create a user and set the password. Use strong password
mysql> CREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'Password';
create database called owncloud
mysql> create database owncloud;
Grant privileges to owncloud user in owncloud database
mysql> GRANT ALL ON owncloud.* TO 'ownclouduser'@'localhost';
mysql> flush privileges;
mysql> exit

( Step 3 ): Install Apache and PHP

For web server requirement, we are installing Apache . The Owncloud is PHP based application, hence we will install PHP version 5 . To connect PHP code with MySQL database, we will install the module named as php5-mysql.

sudo apt-get install apache2 php5 php5-mysql

(Step 4 ) : Enable rewrite module

The Owncloud application has .htaccess file which has some rewrite rules. Use below given command to enable rewrite module

sudo a2enmod rewrite

sudo service apache2 restart

(Step 5 ): Install Owncloud Server

Now in this step we will install owncloud package on Ubuntu 14.04 LTS

sudo sh -c "echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud.list"

wget http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_14.04/Release.key
sudo apt-key add - < Release.key  

sudo apt-get update
 	
sudo apt-get install owncloud

( Step 6 ): Move Owncloud data directory

By default, after installation of Owncloud its data directory is saved in /var/www .

In Ubuntu 14.04, default Apache 2.4 is shipped. You can see defualt DocumentRoot as /var/www/html in Apache 2.4 (Ubuntu 14.04 LTS) , which is different than previous Ubuntu version (Earlier it was only /var/www)

Move the Owncloud data directory to /var/www/html

sudo mv /var/www/owncloud /var/www/html

(Step 7 ) : Configuring owncloud.conf file

By default, you will get owncloud.conf file in /etc/apache2/conf.d after owncloud installation.

Here we will do some changes, so that it should work with Apache 2.4 version

Take backup of original owncloud.conf file.

sudo cp -p /etc/apache2/conf.d/owncloud.conf /etc/apache2/conf.d/owncloud.conf.orig.`date +%F`

Move owncloud.conf file to /etc/apache2/sites-enabled

mv /etc/apache2/conf.d/owncloud.conf /etc/apache2/sites-enabled

Unlink the default Apache Configuration file, known as 000-default.conf
Note: 000-default.conf is softlink

sudo unlink /etc/apache2/sites-enabled/000-default.conf

Edit the owncloud.conf file as given below .

YOU HAVE TWO OPTIONS EITHER CONFIGURE WITH IP BASED VIRTUAL HOST or NAME BASED VIRTUAL HOST.
I AM WRITING BOTH METHOD. YOU HAVE TO SELECT ONLY ONE METHOD TO EDIT owncloud.conf FILE

IP based Virtual Host

For configuring Apache we use IP Address of Server here. Which you can obtain by using ifconfig command

sudo vi /etc/apache2/sites-enabled/owncloud.conf

Paste given below contents in owncloud.conf file. NOTE: Replace 192.168.56.101 with your Server IP Address



	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html/owncloud

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined


  AllowOverride All
  Require all granted



OR

Name based Virtual Hosting

In case you have Domain name, you can use Name based Virtual Hosting .

sudo vi /etc/apache2/sites-enabled/owncloud.conf

Paste given below contents in owncloud.conf file. NOTE: Replace owncloud.example.com with your domain name.



	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html/owncloud

        ServerName owncloud.example.com

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined


  AllowOverride All
  Require all granted


(Step 8): Restart apache service

After doing configuration, restart apache service.

sudo service apache2 restart

( Step 8 ): Installing Owncloud through Web Interface

* Open the Owncloud URL in Web Browser .

* Give Owncloud Dashboard administrator user name. We have given the name as "admin"

* Click on Advanced tab , it will open the Database option. Click on MySQL tab. And give the MySQL credentials, which we have already set up in Step 2
Then, finally click on Finish setup button. And that is it, you are into Owncloud Admin dashboard.

Owncloud 6 , Ubuntu 14.04 LTS

We would like you to explore awesome features of Owncloud. You can give your contribution to Owncloud project, it will be wonderful gift to others.

39 thoughts on “How to install Owncloud 6 on Ubuntu 14.04 LTS Server”

  1. Thankyou David,

    OK, Soon I will write a post on upgrading part also.
    follow us via twitter,facebook,google plus or email subscription, you will get the update soon.

    Regards
    Sharad

    Reply
    • Good tutorial but when you upgrade owncloud, server is down. That’s due to moving the owncloud files in html folder.
      You have to make choice between respect the new Apache convention or to add owncloud repository.
      I think I will remove the html folder.

      Reply
      • Hi Aurelien,

        Its a good catch.
        We always recommend user to first take the backup of data directory.
        The new Apache 2.4 has many new features and parameters changes as well. So always be careful while upgrading owncloud when Web browser, Database,Operating system etc. are new

        Regards
        Sharad

        Reply
    • Hello Kamil,

      If it is newly setup Apache server then you do not have to work on any apache configuration file.
      You can use default apache config. Simply move Owncloud dir to /var/www/html and try once again.

      Let me know if it did not work, we will troubleshoot on this.

      Regards
      Sharad

      Reply
  2. Thank you for these instructions. My owncloud is working.
    I am going to wait for your https instructions.

    Reply
  3. I followed your instructions to the letter and had success in installing OwnCloud on my new VPS.
    Thank you very much!

    Reply
  4. Hopefully you havn’t abandoned this page. I did the instrucations, but it says it’s not a trusted domain.

    Also could you show how to enable https: ? It’s kinda important and I keep breaking it when I try.
    Lastly and final question, I want to run wordpress on the same server, would changing these apache setting interfere with that?

    Reply
    • Hello Temple Pate,

      HTTPS post enabling is pending from my side. Practically I have completed and is implemented live as well.
      In Ubuntu 14.04 , Apache 2.4 version is shipped by default. Hence, we have to configure apache server as per 2.4 version documentation.
      You can install wordpress along with owncloud in same server. Best practice is to create Name based Virtual Hosting in Apache Server.
      Kindly let me know, if problem still persist. I am always happy to help.

      Regards
      Sharad

      Reply
  5. Great instructions. Thanks for the help. I have follow the steps but what I get at the end when I enter the ip address is the following

    Thanks for your help

    <?php

    /**
    * ownCloud
    *
    * @author Frank Karlitschek
    * @copyright 2010 Frank Karlitschek karlitschek@kde.org
    *
    * This library is free software; you can redistribute it and/or
    * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
    * License as published by the Free Software Foundation; either
    * version 3 of the License, or any later version.
    *
    * This library is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
    *
    * You should have received a copy of the GNU Affero General Public
    * License along with this library. If not, see .
    *
    */

    $RUNTIME_NOAPPS = true; //no apps, yet

    try {

    require_once ‘lib/base.php’;

    OC::handleRequest();

    } catch (Exception $ex) {
    OCPUtil::logException(‘index’, $ex);

    //show the user a detailed error page
    OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
    OC_Template::printExceptionErrorPage($ex);
    }

    Reply
    • Hello Turuncu oglu,

      Thankyou for the words of appreciation.
      Can you send me the screenshot? On first look it seems php or php related module is missing/ or apache is not able to load php module.
      I will also suggest you to once check the Apache’s log.

      Regards
      Sharad

      Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.