This is the third post in my “ownCloud series” and the first in a series of posts in “Going the Extra Mile” with your ownCloud instance. The aim here is to share with everyone things that may help you improve your performance, secure your instance, and increase the use case of ownCloud in your environment.




As a reminder, you can find the previous posts here:

Installation and Getting Started guide here:

A walkthrough of the Web UI here:


While we have configured all the basics to install ownCloud and have toured the interface in the previous posts, here we’ll begin going the extra mile. In particular with this post, focusing on configuring “memory cache” on your ownCloud instance.


What is memory cache and why do I need it?

ownCloud has a great post what it is and why it’s needed here:


If you have followed my installation guide post, on the Admin section of your ownCloud you should see a “Security & setup warnings” section at the top, notifying you that  you have no memory cache configured:



Configuring Redis for caching:

While ownCloud supports APC, APCu, Memcached, and Redis, in my view Redis is the best choice for your installation. ownCloud makes the case that Redis, while more complex, is more advanced and is the “recommended option” to configure.

You should do your own research on the differences between all the caching options and make your decision. In this post we’ll go in favor of, the best option in my opinion, Redis.

Redis is, to quote the official site, “An open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker.”

You can learn more about Redis here:


You can find an excellent post on configuring Redis on Ubuntu 14.04 at the link below by Daniel Hansson. Please visit his site and donate if you can. I donated before posting this to say thanks. I will be using his guide with screenshots of the setup.

Daniel – if you happen to read this, many thanks for your efforts on documenting the Redis setup.

This guide was written with the same intent of many of my posts; that is to share some specific knowledge with the world, but also to serve as an archive for personal reference later. I had a few places where I made some minor changes to the setup.


Let’s begin the process of configuring Redis on your server.

Remove APC and Memcached:

# sudo php5dismod apcu && sudo apt-get purge php5-apcu -y




# rm /etc/php5/mods-available/apcu-cli.ini




# sudo apt-get purge --auto-remove memcached -y && php5dismod memcached





# sudo apt-get update && sudo apt-get install build-essential -y






TCL for testing:

# sudo apt-get install tcl8.5 -y





# wget && tar xzf redis-stable.tar.gz
# sudo mv redis-stable redis




Run make and test:

# cd redis && sudo make && taskset -c 1 make test


You should see this:


If you see any errors, reboot your VM and try again. This was my experience in 2 of 3 installations.

If test is fine, proceed:

# sudo make install




# cd utils && sudo ./



Keeping the default settings is fine. After installing, check the version:

# redis-server -v




Next you need to install phpmodule for ownCloud:

# sudo apt-get install php-pear php5-dev




# sudo pecl install -Z redis





Notice the last line, we’ll do this. Create redis.ini extension:

# sudo touch /etc/php5/mods-available/redis.ini


In the blog post he says to do this, but it still gives permissions error:

# sudo echo '' && /etc/php5/mods-available/redis.ini


I simply edited the file with nano:

# sudo nano /etc/php5/mods-available/redis.ini






Enable module (added the second sudo not in post otherwise it fail):

# sudo php5enmod redis && sudo service apache2 restart




Test module version:

# php --ri redis




Lastly, we reconfigure owncloud config file:

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

Add this to the config:

'memcache.local' = '\\OC\\Memcache\\Redis',
'filelocking.enabled' = 'true',
'memcache.distributed' = '\\OC\\Memcache\\Redis',
'memcache.locking' = '\\OC\\Memcache\\Redis',
'redis' =
array (
'host' = 'localhost',
'port' = 6379,
'timeout' = 0,
'dbindex' = 0,

Below is a look at the config files, before and after:



At this point we can now confirm, within ownCloud with another before and after:







All the checks passed! That’s it for configuring your memory caching. In the next post, I’ll show you how to configure OpenVPN on your server, and securely sync you data via VPN from your PC and mobile devices!

If this posting has helped you or you have any questions or comments, please leave them below. Thanks for reading.

%d bloggers like this: