Category: Synology

Synology DSM: how to renew Let’s Encrypt certificates with just one command

This method has been tested on DS214+ running DSM 6.0.2-8451 Update 9.

Connect to your Synology NAS through SSH as root user

ssh root@ds214

then

/usr/syno/sbin/syno-letsencrypt renew-all -vv

All expired certificates will be immediately renovated

Synology running Owncloud : fix “No memory cache has been configured” error

I have ownCloud running on my Synology DSM6 DS214+.

In the admin configuration page the Security & setup warnings section reports:

No memory cache has been configured. To enhance your performance please configure a memcache if available.
Further information can be found in our documentation.
Please double check the installation guides ↗, and check for any errors or warnings in the log.

How to fix:

Be sure the PHP cache option on Synology is set (Web Station => PHP Settings => Enable PHP Cache).

Edit the configuration file <owncloud_root_dir>/config/config.php adding the following line:

'memcache.local' => '\OC\Memcache\APCu',

Cache feature will start to work immediately

How to Upgrade OwnCloud 9.0 to 9.1 on Synology NAS

This tutorial shows how to upgrade ownCloud 9.0.6 to 9.1.2 on Synology NAS DS214+ DSM6.0.

Connect to your NAS through SSH and get root permission

sudo su

 

1- Disable third party apps

I need to disable Calendar, Contacts and Notes

su - http

Enter the root ownCloud directory

cd owncloud
php -f occ app:disable calendar
php -f occ app:disable contacts
php -f occ app:disable notes

If u get the error

An unhandled exception has been thrown:
exception ‘Doctrine\DBAL\DBALException’ with message ‘Failed to connect to the database: An exception occured in driver: could not find driver’ in /volume1/web/owncloud-9.0.6/lib/private/db/connection.php:54

then use this workaround:

sudo -u http /usr/local/bin/php56 -f occ app:disable calendar
sudo -u http /usr/local/bin/php56 -f occ app:disable contacts
sudo -u http /usr/local/bin/php56 -f occ app:disable notes

 

2- Enter maintenance mode

sudo -u http /usr/local/bin/php56 -f occ maintenance:mode --on

Stop Apache webserver

stop pkg-apache22

 

3- Backup everything

Go back to /volume1/web folder

cd ..

Backup your actual ownCloud root directory (owncloud-9.0.6)

tar -cvf owncloud-9.0.6.backup.tar owncloud-9.0.6

Backup the data directory (owncloud_data) which is separated in my case

tar -cvf owncloud_data.backup.tar owncloud_data

Backup the database manually (owncloud_90) or eventually use phpMyAdmin. By default MariaDB in Synology has login root without password, if a password has been set then add properly the option -p

mysqldump -u root owncloud_90 > owncloud-9.0.6.sql

 

4- Download and deploy Owncloud 9.1

Download new ownCloud package from here https://owncloud.org/changelog

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

We must extract to a new directory otherwise it will rewrite the directory owncloud already in use

mkdir owncloud-9.1.2
tar -xvf owncloud-9.1.2.tar.bz2 -C owncloud-9.1.2 --strip-components=1

 

5- Move configuration and apps

From old config folder copy config.php

sudo cp owncloud-9.0.6/config/config.php owncloud-9.1.2/config/

If you are using third party applications, look in your new owncloud/apps/ directory to see if they are there. If not, copy them from your old apps/ directory to your new one.

Make sure the directory permissions of your third party application directories are the same as for the other ones.

cp -R  owncloud-9.0.6/apps/calendar/ owncloud-9.1.2/apps/
cp -R  owncloud-9.0.6/apps/contacts/ owncloud-9.1.2/apps/
cp -R  owncloud-9.0.6/apps/notes/ owncloud-9.1.2/apps/

 

6- Verify permissions

Verify/change permissions of ownCloud root folder, it should be:

4.0K drwxr-xr-x  14 http root 4.0K Mar  8  2016 <our_owncloud_folder>

then

chmod 755 owncloud-9.1.2/

