How to Install OwnCloud to Ubuntu 14.04 LTS

This quick how-to steps you through a simple installation of OwnCloud to a Ubuntu 14.04 server.

First, you need some prereqs:

 sudo apt-get install php5-gd mysql-server

To begin, you need to add the repository for ownCloud for ubuntu 14.04.

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

Next, update the lists and install the package.

sh -c "echo 'deb http://download.owncloud.org/download/repositories/stable/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud.list"
apt-get update
apt-get install owncloud

Once the package is installed, access the ownCloud interface at http://SERVERNAME/owncloud

The first time you launch it, it will prompt you to create an admin id and password. Optionally, you can pick the Data folder location and choose MySQL vs SQLite.

owncloud setup 1404

 

After you create the admin user and sign into the OwnCloud Interface, if you are installing this for home use, you will probably want to enable some basic plug-ins.   If you plan on syncing calendars and contacts, then you will need at least those 2 add-ons.

Click on the Files entry on the upper left for the pull down menu shown below.   Click on the + to add new apps.

owncloud setup 1404

owncloud setup 1404

 

Select ‘Productivity’ from the left hand menu and Enable the Calendar and Contacts Applications.

owncloud setup 1404

owncloud setup 1404

 

Once completed, you will be taken to the web interface. Here you can add users and adjust settings as needed. I create the users here and that will pretty much complete the basic install.

ownCloud Admin menu

Last thing to do is load a desktop client available from ownCloud’s web page http://owncloud.org/sync-clients/

Next Steps that you should consider:
1) Enforce https connectivity to the owncloud, this is done through the admin menu selection.
2) Turn on Antivirus. Enabling this app in the Admin->apps menu sets up ClamAV to scan all uploaded content.
3) Make sure you are backing up the Owncloud Data Directory and the MySQL database.

 

There are additional options here for LDAP authentication, email alerts, and much more beyond this basic setup. Explore the add-on applications as well.

Enabling HTTPS access to OwnCloud

This document can be used for Owncloud Ver 8 and Ubuntu Server 14.04.

If you are running owncloud and have it facing the public internet, you should really be enforcing https communication. Even if it is internal only, enforcing https is a good idea. Since owncloud runs on top of apache2, enabling https is pretty easy. There are lots of tutorials available for this. I have added this here for easy reference.

To start, you need to have a cert issued from a known authority or you create a self signed cert. If you plan on using WebDAV with IOS, I have found that a cert from a known authority works where a self signed certs cause issues. You can thank apple for that.

Since we are using certs, you need openssl modules if you don’t already have it installed.

You should have a public cert, private key, and a root-CA from the issuing Authority.
Copy your public cert PEM file into /etc/ssl/certs/my-public-cert.pem
Copy your private key file into /etc/ssl/private/my-private-key.key
Copy your CertAuth-Rootca.crt file into /usr/local/share/ca-certificates

This command will read in the Root-CA Cert and add it to the trusted list for this server.

sudo update-ca-certificates

Note: For some installations, you need to use “sudo dpkg-reconfigure ca-certificates” instead which calls update-ca-certificates

Now that the CA is trusted, enable the needed apache plugins:

a2enmod rewrite && a2enmod headers && a2enmod ssl

Create an apache virtual host:

nano /etc/apache2/conf-available/owncloud-ssl.conf

Add the following to the new file.   This will forward requests from port http port 80 to https port 443 ensuring all communication is encrypted.    The virtual host 443 is setup with the certificates specified.   The mod_headers is an best practices entry from owncloud for a more secure server.

<VirtualHost *:80>
    RewriteEngine on
    ReWriteCond %{SERVER_PORT} !^443$
    RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>
<VirtualHost *:443>
    ServerName 127.0.0.1
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/my-public-cert.pem
    SSLCertificateKeyFile /etc/ssl/private/my-private-key.key
    DocumentRoot /var/www/owncloud

    <IfModule mod_headers.c>
        Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
    </IfModule>
</VirtualHost>

Next we enable the new conf file:

a2enconf owncloud-ssl.conf

Restart apache:.conf

sudo service apache2 restart

Now access owncloud over https://servername . Notice “/owncloud” is not requried in the URL because of the Document Root entry in the conf we added to apache. Navigate to the Admin page and enable the “Enforce HTTPS” option. Enforce HTTPS can only be enabled while accessing the page via https.

HTTPS Enforcement on OwnCloud

HTTPS Enforcement on OwnCloud

All clients can now use https://servername to access the cloud. Http access is no longer available for clients making the server more secure.

Sync Android Contacts, Calendar, and Files to ownCloud

Do you dislike Google? I do. I hate the fact that Google wants to record every little bit of information from your life and data mine it to death. And just like how the iPhone requires an Apple ID , Android phones seem to require you to share all your information with Google via a Google account.

These discussions online always bring out the Google supporters who will call those who do not want to share info with google ‘paranoid’ or say ‘why would your information be so important’. Listen, I just don’t want a 3rd party company to have information about me, about my schedule, about who I speak with, etc. It’s not about being paranoid, it’s just about wanting to keep my personal life private.

Since I do need access to mail and information when on the road, I have need of a smartphone. Yet I don’t want to have my phone and it’s data linked to an Apple ID or Google ID. I’ve finally found a way to have an Android Phone without the need for a Google account and yet have calendar, contacts, and data kept secure in a personal cloud and shared between multiple devices and via web interface.

By using an opensource product called ‘ownCloud’ to run a personal cloud service on a host that I own, I can use a few apps to sync all those items from my phone to my own personal cloud.

