25-07-2021

This commit is contained in:
2021-07-25 13:17:19 +02:00
parent e02b036875
commit 25789f522b
39 changed files with 2593 additions and 121 deletions

592
docs/Synology/dsm6/dsm6.md Normal file
View File

@@ -0,0 +1,592 @@
# DSM 6
### Dossiers utilisateurs:
```bash
bruno@DS916:~ $ pwd
/var/services/homes/bruno
```
```bash
root@DS916:~# pwd
/root
```
### Se connecter en root:
```bash
bruno@DS916:~ $ sudo -su root
Password:
sh-4.3#
```
```bash
# ok
bruno@DS916:~ $ sudo -i
root@DS916:~#
```
### Taches panifiée:
Exécuter un script par un utilisateur xxx: ici le script cron.php de Nextcloud doit être lancé par http
```bash
sudo -u http /usr/local/bin/php73 -f /volume1/web/nextcloud/cron.php
```
### Services:
#### Afficher la liste des services
```bash
root@DS916:~# synoservicecfg --list
DSM
apparmor
atalk
avahi
bluetoothd
bonjour
btacd
```
#### Gérer les services de DSM
```bash
synoservicecfg --list
synoservice --status
synoservicecfg --stop <service>
synoservicecfg --hard-stop <service>
synoservicecfg --start <service>
synoservicecfg --hard-start <service>
synoservice --restart <service>
synoservicectl --restart <service>
```
#### Redémarrer un service
```bash
/usr/syno/sbin/synoservicecfg -restart syslog-acc
```
### Afficher les logs de connection ssh dans /var/log/message:
- Créer en tant que root le fichier /usr/local/etc/syslog-ng/patterndb.d/sshd.conf comme suit :
```bash
filter f_messages {
level(info..emerg)
and not facility( mail, news, cron)
and not program(syslog-ng)
and not filter(f_local)
and not filter(f_synology);
};
```
- Faire un chmod 644 sur le fichier /usr/local/etc/syslog-ng/patterndb.d/sshd.conf créé.
```bash
DS414> cd /usr/local/etc/syslog-ng/patterndb.d/
-rw-rw-rw- 1 root root 454 Jul 16 19:15 sshd.conf
-rw-r--r-- 1 root root 454 Jul 11 15:15 VideoStation.conf
DS414> chmod 644 sshd.conf
-rw-r--r-- 1 root root 454 Jul 16 19:15 sshd.conf
-rw-r--r-- 1 root root 454 Jul 11 15:15 VideoStation.conf
```
- Relancer le syslog pour prise en compte du fichier (sinon un reboot du NAS) :
```bash
DS414> synoservicecfg --restart syslog-acc
```
### Installer un paquet .deb
```bash
# echec pour un problème de signature
$ sudo dpkg -i nano_2.7.4-1_i386.deb
Password:
Authenticating nano_2.7.4-1_i386.deb ...
debsig: Origin Signature check failed. This deb might not be signed.
dpkg: error processing nano_2.7.4-1_i386.deb (--install):
verification on package nano_2.7.4-1_i386.deb failed!
Errors were encountered while processing:
nano_2.7.4-1_i386.deb
# option --force-bad-verify
$ sudo dpkg -i --force-bad-verify nano_2.7.4-1_amd64.deb
Authenticating nano_2.7.4-1_amd64.deb ...
debsig: Origin Signature check failed. This deb might not be signed.
dpkg: verification on package nano_2.7.4-1_amd64.deb failed; but installing anyway as you requested
Selecting previously unselected package nano.
(Reading database ... 118 files and directories currently installed.)
Unpacking nano (from nano_2.7.4-1_amd64.deb) ...
# supprimer le paquet debsig-verify
$ dpkg --purge dpkg-verify
```
### Installer manuellement un paquet .spk
```bash
$ sudo synopkg install <package.spk>
```
### Apache:
#### Configuration:
Les fichiers .conf se trouvent dans `/usr/local/etc/apache22 `ou `/usr/local/etc/apache24`
Editer le Le fichier de conf principal: `nano /usr/local/etc/apache22/conf/httpd22.conf`
Il est conseillé de faire les modifications dans `/usr/local/etc/apache22/sites-enabled`
#### Logs:
Ils sont dans `/var/log/httpd`
```bash
/var/log/httpd $ ls -la
total 540
drwxr-xr-x 2 root root 4096 Nov 16 03:07 .
drwxr-xr-x 17 root root 4096 Mar 9 01:15 ..
-rw-r--r-- 1 root root 176 Oct 9 10:10 access_log
-rw-rw---- 1 system log 146142 Mar 13 09:50 apache22-error_log
-rw-rw---- 1 system log 58824 Nov 16 02:05 apache22-error_log.1.xz
-rw-rw---- 1 system log 25992 Dec 11 2016 apache22-error_log.2.xz
-rw-rw---- 1 system log 2106 Jan 9 2017 apache24-error_log
-rw-r--r-- 1 root root 363 Oct 9 10:09 error_log
-rw-rw---- 1 system log 283282 Nov 2 2016 user-error_log
```
#### Redémarrer Apache:
`sudo synoservice --restart pkgctl-WebStation`
`sudo synoservice --restart pkgctl-Apache2.2`
service [pkgctl-Apache2.2] restart failed, synoerr=[0x2000]
#### Liste des modules Apache:
```bash
$ httpd22 -M
Loaded Modules:
core_module (static)
mpm_worker_module (static)
...
```
### php7.0
```bash
$ php70 --ini
Configuration File (php.ini) Path: /usr/local/etc/php70
Loaded Configuration File: /usr/local/etc/php70/php.ini
Scan for additional .ini files in: /usr/local/etc/php70/conf.d
Additional .ini files parsed: /usr/local/etc/php70/conf.d/SYNO.SDS.PhotoStation.ini
```
#### open_basedir
`/tmp:/var/services/tmp:/var/services/web:/var/services/homes:/dev/urandom:/volume1/dokuwiki:/volume1/Repositories:/volume1/nextcloud`
#### php.ini
`extension_dir = "/usr/local/lib/php70/modules"`
#### logs
Web Station -> Paramètres PHP-> Paramètres Avancés -> Coeur -> error_log
#### Connaitre les extensions chargées par PHP CLI:
```bash
$ php -m
[PHP Modules]
apcu
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
gd
hash
iconv
json
libxml
mbstring
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
readline
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
```
#### PHP 7.0.13: curl n'est pas activé:
- Ouvrir /volume1/@appstore/PHP7.0/misc/extension_list.json
```bash
root@DS916:/volume1/@appstore/PHP7.0/misc# ls -la
total 24
drwxr-xr-x 1 root root 134 Jan 7 09:08 .
drwxrwxrwx 1 root root 46 Jan 5 17:22 ..
-rw-r--r-- 1 root root 5082 Dec 19 12:20 extension_list.json
-rw-r--r-- 1 root root 5082 Jan 7 09:08 extension_list.json.bak
-rw-r--r-- 1 root root 147 Dec 19 12:20 logrotate.conf
-rw-r--r-- 1 root root 174 Dec 19 12:20 syslog.conf
root@DS916:/volume1/@appstore/PHP7.0/misc# nano extension_list.json
```
- Ajouter
```bash
"curl": {
"enable_default": true,
"desc": "The curl extension allows you to connect and communicate to many different types of servers wih many different types of protocols."
},
```
- Aller dans Web Station → Paramètres PHP → version 7.0
- Cocher, décocher et recocher pour activer l'extension (en appliquant à chaque fois)
[:fa-link: Source](https://forum.synology.com/enu/viewtopic.php?f=20&t=104368&p=464772#p464534)
### Les 3 versions de PHP:
- PHP 5.6 (BusyBox)
/bin/php
- PHP 5.6 (Package PHP 5)
/usr/local/bin/php56
- PHP 7.3 (Package PHP 7)
/usr/local/bin/php73
- PHP 7.4 (Package PHP 7)
/usr/local/bin/php74
Pour Apache, c'est la version choisie dans WebStation qui est active.
<u>En ligne de commande, par défaut, c'est la version Busybox qui est active:</u>
```bash
$ which php
/bin/php
$ /bin/php -v
PHP 7.3.16 (cli) (built: Sep 14 2020 18:32:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies
$ /bin/php --ini
Configuration File (php.ini) Path: /usr/local/etc/php73/cli
Loaded Configuration File: /usr/local/etc/php73/cli/php.ini
Scan for additional .ini files in: /usr/local/etc/php73/cli/conf.d
Additional .ini files parsed: /usr/local/etc/php73/cli/conf.d/extension.ini,
/usr/local/etc/php73/cli/conf.d/timezone.ini
```
Les 2 autres versions sont néanmoins disponibles:
```bash
$ which php70
/usr/local/bin/php70
$ php70 -v
PHP 7.0.33 (cli) (built: Dec 13 2018 12:30:20) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33, Copyright (c) 1999-2017, by Zend Technologies
$ php70 --ini
Configuration File (php.ini) Path: /usr/local/etc/php70
Loaded Configuration File: /usr/local/etc/php70/php.ini
Scan for additional .ini files in: /usr/local/etc/php70/conf.d
Additional .ini files parsed: /usr/local/etc/php70/conf.d/SYNO.SDS.PhotoStation.ini
$ which php72
/usr/local/bin/php72
$ php72 -v
PHP 7.2.29 (cli) (built: Jun 5 2020 14:21:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
$ php72 --ini
Configuration File (php.ini) Path: /usr/local/etc/php72/cli
Loaded Configuration File: /usr/local/etc/php72/cli/php.ini
Scan for additional .ini files in: /usr/local/etc/php72/cli/conf.d
Additional .ini files parsed: /usr/local/etc/php72/cli/conf.d/extension.ini,
/usr/local/etc/php72/cli/conf.d/phpMyAdmin.ini,
/usr/local/etc/php72/cli/conf.d/timezone.ini
$ which php73
/usr/local/bin/php73
$ php73 -v
PHP 7.3.16 (cli) (built: Sep 14 2020 18:32:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies
$ php73 --ini
Configuration File (php.ini) Path: /usr/local/etc/php73/cli
Loaded Configuration File: /usr/local/etc/php73/cli/php.ini
Scan for additional .ini files in: /usr/local/etc/php73/cli/conf.d
Additional .ini files parsed: /usr/local/etc/php73/cli/conf.d/extension.ini,
/usr/local/etc/php73/cli/conf.d/timezone.ini
$ which php74
/usr/local/bin/php74
$ php74 -v
PHP 7.4.9 (cli) (built: Oct 14 2020 15:15:33) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
$ php74 --ini
Configuration File (php.ini) Path: /usr/local/etc/php74/cli
Loaded Configuration File: /usr/local/etc/php74/cli/php.ini
Scan for additional .ini files in: /usr/local/etc/php74/cli/conf.d
Additional .ini files parsed: /usr/local/etc/php74/cli/conf.d/extension.ini,
/usr/local/etc/php74/cli/conf.d/timezone.ini
```
Mettre PHP70 par défaut en CLI:
```bash
# On renomme PHP Busybox
$ cd /bin
$ mv php php_5.6.11
$ ls -la
-rwxr-xr-x 1 root root 6600840 Jun 8 10:31 php_5.6.11
# On crée un lien symbolique
$ cd /usr/local/bin
$ ln -s /var/packages/PHP7.0/target/usr/local/bin/php70 php
$ which php
/usr/local/bin/php
$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php70
Loaded Configuration File: /usr/local/etc/php70/php.ini
Scan for additional .ini files in: /usr/local/etc/php70/conf.d
Additional .ini files parsed: /usr/local/etc/php70/conf.d/SYNO.SDS.PhotoStation.ini
```
### php7.3
Mettre PHP73 par défaut en CLI:
```bash
$ sudo -i
$ cd /usr/bin
$ mv php php56
#cp /volume1/@appstore/PHP7.3/usr/local/bin/php73 php
$ ln -s /volume1/@appstore/PHP7.3/usr/local/bin/php73 php
root@DS916:/bin# php -v
PHP 7.3.16 (cli) (built: Jun 2 2020 11:39:19) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies
bruno@DS916:~ $ php -v
PHP 7.3.16 (cli) (built: Jun 2 2020 11:39:19) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.16, Copyright (c) 1998-2018 Zend Technologies
lrwxrwxrwx 1 root root 45 Sep 17 10:26 php -> /volume1/@appstore/PHP7.3/usr/local/bin/php73
```
```bash
$ find /volume1/@appstore/PHP7.3 -name *.ini
/volume1/@appstore/PHP7.3/etc/php/conf.d/memcached.ini
/volume1/@appstore/PHP7.3/etc/php/conf.d/redis.ini
/volume1/@appstore/PHP7.3/misc/php-fpm.ini
/volume1/@appstore/PHP7.3/usr/local/etc/php73/cli/php.ini
/volume1/@appstore/PHP7.3/usr/local/etc/php73/cli/conf.d/extension.ini
$ find /volume1/@appstore/PHP7.4 -name *.ini
/volume1/@appstore/PHP7.4/etc/php/conf.d/memcached.ini
/volume1/@appstore/PHP7.4/etc/php/conf.d/redis.ini
/volume1/@appstore/PHP7.4/misc/php-fpm.ini
/volume1/@appstore/PHP7.4/usr/local/etc/php74/cli/php.ini
/volume1/@appstore/PHP7.4/usr/local/etc/php74/cli/conf.d/extension.ini
```
### Composer:
<u>Installation:</u>
```bash
root@DS916:/usr/local/bin# curl -s http://getcomposer.org/installer | php70
All settings correct for using Composer
Downloading...
Composer (version 1.6.3) successfully installed to: /usr/local/bin/composer.phar
Use it: php composer.phar
```
<u>Installation des dépendances de l'application (ici Gitlist):</u>
```bash
bruno@DS916:/volume1/web/gitlist $ php70 /usr/local/bin/composer.phar install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 62 installs, 0 updates, 0 removals
- Installing symfony/process (v3.4.6): Downloading (100%)
```
<u>Pour simplifier l'utilisation:</u>
- Créer un script **composer.sh** dans `/usr/local/bin`
- Ajouter le contenu suivant:
```bash
#!/bin/bash
php70 -d extension=phar.so /usr/local/bin/composer.phar $*
```
- Rendre le script exécutable et le renommer:
```bash
$ chmod +X composer.sh
$ mv composer.sh composer
```
- Utilisation:
```bash
$ composer about
Composer - Package Management for PHP
Composer is a dependency manager tracking local dependencies of your projects and libraries.
See https://getcomposer.org/ for more information.
```
- Mise à jour:
```bash
$ sudo composer self-update
You are already using composer version 1.7.1 (stable channel).
```
### Node.js
Utiliser `--unsafe-perm`
```bash
$ sudo npm install -g thumbsup --unsafe-perm
```
ou
```bash
# Erreur EACCES /opt/tmp
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
$ nvm install --lts=fermium
$ npm config set prefix '~/.npm-packages'
$ npm config set tmp '/tmp'
$ npm -g install npm
$ npm -g install thumbsup
```
### Erreurs:
/bin/nano
nano: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
```bash
sudo ln -s /lib/libncurses.so.5.9 /lib/libtinfo.so.5
```
#### Developer guide:
https://help.synology.com/developer-guide/index.html
#### iTunes Server:
[MàJ pour Apple Music](https://supfiles.synology.com/fsdownload/cgMMujWfd/iTunes%20Server%201.5.3-2504%20Patch)

138
docs/Synology/dsm6/gitea.md Normal file
View File

@@ -0,0 +1,138 @@
### Gitea:
#### Créer le paquet:
[Gitea-spk](https://github.com/flipswitchingmonkey/gitea-spk)
##### Installer le paquet:
```bash
cd ~/git/gitea-spk/
sudo synopkg install gitea-1.10.3-linux-amd64.spk
```
Créer un dossier partagé `gitea`, puis éditer les permissions du dossier:
Permissions -> Utilisateurs du système interne -> gitea lecture /écriture
#### Accéder au site:
http://localhost:3000 . Si Safari ne peut y accéder parce que la connexion n'est pas sécurisée (*HSTS Policy*):
1. `command + ,`
2. **Confidentialité** -> **Gérer les données de sites web**...
3. Chercher *localhost*
4. Clic **Supprimer**
DSM -> Portail des applications -> Proxy inversé
| | Source | Destination |
| ---------- | -------------------- | ----------- |
| Protocole | HTTPS | HTTP |
| Nom d'hôte | clicclac.synology.me | localhost |
| Port | 3001 | 3000 |
Apache:
```bash
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
```
Nginx:
```bash
server {
listen 80;
server_name git.example.com;
location / {
proxy_pass http://localhost:3000;
}
}
```
Le fichier de config: `/usr/local/gitea/gitea/custom/conf/app.ini`
`/etc/gitea/app.ini` sur le vps mbv
#### Créer un repo sur sur le serveur gitea:
Il est placé ici: `/volume1/gitea/gitea/gitea-repositories/bruno/test.git`
Sur le client, on clone le repo:
```bash
$ ~/Documents/Git git clone bruno@dsm916e:/volume1/gitea/gitea/gitea-repositories/bruno/test.git
```
git remote add origin bruno@dsm916e:/volume1/Repositories/wp2012.git
#### Mise-à-jour:
```bash
#!/bin/bash
GITEA_INSTALLED=`/volume1/@appstore/Gitea/gitea/gitea --version | cut -d \ -f 3`
LATEST_URL=`curl -Ls -o /dev/null -w %{url_effective} https://github.com/go-gitea/gitea/releases/latest`
#https://github.com/go-gitea/gitea/releases/tag/v1.11.3
echo LATEST_URL = ${LATEST_URL}
GITEA_VERSION=${LATEST_URL##*/v}
if [ "${GITEA_INSTALLED}" == "${GITEA_VERSION}" ]; then
echo "No update available..."
exit 0
fi
#Install
echo "Installed: "${GITEA_INSTALLED}
echo "Latest: "${GITEA_VERSION}
rm -rf /tmp/gitea
mkdir /tmp/gitea
cd /tmp/gitea
echo "Clone gitea-spk..."
git clone https://github.com/flipswitchingmonkey/gitea-spk.git
cd gitea-spk
echo "Download latest gitea..."
DOWNLOAD_URL=https://github.com/go-gitea/gitea/releases/download/v${GITEA_VERSION}/gitea-${GITEA_VERSION}-linux-amd64.xz
#echo ${DOWNLOAD_URL}
# sudo opkg install wget (sinon pas de https)
wget ${DOWNLOAD_URL}
# sudo opkg install xz
xz --decompress gitea-*.xz
# sudo opkg install tar (sinon tar: unrecognized option '--exclude=INFO.in')
echo "Create spk package..."
./create_spk.sh
echo "Install spk package..."
sudo synoservice --stop pkgctl-Gitea
#echo "Backup gitea mysql database..."
#sudo mysqldump -u root admin_gitea > /tmp/$filename
sudo synoservice --status pkgctl-Gitea
sudo synopkg install /tmp/gitea/gitea-spk/gitea-${GITEA_VERSION}-linux-amd64.spk
sudo synoservice --start pkgctl-Gitea
exit 1
```

View File

@@ -0,0 +1,230 @@
# Nextcloud sur NAS Synology
https://docs.nextcloud.com/server/18/admin_manual/index.html
#### Mise à jour 18.0.1 -> 18.0.3
```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 updater/updater.phar
Nextcloud Updater - version: v16.0.3-3-ga0c2b25 dirty
Current version is 18.0.1.
Update to Nextcloud 18.0.3 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-18.0.3.zip
Open changelog ↗
Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Enable maintenance mode
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done
Start update? [y/N] y
Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.
[] Check for expected files
[] Check for write permissions
[] Create backup
[] Downloading
[] Verify integrity
[] Extracting
[] Enable maintenance mode
[] Replace entry points
[] Delete old files
[] Move new files in place
[] Done
Update of code successful.
Should the "occ upgrade" command be executed? [Y/n] Y
This version of Nextcloud requires at least PHP 7.2<br/>You are currently running 5.6.11. Please update your PHP version.
Keep maintenance mode active? [y/N] ^C # Ctrl-C
This version of Nextcloud requires at least PHP 7.2<br/>You are currently running 5.6.11. Please update your PHP version.
Maintenance mode is disabled
```
A *"Should the "occ upgrade" command be executed? [Y/n]"*, répondre Non.
La version par défaut de PHP est la 5.6.11, ce qui est insuffisant (7.2 requis). On relance la suite avec la bonne version de php:
```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ maintenance:mode --on
Password:
The current PHP memory limit is below the recommended value of 512MB.
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Maintenance mode already enabled
```
```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ upgrade
The current PHP memory limit is below the recommended value of 512MB.
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Updated database
Checking for update of app accessibility in appstore
Checked for update of app "accessibility" in appstore
Checking for update of app activity in appstore
Checked for update of app "activity" in appstore
Checking for update of app admin_audit in appstore
Checked for update of app "admin_audit" in appstore
.../...
Checking for update of app viewer in appstore
Checked for update of app "viewer" in appstore
Checking for update of app workflowengine in appstore
Checked for update of app "workflowengine" in appstore
Starting code integrity check...
Finished code integrity check
Update successful
Maintenance mode is kept active
Reset log level
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ maintenance:mode --off
The current PHP memory limit is below the recommended value of 512MB.
Maintenance mode disabled
```
#### Mode maintenance:
```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ maintenance:mode --on
Password:
The current PHP memory limit is below the recommended value of 512MB.
Maintenance mode enabled
```
#### Réparation:
```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ maintenance:repair
Password:
The current PHP memory limit is below the recommended value of 512MB.
Nextcloud is in maintenance mode - no apps have been loaded
- Repair MySQL collation
- All tables already have the correct collation -> nothing to do
- Repair mime types
- Clean tags and favorites
- 0 tags of deleted users have been removed.
- 0 tags for delete files have been removed.
- 0 tag entries for deleted tags have been removed.
- 0 tags with no entries have been removed.
- Repair invalid shares
.../...
```
#### Ajouter les index manquants à la base de donnée:
```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ db:add-missing-indices
The current PHP memory limit is below the recommended value of 512MB.
Check indices of the share table.
Check indices of the filecache table.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Check indices of the cards_properties table.
Check indices of the calendarobjects_props table.
Adding calendarobject_calid_index index to the calendarobjects_props table, this can take some time...
calendarobjects_props table updated successfully.
Check indices of the schedulingobjects table.
Adding schedulobj_principuri_index index to the schedulingobjects table, this can take some time...
schedulingobjects table updated successfully.
```
#### Quitter le mode maintenance:
```bash
bruno@DS916:/volume1/web/nextcloud $ sudo -u http /usr/local/bin/php73 occ maintenance:mode --off
Password:
The current PHP memory limit is below the recommended value of 512MB.
Maintenance mode disabled
```
Ajouter les 2 lignes suivantes au `/usr/local/etc/apache22/sites-enabled/httpd.conf`
```bash
Redirect 301 /.well-known/carddav /nextcloud/remote.php/dav
Redirect 301 /.well-known/caldav /nextcloud/remote.php/dav
```
puis redémarrer Apache:
```bash
$ sudo stop pkg-apache22
pkg-apache22 stop/waiting
$ sudo start pkg-apache22
pkg-apache22 start/running, process 16823
$ reload pkg-apache22
```
#### Exécuter les taches cron de Nextcloud :
<u>Webcron:</u> [cron-job.org](https://cron-job.org/en/)
<u>Planificateur de taches Synology:</u>
Tache planifiée -> script défini par l'utilisateur:
- Utilisateur: root
- Programmer: Quotidienne
- Exécuter la commande: `sudo -u http /usr/local/bin/php73 -f /volume1/web/nextcloud/cron.php`
<u>Crontab:</u>
```bash
$ sudo -i
# Edit /etc/crontab
$ nano /etc/crontab
#minute hour mday month wday who command
49 0 * * 2 root /usr/local/bin/php73 -f /volume1/web/nextcloud/cron.php
49/TAB/0/TAB/*/TAB/*/TAB/2/TAB/root/TAB/commande
#Restart the cron deamon by typing:
$synoservice -restart crond
```
<u>Tester la tache dans le terminal:</u>
```bash
# ok
sudo -u http /usr/local/bin/php73 -f /volume1/web/nextcloud/cron.php
```
[Installer Nextcloud en ligne de commande](../Divers/nextcloud.md)
[Nextcloud sur VPS/Plesk](../Plesk/nextcloud.md)

View File

@@ -0,0 +1,149 @@
### Installation:
#### Télécharger ownCloud Server
[:fa-link:https://owncloud.org/install/#edition](https://owncloud.org/install/#edition)
#### Installer ownCloud Server
[:fa-link:https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#installation-wizard](https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#installation-wizard)
#### Lancer /volume1/web/perm_owc.sh pour corriger toutes les autorisations.
[:fa-link:https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions](https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions)
#### Aller à l'adresse http://192.168.1.7/owncloud/ pour démarrer l'installation.
*Créer un compte administrateur:* bruno / <password>
*Répertoire des données:* /volume1/owncloud/data
*Configurer la base de donnée MySQL/MariaDB:*
- User: root
- Mot de passe de la base: <password>
- Nom de la base de donnée: owncloud
- Hôte: localhost
### Autorisations:
**Dossier owncloud:**
```bash
bruno@DS916:/volume1/web $
drwxr-x— 1 root http 450 Dec 11 10:01 owncloud
```
**et son contenu:**
```bash
root@DS916:/volume1/web/owncloud# ls -la
total 144
drwxr-x--- 1 root http 450 Dec 11 10:01 .
d---------+ 1 root root 408 Dec 11 10:01 ..
drwxr-x--- 1 root http 588 Dec 11 09:58 3rdparty
drwxr-x--- 1 http http 608 Dec 11 09:58 apps
drwxr-x--- 1 http http 0 Dec 11 10:01 assets
-rw-r----- 1 root http 8301 Nov 8 11:53 AUTHORS
drwxr-x--- 1 http http 72 Dec 11 10:02 config
-rw-r----- 1 root http 4134 Nov 8 11:53 console.php
-rw-r----- 1 root http 34520 Nov 8 11:53 COPYING-AGPL
drwxr-x--- 1 root http 332 Dec 11 09:59 core
-rw-r----- 1 root http 5141 Nov 8 11:53 cron.php
-rw-r----- 1 root http 35830 Nov 8 11:53 db_structure.xml
-rw-r--r-- 1 root http 2496 Nov 8 11:53 .htaccess
-rw-r----- 1 root http 179 Nov 8 11:53 index.html
-rw-r----- 1 root http 3062 Nov 8 11:53 index.php
drwxr-x--- 1 root http 58 Dec 11 09:58 l10n
drwxr-x--- 1 root http 94 Dec 11 09:59 lib
-rwxr-x--x 1 root http 283 Nov 8 11:53 occ
drwxr-x--- 1 root http 70 Dec 11 09:58 ocs
drwxr-x--- 1 root http 18 Dec 11 09:59 ocs-provider
-rw-r----- 1 root http 3086 Nov 8 11:53 public.php
-rw-r----- 1 root http 5428 Nov 8 11:53 remote.php
drwxr-x--- 1 root http 34 Dec 11 09:59 resources
-rw-r----- 1 root http 26 Nov 8 11:53 robots.txt
drwxr-x--- 1 root http 288 Dec 11 09:59 settings
-rw-r----- 1 root http 1893 Nov 8 11:53 status.php
drwxr-x--- 1 http http 26 Dec 11 09:58 themes
drwxr-x--- 1 http http 310 Dec 11 09:59 updater
-rw-r----- 1 root http 163 Nov 8 11:53 .user.ini
-rw-r----- 1 root http 233 Nov 8 11:54 version.php
```
**Le dossier config:**
```bash
root@DS916:/volume1/web/owncloud/config# ls -la
total 52
drwxr-x--- 1 http http 100 Dec 11 10:39 .
drwxr-x--- 1 root http 450 Dec 11 10:01 ..
-rw-r----- 1 http http 604 Dec 11 10:18 config.php
-rw-r----- 1 http http 604 Dec 11 10:39 config.php.bak
-rw-r----- 1 http http 40557 Nov 8 11:53 config.sample.php
-rw-r----- 1 http http 225 Nov 8 11:53 .htaccess
```
**Dossier data:**
```bash
bruno@DS916:/volume1 $
drwxrwxrwx+ 1 http http 20 Aug 28 14:28 owncloud
```
```bash
bruno@DS916:/volume1/owncloud $
drwxrwx— 1 http http 146 Dec 11 10:19 data
```
[:fa-link:Setting Strong Directory Permissions](https://doc.owncloud.org/server/9.0/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions)
### Apps:
[:fa-link:https://apps.owncloud.com/](https://apps.owncloud.com/)
- files*mv\* direct*menu
- OwnNote
- OwnBackup
### Redirection http vers https:
Rajouter les 2 lignes suivantes au .htaccess
```bash
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
```
```bash
root@DS916:/volume1/web/owncloud# ls -la
-rw-r--r-- 1 root http 2587 Dec 11 18:52 .htaccess
-rw-r--r-- 1 root http 2496 Dec 11 18:45 .htaccess-bak
root@DS916:/volume1/web/owncloud# nano .htaccess
```
```bash
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteRule ^.well-known/host-meta /public.php?service=host-meta [QSA,L]
RewriteRule ^.well-known/host-meta.json /public.php?service=host-meta-json [QSA,L]
RewriteRule ^.well-known/carddav /remote.php/dav/ [R=301,L]
RewriteRule ^.well-known/caldav /remote.php/dav/ [R=301,L]
RewriteRule ^remote/(.*) remote.php [QSA,L]
RewriteRule ^(?:build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*
RewriteRule ^(?:\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
</IfModule>
```
### Liens
[:fa-link:http://www.iholken.com/index.php/2016/03/15/guide-for-installing-owncloud-9-to-synology-nas-running-dsm-6/](http://www.iholken.com/index.php/2016/03/15/guide-for-installing-owncloud-9-to-synology-nas-running-dsm-6/)

14
docs/Synology/dsm6/php.md Normal file
View File

@@ -0,0 +1,14 @@
# PHP
Synology fournit plusieurs paquets PHP:
- PHP 5.6
- PHP 7.0 (necéssaire pour Photo Station)
- PHP 7.2
- PHP 7.3
- PHP 7.4

View File

@@ -0,0 +1,111 @@
# Installer pip et python 3
DSM 6 fournit Python 2 (2.7.12) dans `/bin/python`
### Installer Python 3:
Il faut installer **python 3** et **pip** depuis <u>iPKGui</u>, soit les paquets:
- python3
- py3-pip
- py3-setuptools
L'installation se fait dans `/opt/bin/`
```bash
$ which python3
/opt/bin/python3
$ which pip3
/opt/bin/pip3
```
Les modules sont ici:
`/volume1/@optware/local/lib/python3.5/site-packages` (pip, setuptools)
### Installer un module (mkdocs):
!!! Pour des problèmes de droit, l'installation se fait avec —user
PermissionError: [Errno 13] Permission denied: '/opt/local/lib/python3.5/site-packages/click-6.7.dist-info'
```bash
$ pip3 install --user mkdocs
$ pip3 install --user klaus
```
Les modules sont installés ici:
`/volume1/homes/bruno/.local/lib/python3.5/site-packages`
L'applicatif est installé ici:
`/volume1/homes/bruno/.local/bin/klaus`
~/.local/lib/python3.5/site-packages/klaus/wsgi.py
### Mettre à jour un module:
```bash
$ pip3 install --user --upgrade setuptools
```
### Erreur à la création d'un environnement virtuel:
```bash
bruno@DS916:~/venv $ python -m venv lychee
Error: Command '['/volume1/homes/bruno/venv/lychee/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
```
Il faut le créer avec l'option `--without-pip`.
```bash
bruno@DS916:~/venv $ python3 -m venv --without-pip letchee
bruno@DS916:~/venv $ source letchee/bin/activate
(letchee) bruno@DS916:~/venv $ curl https://bootstrap.pypa.io/get-pip.py | python3
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1842k 100 1842k 0 0 4757k 0 --:--:-- --:--:-- --:--:-- 4773k
Collecting pip
Downloading pip-20.2.4-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 3.1 MB/s
Collecting setuptools
Downloading setuptools-50.3.2-py3-none-any.whl (785 kB)
|████████████████████████████████| 785 kB 15.3 MB/s
Collecting wheel
Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-20.2.4 setuptools-50.3.2 wheel-0.35.1
(letchee) bruno@DS916:~/venv $ deactivate
bruno@DS916:~/venv $ source letchee/bin/activate
(letchee) bruno@DS916:~/venv $ l
```
```bash
$ grep 'ssh' /var/log/messages
$ tail -n100 /var/log/auth.log
```

View File

@@ -0,0 +1,129 @@
# DSM Services
#### Commandes:
```bash
synoservicecfg --list
synoservice --status
synoservicecfg --stop <service>
synoservicecfg --hard-stop <service>
synoservicecfg --start <service>
synoservicecfg --hard-start <service>
synoservice --restart <service>
synoservicectl --restart <service>
```
#### Services:
```bash
DSM
apparmor
atalk
avahi
bluetoothd
bonjour
btacd
crond
cups-lpd
cupsd
dbus
dc-output
ddns
findhost
ftpd
ftpd-ssl
gcpd
heartbeat
hotplugd
iscsitrg
ldap-server
miniupnpd-handler
natpmpd
nfsd
nginx
nmbd
nslcd
ntpd-client
ntpd-server
pgsql
pkgctl-Apache2.4
pkgctl-AudioStation
pkgctl-CMS
pkgctl-CloudSync
pkgctl-DNSServer
pkgctl-Docker
pkgctl-DownloadStation
pkgctl-FileStation
pkgctl-Git
pkgctl-HyperBackup
pkgctl-Java8
pkgctl-LogCenter
pkgctl-MariaDB
pkgctl-MariaDB10
pkgctl-Node.js_v4
pkgctl-PEAR
pkgctl-PHP5.6
pkgctl-PHP7.0
pkgctl-Plex Media Server
pkgctl-StorageAnalyzer
pkgctl-TextEditor
pkgctl-VPNCenter
pkgctl-WebStation
pkgctl-adminer
pkgctl-domoticz
pkgctl-filebot
pkgctl-filebot-node
pkgctl-git
pkgctl-python
pkgctl-sickrage
pppoerelay
rsyncd
s2s_daemon
samba
scemd
sftp
snmp
ssdp
ssh-shell
support-remote-access
synoagentregisterd
synobackupd
synocacheclient
synocachepinfiletool
synocgid
synoconfd
synocontentextractd
synocrond
synogpoclient
synoindexd
synologrotate
synomkflvd
synomkthumbd
synomount
synoovs-db
synoovs-vswitch
synoperfeventd
synorelayd
synosnmpcd
synostoraged
synotifyd
synotunnel
synovpnclient
synowifid
syslog-acc
syslog-ng
syslog-notify
system
telnetd
tftp
upnpd
ups-net
ups-usb
usbipd
winbindd
```