Verify/change ownerships ownCloud files/folders: on Synology must be http:root

sudo chown -R http:http owncloud-9.1.2/

 

7- Database migration

Start the web server:

sudo start pkg-apache22

Upgrade using occ

cd owncloud-9.1.2
sudo -u http /usr/local/bin/php56 -f occ upgrade

 

8- Restart everything

Renable third party apps

sudo -u http /usr/local/bin/php56 -f occ app:enable calendar
sudo -u http /usr/local/bin/php56 -f occ app:enable contacts
sudo -u http /usr/local/bin/php56 -f occ app:enable notes

Disable maintenance mode

sudo -u http /usr/local/bin/php56 -f occ maintenance:mode --off

Go back to /web directory and update the link

cd ..
rm owncloud
ln -sf owncloud-9.1.2/ owncloud

enjoy your just upgraded personal cloud browsing to

https:/<ip_nas>/owncloud

Check for any app upgrade. Login to ownClound as admin, go to Apps section and check if any update is available.

If any strange behaviour or any HTTPS certificate issue clear the cache of your browser (I had some issues using Firefox)

Remember to delete the backup files.

Synology DSM4.x change OpenVpn Server default port and protocol

The OpenVPN GUI configuration of my DS209 and DS109 has limited options. For instance, it is not possible to change the port and protocol, but we can manually modify its configuration file. My purposes is to change the port from 1194 to 1199 and the protocol from UDP to TCP.

Mainly everything is located here: /usr/syno/etc/packages/VPNCenter/openvpn, there is the configuration file and the keys folder.

Open openvpn.conf and

  • to change the default port add the line “port <n>” where <n> is the port number
  • to change the default protocol UDP to TCP add the line “proto tcp

Here is my configuration:

DS109> cat /usr/syno/etc/packages/VPNCenter/openvpn/openvpn.conf
push "route 192.168.1.0 255.255.255.0"
push "route 10.8.0.0 255.255.255.0"

dev tun

#these two are manually added
port 1199
proto tcp

management 127.0.0.1 1195

server 10.8.0.0 255.255.255.0

dh /var/packages/VPNCenter/target/etc/openvpn/keys/dh1024.pem
ca /var/packages/VPNCenter/target/etc/openvpn/keys/ca.crt
cert /var/packages/VPNCenter/target/etc/openvpn/keys/server.crt
key /var/packages/VPNCenter/target/etc/openvpn/keys/server.key

max-clients 3

persist-tun
persist-key

verb 3

#log-append /var/log/openvpn.log

keepalive 10 60
reneg-sec 0

plugin /var/packages/VPNCenter/target/lib/radiusplugin.so /var/packages/VPNCenter/target/etc/openvpn/radiusplugin.cnf 
client-cert-not-required 
username-as-common-name
duplicate-cn

You can now restart the OpenVPN server using the DSM GUI or manually as follows. Verify where the script openvpn.sh is located, in fact on previous versions of Synology DSMs the command was completely different (VPNCenter.sh)

DS109> find . -name openvpn.sh
./volume1/@appstore/VPNCenter/scripts/openvpn.sh

stop and start again the OpenVpn server

DS109> ./volume1/@appstore/VPNCenter/scripts/openvpn.sh stop
Stopping openvpn ...
Stopping FreeRADIUS: radiusd.

DS109> ./volume1/@appstore/VPNCenter/scripts/openvpn.sh start
Starting FreeRADIUS:radiusd
Starting openvpn ...
Fri Mar 15 12:13:10 2013 RADIUS-PLUGIN: Configfile name: /var/packages/VPNCenter/target/etc/openvpn/radiusplugin.cnf.
DS109> Fri Mar 15 12:13:13 2013 RADIUS-PLUGIN: No attributes Acct Interim Interval or bad length.
Fri Mar 15 12:13:13 2013 RADIUS-PLUGIN: Client config file was not written, overwriteccfiles is false

Enjoy now your VPN

 

WordPress Themes