For starters, you need to have ownCloud installed on a host. This is my other post showing how to get started. http://www.slsmk.com/how-to-install-owncloud-to-ubuntu-12-04/

For some of these apps, you need to use F-Droid appstore. Visit the F-Droid Site, Download the APK, and sideload it to your phone by opening the file on the phone and selecting package installer to open the file. F-Droid Appstore can be used to load apps just like the Playstore.

From F-Droid, grab the apps called ‘ownCloud Client’ and ‘DavDroid’. This app will be used to create the Link between the Contacts app on android and the ownCloud Contacts application.

Setup the Contacts sync adapter
1) Load DAVDroid on your phone as indicated above.

2) From your phone, go to MENU – SETTINGS – ACCOUNTS – and Add new account.

3) Pick DAVDroid from the list of account types

4) In Server name, use the name from the ownCloud server you already have setup. https://SERVERNAME/owncloud/remote.php/carddav/principals

5) Enter the Username and Password for the owncloud account you want to sync.

6) In the DAVDroid settings, pick the entry you want to sync. Set it up the way you like.

Setup the CalDAV Calendar Sync Adapter
1) Load DAVDroid on your phone from F-Droid Appstore as indicated above.

2) From your phone, go to MENU – SETTINGS – ACCOUNTS – and Add new account.

3) Pick DAVDroid Sync adapter from the list of account types

4) In Server name, use the name from the ownCloud server you already have setup. https://SERVERNAME/owncloud/remote.php/caldav/principals

5) Enter the Username and Password for the owncloud account you want to sync.

6) You should log into the ownCloud server with this account and check the calendar settings for Timezone, 24h format, etc…

Setup the ownCloud Client for File Sync
1) Load the ownCloud app from F-Droid Appstore.

2) From your phone, goto MENU – SETTINGS – ACCOUNTS – and Add a new account.

3) Pick ownCloud from the list of account types

4) In URL, use the ownCloud Server that you already have setup: https://SERVERNAME/owncloud

5) Enter the Username and Password for the ownCloud account you want to use to sync files.

6) Open up the ownCloud app and look at the options. You can have it sync every time you take a picture or on a schedule. It’s up to you. You can also define the file locations to sync as well.

Now to cut the Google Cord for Contacts… Lets turn off the Google sync for good. From the phone, SETTINGS – APPS – Swipe over to ALL apps. For each of the following, open it up, CLEAR the Data, then DISABLE the app.
1) Gmail
2) Google Contacts Sync
3) Google Calendar Sync
4) Google Bookmark Sync

With these disabled, you can still keep a Google account for the playstore if you want, but mail, calendar, and contacts will not sync with Google Server.

If you really want to dump Google, disable everything and use a 3rd Party app store like Amazon or F-Droid. Or just side-load all the APKs you want. Disable or delete the following to really dump google:
1) Google Account Manager
2) Google Play Services
3) Google Play Store

And that’s it.

For contacts, when you create a new contact, you should see the DAVDroid Sync Adapter instead of a Google Account. New contacts will be synced to and from the ownCloud Service.

For Calendar, you should select the Calendar to Display from within the Calendar app. New appointments will be synced to and from the ownCloud service.

Make sure you test everything. Create calendar events on server and phone and make sure they sync. Same thing for Contacts and Files.

Important: Make sure you have a backup of the ownCloud Database. Schedule a backup of SQLite or the MySQL DB regularly. It also doesn’t hurt to export your contacts to a VCF file and save it as well. Keep multiple backups of anything you can’t live without. This is your own host running cloud services, not a 3rd party server anymore. IF your host fails, you lose your data if you don’t have a copy somewhere.

Congratulations, You are no longer a slave to Google’s insatiable appetite for data. Your stuff remains yours and in your possession while enjoying the benefits of syncing with the Cloud.

How to install ownCloud to Ubuntu 12.04

NOTE:
The latest releases of Owncloud ver 8 require PHP version 5 which is not available in the native repositories for Ubuntu 12.04. If you want to run the latest OwnCloud, you should use Ubuntu 14.04 instead. Here is the HOW-TO: http://www.slsmk.com/how-to-install-owncloud-to-ubuntu-14-04-lts/ Running ver 8 on 12.04 is possible but requires the use of 3rd party repo for php5 or a manual installation of php5.

This short tutorial will show you how to create a personal cloud server that can be used to sync files from multiple desktops and, even better, be used to sync calendar and contacts from your android phone.

First, you need some prereqs:

 sudo apt-get install php5-gd mysql-server

To begin, you need to add the repository for ownCloud for ubuntu 12.04.

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

Next, update the lists and install the package.

echo 'deb http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_12.04/ /' >> /etc/apt/sources.list.d/owncloud.list 
apt-get update
apt-get install owncloud

Once the package is installed, access the ownCloud interface at http://SERVERNAME/owncloud

The first time you launch it, it will prompt you to create an admin id and password. Optionally, you can pick the Data folder location and choose MySQL vs SQLite

ownCloud Start

Once completed, you will be taken to the web interface. Here you can add users and adjust settings as needed. I create a single local user and that will pretty much complete the basic install.

ownCloud Admin menu

Last thing to do is load a desktop client available from ownCloud’s web page http://owncloud.org/sync-clients/

Some things you should really consider:
1) Enforce https connectivity to the owncloud, this is done through the admin menu selection.
2) Turn on Antivirus. Enabling this app in the Admin->apps menu sets up ClamAV to scan all uploaded content.

There are additional options here for LDAP authentication, email alerts, and much more beyond this basic setup.