OwnCloud Setup

OwnCloud Setup and Configuration

Preface

The steps listed below make the assumption that you have a dedicated MySQL server configured. If you need to run the MySQL instance on the OwnCloud server than you need to setup the Linux as a LAMP server so that it has it setup by default – it will also prompt you to set the MySQL usn/pwd as well.

Step 1: Create the VM

Create a new VM for Ubuntu 64-bit

Download the latest version of Ubuntu (these instructions are based on 14.04.1 TLS)

Provide sufficient RAM as this will host the web service as well as the MySQL instance

Step 2: Install Ubuntu

Accept all the defaults.

Step3: Install SSH Server

sudo apt-get install openssh-server

Disable to root login by editing the sshd_config file

sudo nano /etc/ssh/sshd_config

Find the “PermitRootLogin” line and change it to “PermitRootLogin no”

Step 4: Update and Upgrade

sudo apt-get update

sudo apt-get upgrade

Step 5: Install Additional Packages

sudo apt-get install php5 php5-mysql php5-gd php5-json php5-curl php5-intl php5-mcrypt php5-imagick php5-ldap

sudo service apache2 restart

Step 6: Download & Extract OwnCloud

wget https://download.owncloud.org/community/owncloud-7.0.3.tar.bz2

sudo tar –xvf owncloud-7.0.2.tar.bz2 –C /var/www/html/

Change permissions on the extracted data

sudo chown www-data:www-data –R /var/www/html/owncloud/

Step 7: Change Apache Config File

sudo nano /etc/apache2/apache2.conf

Find the directory for /var/www and change the “AllowOverride” to All instead of None. This section is down a few pages.

Step 8: Create and Prepare the database

This step is only required if you do not already have a dedicated MySQL server. I would recommend having a dedicated MySQL server as to distribute some of the load on the server since OwnCloud is a relatively heavy system.

Go into the MySQL commands

mysql –u root –p

Create the database, username and permissions

CREATE DATABASE owncloud;

CREATE USER ‘cloudadmin’@’localhost’ IDENTIFIED BY ‘password’;

GRANT ALL PRIVILEGES ON owncloud.* TO ‘cloudadmin’@’localhost’;

FLUSH PRIVILEGES;

Step 9: Configure OwnCloud (web)

Go to a browser and open up OwnCloud via the IP you have the server configured for

Enter in the username and password that you want

Enter in the MySQL credentials, database and server (localhost if you have it setup to be hosted on the same server)

Click the Finish Setup button and it should finish it up

Step 10: Add as a trusted domain

Update the apache config file

sudo nano /var/www/html/owncloud/config/config.php

Add the URLs to the list of trusted domains. It should look something like this:

array (

0 => ‘cloud’,

1 => ‘cloud.justanerd.net’,

),

Save the file

Step 11: Redirect to Root (Optional)

To have the URL automatically redirect to the owncloud folder, you’ll need to edit the conf file.

Standard (Non SSL)

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

SSL Config

sudo nano /etc/apache2/sites-available/default-ssl.conf

Change the web root to the new folder

Save the file and restart apache

Step 12: Active Directory Integration (Optional)

Setting up the AD Integration in 7.0.2/3 is much better implemented than it was in 7.0.1. To do this, follow these steps.

Step 1: AD User

Create a User for the OwnCloud administration that has access to view the Active Directory Domain Users/Groups.

Step 2: LDAP Add-On

Log back into OwnCloud and go to the Apps section. Find the “LDAP User and Group Backend” and enable it.

Step 3: Install the PHP-LDAP Add Module

Back on the actual server, install the php LDAP module by running:

sudo apt-get install php5-ldap

sudo service apache2 restart

Step 4: Configure the LDAP settings

Back in the OwnCloud interface, go to Admin and then start to configure the LDAP section.

The User DN can be found by going into AD and viewing the advanced features then looking at the user and checking the “Attribute Editor” and scrolling down until you find the distinguished name.

Once the User DN and the password have been entered it should auto populate the final window. After that you’ll want to go through and configure the User Filters, which all auto populate now.

Change the “Internal Username Attribute” on the “Expert” tab to be “sAMAccountName” and change the UUID Attribute for Users to be “cn”.

Change the “Case insensitive LDAP server (windows)” selection box to be selected under the Advanced Tab. Also, check the box for “Turn off SSL certificate validation”. On the “Directory Settings” section, make sure the “Group-Member association” is set to “Member (AD)”.

Step 13: Performance enhancements

Add the following lines to the config.php file in /var/www/html/owncloud/config

‘overwritewebroot’ => ‘/owncloud’,

‘updatechecker’ => false,

‘has_internet_connection’ => true,

‘check_for_working_webdav’ => false,

‘check_for_working_htaccess’ => false,

In Owncloud change to Cron jobs

Step 14: Setup SSL

Start by enabling ssl

sudo a2enmod ssl

Create a new directory

sudo mkdir /etc/apache2/ssl

You can either use self-signed certificates or you can get a free SSL certificate from www.startssl.com. I chose to get a SSL from startssl so that users (myself really) won’t see the warnings from IE/Chrome/Firefox about using self-signed certificates.

To create the self signed certificate

sudo openssl req –x509 –nodes –days 365 –newkey rsa:2048 –keyout /etc/apache2/ssl/owncloud.key –out /etc/apache2/ssl/owncloud.crt

Setup the certificate

sudo nano /etc/apache2/sites-available/default-ssl.conf

Add the line as the second line to the file

ServerName xxxx:443

Change the lines

SSLCertificateFile /etc/xxx (where you created the ssl certs)

SSLCertificateKey /etc/xxx (where you created the key)

To use a SSL cert from startssl

I’m not going to reinvent the wheel here, but here’s a walk through.

Activate the new vhost

sudo a2ensite default-ssl

Restart apache

Login to owncloud with https and then check the box to require https