User Tools

Site Tools


linux:owncloud_setup

ownCloud Setup

After using pydio (aka ajaxplorer) for 2 years, we had some unidentified errors so instead of installing/upgrading pydio again, we checked the alternatives and found ownCloud. It is open source and robust. We have Windows 2012 server and running some virtual debians under it, so with the virtual appliance (VHDX format) provided by ownCloud website (under download section), we easily installed ownCloud. Since I do not want to forget key points of installation and setup, I will give crucial instructions below. Note that ownCloud is prefered to use Ubuntu as host OS and these instructions are applicable for version 9 of ownCloud.

Download

From https://owncloud.org/install/ address, you can download VHDX under “Appliances” section. There are other formats (VMX, VMDK, OVA, etc.). Zipped VHDX file is less than 1GB. But, when you unzip it, it becomes 40GB :!:.

HyperV Setup

After unzipping ownCloud appliance to your desired path for your virtual machines, open hyperv and create new virtual machine. After giving a name for the ownCloud virtual machine, you need to choose Generation 1 :!: for virtual machine generation.

At past I always had problems by assigning dynamic memory for linux machines, so I assigned the startup memory at 2GB and did not choose the Dynamic Memory for this virtual machine :!:.

When you are at “Connect Virtual Hardisk Section” of HyperV wizard, select “use an existing harddisk” and select the unzipped vhdx file of ownCloud, then finish wizard by following the wizard pages.

After creating ownCloud server, open virtual machine settings and configure it according to your needs and resources. Under Management section of settings you can select “Always start this virtual machine automatically” from “Automatic start action” menu.

ownCloud Post Setup

Since ownCloud is preinstalled in your virtual machine you need to just start the machine and follow the post installation instructions. Watch ownCloud console by connecting it with HyperV and let it guide you. Note that, default password is printed on console.

It is good to ugrade your Ubuntu server and owncloud if any upgrade is available. ownCloud repository addresses are predefined in /etc/apt/sources.list.d/owncloud.list. sudo -i makes you root and you can enable root by assigning password for root if you like.

upgrade the system by running following commands.

apt-get update
apt-get upgrade

If you try to access openCloud server from browser, it is located under http://IPADDRESS/owncloud
I created an simple index.php file for redirecting to /owncloud. Put index.php file under /var/www/html with this content;

<?php
header("Location: /owncloud");

After upgrading, you may see “maintenance mode” warning on ownCloud login page. This can be fixed by editing ownCloud server's config file. This config file's path is /var/www/owncloud/config/config.php. config file is an ordinary php file and configurations is set by editing $CONFIG array. When you set maintenance key to false and save it, you can now login to the owncloud server. I put my config file below.

<?php
$CONFIG = array (
  'updatechecker' => false,
  'instanceid' => 'xxxxxxxxxxxxxxxx',
  'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '192.168.1.61',
    2 => 'download.example.com',
    3 => 'www.download.example.com',
  ),
  'datadirectory' => '/var/www/owncloud/data',
  'overwrite.cli.url' => 'http://localhost/owncloud',
  'dbtype' => 'mysql',
  'version' => '9.0.0.19',
  'dbname' => 'oc',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_admin',
  'dbpassword' => 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
  'logtimezone' => 'UTC',
  'installed' => true,
  'maintenance' => false,
  'loglevel' => 2,
);

After this point, I will tell the apache reverse proxy settings and active directory integration for ownCloud.

ownCloud behind Reverse Proxy

I needed to expose my ownCloud server to the public. Since 80 port is natted to our another server and I do not want to use another port other than 80 for easy access, I configured my apache server 2.2.

If you just want to forward port 80 requests to ownCloud server here is the apache 2.2 configuration

<VirtualHost *:80>
    Servername download.example.com
    ServerAlias www.download.example.com
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass / http://192.168.1.61/
    ProxyPassReverse / http://192.168.1.61/
</VirtualHost>

If you want to use your SSL certificate and force the users to use https here is the apache 2.2 configuration

<VirtualHost *:80>
    Servername download.example.com
    ServerAlias www.download.example.com
    ProxyPreserveHost On
    Redirect permanent / https://download.example.com/
</VirtualHost>

<VirtualHost *:443>
    ServerName download.example.com
    ServerAlias www.download.example.com
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass / http://192.168.1.61/
    ProxyPassReverse / http://192.168.1.61/
    
    SSLEngine on
	
    SSLCertificateFile "C:/xampp/apache/xxxxxx.crt"
    SSLCertificateKeyFile "C:/xampp/apache/xxxxxx.key"
    SSLCACertificateFile "C:/xampp/apache/xxxxx.ca-bundle"
	
</VirtualHost>

After setting your reverse proxy, you need to change/add some configuration parameters of ownCloud.

Open your config.php file of ownCloud and set the following parameters;

 ...
  "overwriteprotocol" => "https", //if your reverse proxy server forces to https
  "trusted_proxies"   => ['192.168.1.127'], //reverse proxy server address
  //"overwritecondaddr" => "^192\.168\.1\.127$", // if you want to see the real IPs in the logs
  ...

ownCloud Active Directory Setup

We have an windows active directory server so we integrated the users with ownCloud with its LDAP user and group backend app. This app is not enabled but you can from the apps menu. However, your Ubuntu server needs to have php5-ldap package installed to use it.

apt-get install php5-ldap

After installing php5-ldap package, My LDAP settings in ownCloud are as below;

You can also create a dedicated domain group and select it if you do not want to add all domain users.

Have fun.

Discussion

Enter your comment. Wiki syntax is allowed:
 
linux/owncloud_setup.txt · Last modified: 2016/04/04 10:58 by ozan