du

Welcome

Menu Close

A Complete Guide – Installation of Nextcloud on Ubuntu 16.04

Nextcloud is a dropbox like cloud service which is run on your private server. Best side of this project is being open source.  There are detail information and well document on their official sites. So, I wont keep long introduction of this post. Let’s begin to installation.

I will put some links for initial setup here. Then we will make some configuration for smooth cloud experience.

Initial Setup

        Nextcloud installation is required LAMP server and An SSL certificate. So, there is a digitalocean document for initial setup and I think it is the best one of out-here.

When you finish this setup there will be a almost ready to go cloud server. But, still need some fine adjustment for best experience.

Admin Panel and Warnings

We will walk through all these warnings step by step.

1. HTTPS Warning

You are accessing this site via HTTP. We strongly suggest you configure your server to require using HTTPS instead as described in our security tips.

First and the most critical warning will be about HTTPS connection. When you will get your certificate via letsencrypt certbot the warning will vanish. Again this digitalocean document will help you about that. There are simple few steps.

2. “Strict-Transport-Security”

“The “Strict-Transport-Security” HTTP header is not configured to least “15552000” seconds. For enhanced security we recommend enabling HSTS as described in our security tips.”

This warning is about harden security. We will add this <if module> block  after to our virtual host file.

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

After all out virtual host look something like that:

3. MEMORY CACHE

No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our documentation.

This one is about performance tuning. Our service can run faster than it is initial state. Therefore, we will solve this with redis which is a in memory cache software solution. It is also an open source project.

We should install redis and configure it properly. So, we will benefir from a digitalocean document, again. This redis installation document is very well prepared.

If you finish install redis then we will configure it for our nextcloud. First, we will install php-redis extension

sudo apt install php-redis

Check if extension enabled

php --ri redis

Our redis extension version is 2.2.8 so it is fit to nextcloud requirement(2.2.5+). We can enable redis configuration by

sudo phpenmod redis

or just the restart apache

sudo systemctl restart apache2

and we have one final step, edit nextcloud configuration file

sudo nano /var/www/nextcloud/config/config.php

add this lines above the ); line

'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.local' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
     'host' => 'localhost',
     'port' => 6379,
     ),
 and all done. We can connect our cloud faster than before.

4. PHP OPcache CONFIGURATION

  • The PHP OPcache is not properly configured. For better performance we recommend to use following settings in the php.ini:
    opcache.enable=1
    opcache.enable_cli=1
    opcache.interned_strings_buffer=8
    opcache.max_accelerated_files=10000
    opcache.memory_consumption=128
    opcache.save_comments=1
    opcache.revalidate_freq=1

Please double check the installation guides , and check for any errors or warnings in the log.

 Actually this warning is pretty clear, It says we should enable Php Opcache and make some configuration. Let’s do this with
sudo nano /etc/php/7.0/apache2/php.ini

 It is a long configuration file you can go tho [dba] section in file and make your tuning.

5.All checks passed.

Let’s check again our admin panel in nextcloud

If you see this message then you ready to go.

Finally, we have well configured, fast and most importantly private cloud service in our private server.

I hope you get no problem during the process, but if you do then please feel free to ask question. Also, you comments are welcomed.

 

© 2017 du. All rights reserved.