How To Install OwnCloud and Configure OwnCloud Apps on an Ubuntu 12.04 VPS
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:
- Upgrade to Ubuntu 14.04.
- Upgrade from Ubuntu 14.04 to Ubuntu 16.04
- Migrate the server data to a supported version
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.
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.
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.
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.
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:
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:
your_IP_or_domain/owncloud/files/webdav.php /home/username/owncloud davfs user,rw,noauto 0 0
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.
your_IP_or_domain/owncloud/files/webdav.php OwnCloud_username OwnCloud_password
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:
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
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":
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:
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.
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.
Anything you save will be available within your 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:
You now have a "Tasks" button on the left-hand navigation bar. Click it to see the 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":
You will now have a "News" tab on the left-hand navigation bar. Enter your RSS feeds in upper-left corner.
Your feeds will then show up on the right side. You will have a menu of feeds on the left:
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.