Tutorial

How To Install OwnCloud and Configure OwnCloud Apps on an Ubuntu 12.04 VPS

Published on September 26, 2013
How To Install OwnCloud and Configure OwnCloud Apps on an Ubuntu 12.04 VPS

Status: Deprecated

This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:

Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.

See Instead: This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.

Introduction


OwnCloud is a web application that can store and serve content from a centralized location, much like Dropbox. The difference is that ownCloud allows you to host the serving software on your own machines, taking the trust issues out of putting your personal data someone else’s server.

Although mainly used as a simple file-sharing and accessing portal, ownCloud has many other functionalities as well.

In this guide, we will install and configure an ownCloud instance on an Ubuntu 12.04 VPS. We will then discuss how to mount the ownCloud share to another VPS using WebDAV. We will also cover some other exciting options.

Install OwnCloud


The version of ownCloud available in Ubuntu 12.04’s default repositories is out of date by now. We will get the latest stable version that is built using openSUSE’s amazing build services.

We will first download the release key associated with the ownCloud software:

cd
wget http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_12.04/Release.key

Now add the key to apt so that it can validate the files:

sudo apt-key add - < Release.key

Add the ownCloud repositories in the openSUSE build service to apt’s source lists by typing:

echo 'deb http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_12.04/ /' | sudo tee -a /etc/apt/sources.list.d/owncloud.list

Finally, update the package database and install ownCloud and MySQL:

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

You will be asked to set a root password for the MySQL database admin user during installation.

MySQL Configuration


We will be configuring our ownCloud server to take advantage of the more robust MySQL database instead of the SQLite default implementation. To do so, we must configure MySQL first.

Type the following commands to initialize the database and secure the system:

sudo mysql_install_db
sudo mysql_secure_installation

You will have to enter the administration password you selected during the MySQL installation. You will then be prompted for security settings. Press “Enter” to select yes for all of the settings except the first (about changing the root password again).

Now, sign into MySQL as the root user by typing:

mysql -u root -p

Again, you will be prompted for the MySQL administration password.

Create a database with this command:

CREATE DATABASE owncloud;

Create and assign privileges to a new MySQL user to handle database operations for ownCloud:

<pre> GRANT ALL ON owncloud.* to ‘owncloud’@‘localhost’ IDENTIFIED BY ‘<span class=“highlight”>select_database_password</span>’; </pre>

Exit MySQL by typing:

exit

Final Configuration


Now, if you go to your IP address or domain name followed by “/owncloud” in your browser, you will see a page that looks like this:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/error_page.png” alt =“OwnCloud error page” />

You can fix these errors by installing an additional package. We’ll also install the PHP curl library for later:

sudo apt-get install php5-intl php5-curl

Now, reload your page and you should be give a page that will ask you to create an administrative user:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/create_admin.png” alt =“OwnCloud create admin” />

Before doing so, click on the “advanced” button. Select “MySQL” from the available options. Enter the information you configured in the last step:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/advanced_setup.png” alt =“OwnCloud advanced setup” />

Create a user and password. You will be signed in and presented with a welcome message:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/welcome_page.png” alt =“OwnCloud welcome page” />

Click the “X” in the corner to get to the main interface:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/file_upload.png” alt =“OwnCloud File Upload” />

Here, you can create or upload files to your personal cloud.

Mount Your OwnCloud Share to Your VPS


If you would like to be able to interact with your ownCloud instance from the command line as if it were part of your local filesystem, you can mount the file sharing directory using WebDAV.

From another Ubuntu droplet or machine, you can mount the shared region. This allows you to interact with the space in an automated way.

Install the WebDAV tools on the second Ubuntu machine by typing:

sudo apt-get update
sudo apt-get install davfs2

We will allow non-root users to mount and unmount the WebDAV shares by typing:

sudo dpkg-reconfigure davfs2

 ???????????????????????????? Configuring davfs2 ?????????????????????????????
 ?                                                                           ? 
 ? The file /sbin/mount.davfs must have the SUID bit set if you want to      ? 
 ? allow unprivileged (non-root) users to mount WebDAV resources.            ? 
 ?                                                                           ? 
 ? If you do not choose this option, only root will be allowed to mount      ? 
 ? WebDAV resources. This can later be changed by running 'dpkg-reconfigure  ? 
 ? davfs2'.                                                                  ? 
 ?                                                                           ? 
 ? Should unprivileged users be allowed to mount WebDAV resources?           ? 
 ?                                                                           ? 
 ?                    <Yes>                       <No>                       ? 
 ?                                                                           ? 
 ????????????????????????????????????????????????????????????????????????????? 

Select “Yes” to enable WebDAV control for users.

Next, add your Linux username to the WebDAV group:

<pre> sudo usermod -aG davfs2 <span class=“highlight”>username</span> </pre>

Edit the file system table:

sudo nano /etc/fstab

Add the following line to the end of the file, substituting your server and username information:

<pre> <span class=“highlight”>your_IP_or_domain</span>/owncloud/files/webdav.php /home/<span class=“highlight”>username</span>/owncloud davfs user,rw,noauto 0 0 </pre>

Go to your home directory and create two directories, one to mount the share, and the other to hold the WebDAV configuration details:

cd
mkdir owncloud
mkdir .davfs2

Create a file called “secrets” in your WebDAV configuration directory to store your login credentials for your ownCloud instance.

<pre> nano /home/<span class=“highlight”>username</span>/.davfs2/secrets </pre> <pre> <span class=“highlight”>your_IP_or_domain</span>/owncloud/files/webdav.php <span class=“highlight”>OwnCloud_username</span> <span class=“highlight”>OwnCloud_password</span> </pre>

