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

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:

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:

GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'select_database_password';

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:

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:

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

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

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

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:

sudo usermod -aG davfs2 username

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: