Building your ownCloud

April 21, 2016 by Roberto Puzzanghera 0 comments

Store your files, folders, contacts, photo galleries, calendars and more on a server of your own. Access that folder wherever you are from your mobile device, your desktop, or a web browser.
Keep your files, contacts, photo galleries, calendars and more synchronized amongst your devices.
Share your data with others, and give them access to your latest photo galleries, your calendar, your music, or anything else you want them to see. Share it publicly, or privately. It is your data, do what you want with it.

owncloud-logo_0.png

Tired of uploading and delete my photos and docs on dropbox, google drive etc. I stumbled upon this open source project, which is one of the most mature and well documented, and realized that the time to switch off all my existing proprietary clouds had come :)

What follows was tested on a Slackware 14.1 environment, where I have manually installed apache 2.4 and php 5.6. I think that the installation should not be much different for another Linux distribution provided that you install the required packages.

Download and extract:

cd /path/to/your/webserver/document-root
wget --no-check-certificate https://download.owncloud.org/community/owncloud-7.0.3.tar.bz2
tar xjf owncloud-7.0.3.tar.bz2
ln -s owncloud-7.0.3 owncloud
chown -R root:root owncloud

Move the data dir outside the document root, so that it is not accessibile from the web:

mv owncloud/data ./owncloud-data

Now modify your config/config.php accordingly:

'datadirectory' => '/path/to/your/webserver/document-root/owncloud/data',
'datadirectory' => '/path/to/your/webserver/document-root/owncloud-data',

Check the requirements from the manual installation web page.

This is my php-5.6 configuration:

./configure \
        --with-mysql=/usr/local/mariadb \
        --with-mysqli=/usr/local/mariadb/bin/mysql_config \
        --with-pdo-mysql=/usr/local/mariadb \
        --with-mysql-sock=/usr/local/mariadb/tmp/mysql.sock \
        --with-mcrypt \
        --enable-mbstring \
        --enable-ftp \
        --with-zlib \
        --with-bz2 \
        --enable-zip \
        --enable-bcmath \
        --with-mhash \
        --with-curl \
        --with-gd \
        --with-jpeg-dir=/usr \
        --with-png-dir=/usr \
        --enable-gd-native-ttf \
        --with-freetype-dir=/usr \
        --with-t1lib \
        --enable-exif \
        --with-gettext=/usr \
        --enable-sockets \
        --with-xsl \
        --with-xmlrpc \
        --with-openssl \
        --enable-intl \
        --enable-soap \
        --with-pspell \
        --with-gmp \
        --prefix=/usr/local/php

Create a virtualHost on apache. Here is my configuration for apache-2.4:

<VirtualHost *:443 *:80>
 # adjust this accoording to your ssl config
 Include my-ssl-stuff.conf

 ServerName cloud.yourdomain.xy
 DocumentRoot /path/to/your/webserver/document-root/owncloud

 ErrorLog /path/to/logs/owncloud_error.log
 LogLevel warn
 CustomLog /path/to/logs/owncloud_access.log combined

 <Directory /path/to/your/webserver/document-root/owncloud>
 AllowOverride All
 Options +Indexes +FollowSymLinks +MultiViews
 Require all granted
 # add any possibly required additional directives here
 # e.g. the Satisfy directive (see below for details):
 Satisfy Any
 </Directory>

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

 <FilesMatch "\.(cgi|shtml|phtml|php)$">
 SSLOptions +StdEnvVars
 </FilesMatch>

 BrowserMatch "MSIE [2-6]" \
 nokeepalive ssl-unclean-shutdown \
 downgrade-1.0 force-response-1.0
 BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>

Preparae a mysql/mariadb database and user, because during the setup you will be requested for a database access.

Now it's time to connect to your owncloud site looking for https://cloud.yourdomain.xy. It's easy to create your first account and set up the mysql database.

You can adjust your configuration editing the config/config.php file. For example, you may want to configure the default language. This is my config.php file:

Installing apc on php-5.6.0 I got this compilation error:

cc -D_GNU_SOURCE -I. -I/tmp/pear/temp/APC -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root9f66KR/APC-3.1.13/include -I/tmp/pear/temp/pear-build-root9f66KR/APC-3.1.13/main -I/tmp/pear/temp/APC -I/usr/local/php-5.6/include/php -I/usr/local/php-5.6/include/php/main -I/usr/local/php-5.6/include/php/TSRM -I/usr/local/php-5.6/include/php/Zend -I/usr/local/php-5.6/include/php/ext -I/usr/local/php-5.6/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/APC/apc_cache.c  -fPIC -DPIC -o .libs/apc_cache.o
/tmp/pear/temp/APC/apc_cache.c: In function '_apc_cache_user_update':
/tmp/pear/temp/APC/apc_cache.c:818:63: error: 'IS_CONSTANT_INDEX' undeclared (first use in this function)
/tmp/pear/temp/APC/apc_cache.c:818:63: note: each undeclared identifier is reported only once for each function it appears in
/tmp/pear/temp/APC/apc_cache.c:820:22: error: 'IS_CONSTANT_ARRAY' undeclared (first use in this function)
make: *** [apc_cache.lo] Error 1
ERROR: `make' failed

So I decided to install apcu instead of apc, which has been patched to correct the error. You have to install the beta version of apcu in this way:

pecl install apcu-4.0.6

remember to add "extension=apcu.so" to your php.ini.


Increasing the default file size upload limit

Ownclous comes with a limit of 512MB, which can be unsufficient. Basically you would have to adjust the files .htaccess or .user.ini, but in that case you will get an annoying "integrity check error" in the new 9.0 version. So I suggest not to modify but to act in your php.ini file adding lines like these:

upload_max_filesize = 2G
post_max_size = 2G

Upgrading

NB: I have tested this procedure until the version 8.1.3, both for major and minor releases.

First of all, put your owncloud in maintenance mode modifing your config.php like this:

'maintenance' => true,

Follow the instructions on the official site at http://doc.owncloud.org/server/7.0/admin_manual/maintenance/update.html.

This is what I do after

  • the backup of my database
  • the backup of the data directory (I do this just in case of major release
cd /path/to/your/webserver/document-root
# delete the symbolic link
rm owncloud
wget --no-check-certificate https://download.owncloud.org/community/owncloud-x.x.x.tar.bz2
tar xjf owncloud-x.x.x.tar.bz2
chown -R apache:apache owncloud
mv owncloud owncloud-x.x.x
cd owncloud-x.x.x
# restore from the old dir
cp -rp ../owncloud-old/apps2 .
cd config
mv config.php config.php.BAK
cp -p ../../owncloud-old/config/config.php .
cd ..
chmod +x cron.php
cd ..
# restore the symbolic link
ln -s owncloud-x.x.x owncloud

Now proceed to the upgrade/update from the command line:

cd owncloud
/path/to/php/bin/php occ upgrade

Now you can switch off the maintenance mode and connect to your cloud via web and proceed to the upgrade.

Add a comment

Recent comments
Recent posts

RSS feeds