Now lock down the file, since it contains sensitive information in plain text:

chmod 600 ~/.davfs2/secrets

Finally, you’re ready to mount your share:

mount ~/owncloud

Now, change into the owncloud directory to see the content:

cd ~/owncloud
ls

error_page.png  lost+found  Screen Shot 2013-09-25 at 1.03.37 PM.png

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/file_compare.png” alt =“OwnCloud file comparison” />

You can add, remove, or edit files as if they were on your local computer, but the ownCloud you’ve set up will reflect the changes.

Use OwnCloud to Manage Bookmarks


One advantage of incorporating your web habits into ownCloud is that your information can be persistent among multiple devices and locations.

A good example of this is the ability to store your bookmarks in ownCloud. You can then access them from any computer.

To enable bookmarks, click on your username in the upper-right corner, and then click “Apps”:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/apps.png” alt =“OwnCloud apps” />

Here, you can enable modules, or “apps” to extend the functionality of your ownCloud.

Find the “Bookmarks” selection in the menu and the click the “Enable” button:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/enable_bookmarks.png” alt =“OwnCloud enable bookmarks” />

A button called “Bookmarks” will be added to the left-hand navigation bar. Click it.

Now drag the button from the center of the page and place it in the bookmarks bar of your browser.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/bookmark_drag.png” alt =“OwnCloud bookmark drag” />

Now, you have a button in your browser that says “Read later”. On any page you wish to book mark, click that button to create a bookmark within ownCloud.

A pre-populated bookmark will open up and you can edit it with tagging information.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/bookmark_tagging.png” alt =“OwnCloud bookmark taggin” />

Anything you save will be available within your Bookmarks tab:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/bookmarks_tab.png” alt =“OwnCloud bookmarks tab” />

Use OwnCloud to Keep Track of Tasks


OwnCloud also has a fairly functional task organizer. This can be incorporated with the calendar plugin to organize and schedule activities and tasks.

Go to the apps page again (click on your username in the upper-right corner and then select “apps”). Click on “Tasks” and then the “Enable” button:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/enable_tasks.png” alt =“OwnCloud enable tasks” />

You now have a “Tasks” button on the left-hand navigation bar. Click it to see the tasks interface:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/tasks_interface.png” alt =“OwnCloud tasks interface” />

Use OwnCloud to Manage Your RSS Feeds


If you keep track of multiple sites daily, you probably are familiar with RSS feeds. These allow you to keep up-to-date on site content in a unified interface.

You can enable this functionality within ownCloud by turning on a few apps.

Again, go to the apps page (click on your username in the upper-right corner and then select “apps”).

You need to enable both “App Framework” and “News”:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/app_framework.png” alt =“OwnCloud app framework” />

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/news_app.png” alt =“OwnCloud news app” />

You will now have a “News” tab on the left-hand navigation bar. Enter your RSS feeds in upper-left corner.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/feed_enter.png” alt =“OwnCloud feed enter” />

Your feeds will then show up on the right side. You will have a menu of feeds on the left:

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/owncloud/feed_example.png” alt =“OwnCloud feed example” />

Conclusion


OwnCloud can replicate the functionality of many popular pieces of software. The advantage of ownCloud is that the information is stored in a place that you control.

Explore the interface and try out some of the plugins. Many of the extensions have the ability to import data from the applications you are currently using.

<div class=“author”>By Justin Ellingwood</div>

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I had the same mount error but was able to fix it by changing the WebDAV path to:

doc above says:

<your_IP_or_domain>/owncloud/files/webdav.php

instead use:

<your_IP_or_domain>/owncloud/remote.php/webdav

I have apache virtual hosts configured with 2 domain names, and owncloud is accessible at both of them (for example, example.com/owncloud/ and test.com/owncloud/). However, I want owncloud to be ONLY accessible at one domain name (test.com/owncloud/ only). How do I do so?

Great tutorial. Thanks for writing it. Little feedback though… You should probably mention to replace the /var/www/html/index.html file so that other people can’t view Apache’s configuration.

To keep the original file in case it is needed in the future:

cp /var/www/html/index.html /var/www/html/index.html.bak

Write a new file:

vi /var/www/html/index.html

press dG to delete everything from current line to end of file. then press :wq to write and quit

can i still use this guide for Ubuntu 14.04 server edition ?

Thanks for the Tut!

Following along and almost setup except when running mount ~/owncloud I get: user myuser must be member of group davfs2

running groups myuser it appears it is in that group, outputs following: myuser adm cdrom sudo dip plugdev lpadmin sambashare davfs2

Any ideas?

I’m on latest ubuntu 14

Thanks Sean

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
February 4, 2014

@brightinworld: Not selecting mysql results in owncloud using sqlite instead which is slower.

Check out ad2012’s post here: <a href=“http://forum.owncloud.org/viewtopic.php?t=2964#p6626”>http://forum.owncloud.org/viewtopic.php?t=2964#p6626</a>

I forgot to do the advanced option. What should I do? Will there be a problem?

I have a few different websites already on one droplet and was curious where ownCloud would install to. If anyone else tries this, ownCloud installs to /var/www/ by default, so you have a new directory /var/www/owncloud after following the tutorial here. Just rename it or update your server config to point at that new folder. Hope that helps?

@Phil Dobbin

You can copy the secrets file from /etc/davfs2/ folder and just add your settings in the “credentials” area of that file. Just be sure to chown the file before editing with your username and then chmod 600 it after.

You can comment out line 24 of davfs2.conf and uncomment the secrets line.

Thanks for this tutorial. Well done!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more