1er commit

De la docs au format Mkdocs
This commit is contained in:
2018-09-16 14:48:15 +02:00
commit e82296ba06
140 changed files with 17082 additions and 0 deletions

BIN
docs/Synology/.DS_Store vendored Normal file

Binary file not shown.

81
docs/Synology/bash.md Normal file
View File

@@ -0,0 +1,81 @@
# Bash
### Installer le shell Bash:
Se connecter sous root
```bash
ssh root@192.168.0.8
```
Installer le package **Bash** avec **ipkg**
```bash
DiskStation$> ipkg install -A bash
```
------
Pour avoir bash au log-in, il faut éditer le fichier **/etc/passwd**
```bash
DiskStation$> nano /etc/passwd
```
et remplacer la ligne
```bash
root:x:0:0:root:/root:/bin/ash
```
par
```bash
root:x:0:0:root:/root:/bin/bash
```
!!! attention "Attention, une m-à-j Synology peut supprimer /opt/bin/bash."
Aussi, il est préférable de garder ash pour se logger et de démarrer bash ensuite.
On va éditer le fichier .profile
```bash
DiskStation$> nano .profile
```
et y ajouter les lignes suivantes:
```bash
if [[ -x /opt/bin/bash ]]; then
exec /opt/bin/bash
fi
```
------
Pour configurer bash, on va créer un fichier .bashrc
```bash
DiskStation$> nano .bashrc
```
et y ajouter
```bash
#prompt
PS1='\u@\h:\w \$ '
#renseigne la variable SHELL
export SHELL=/opt/bin/bash
```
!!! attention "Il est préférable de se logger une première fois avec en root avec ash et de faire la manip dans une 2nde fenêtre."
[http://tldp.org/LDP/abs/html/index.html](http://tldp.org/LDP/abs/html/index.html)

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

@@ -0,0 +1,440 @@
# 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
bruno@DS916:~ $ sudo -i
root@DS916:~#
```
### 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
```
### Apache:
#### Configuration:
Les fichiers .conf se trouvent dans `/usr/local/etc/apache22 `ou `/usr/local/etc/apache24`
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:
`synoservice --restart pkgctl-WebStation`
`synoservice --restart pkgctl-Apache2.2`
service [pkgctl-Apache2.2] restart failed, synoerr=[0x2000]
### 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.0 (Package PHP 7)
/usr/local/bin/php70
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
$ php -v
PHP 5.6.11 (cli) (built: Jun 8 2018 15:13:30)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
$ php --ini
Configuration File (php.ini) Path: /etc/php
Loaded Configuration File: /etc/php/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
```
Les 2 autres versions sont néanmoins disponibles:
```bash
$ which php56
/usr/local/bin/php56
$ php56 -v
PHP 5.6.36 (cli) (built: May 2 2018 16:13:10)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
$ php56 --ini
Configuration File (php.ini) Path: /usr/local/etc/php56
Loaded Configuration File: /usr/local/etc/php56/php.ini
Scan for additional .ini files in: /usr/local/etc/php56/conf.d
Additional .ini files parsed: /usr/local/etc/php56/conf.d/phpMyAdmin.ini,
/usr/local/etc/php56/conf.d/webstation-extensions.ini
$ which php70
/usr/local/bin/php70
$ php70 -v
PHP 7.0.30 (cli) (built: May 2 2018 16:29:25) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.30, 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
```
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
```
### 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).
```
### 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
```

17
docs/Synology/eadir.md Normal file
View File

@@ -0,0 +1,17 @@
# Trouver et supprimer les répertoires @eaDir
### Désactiver les services qui créent ces dossiers:
Se connecter sous root en ssh, puis:
```bash
chmod 000 S66fileindexd.sh S66synoindexd.sh S77synomkthumbd.sh S88synomkflvd.sh S99iTunes.sh
```
### Supprimer les répertoires @eaDir existants:
Toujours en ssh, se placer dans le répertoire racine, puis:
```bash
find . -type d -name "@eaDir" -print0 | xargs -0 rm -rf
```

31
docs/Synology/index.md Normal file
View File

@@ -0,0 +1,31 @@
# Synology
[Installer ipkg et ses packages (DSM5)](opkg/iPKG5.md)
[Installer ipkg et ses packages (DSM6)](opkg/iPKG6.md)
[Installer oPKG](opkg/oPKG.md) (Entware)
[Installer le shell bash](bash.md)
Installer ownCloud (depuis paquet)
[Installer ownCloud (depuis archive) (DSM6)](owncloud.md)
[Dossiers @eaDir](eadir.md)
[DSM 6](dsm6.md)
[Scripts](scripts.md)
#### Liens:
[DS916+ Guide d'installation rapide](syno_qig_ds916_fra.pdf)
[DS414 Guide d'installation rapide](syno_qig_4bay_fra.pdf)
[DSM 6.1 Guide de l'utilisateur](syno_usersguide_naserver_fra.pdf)
[:fa-link: Support Synology](https://www.synology.com/fr-fr/support)

View File

@@ -0,0 +1,83 @@
# iPKG (DSM 5)
### Installer iPKG:
Se connecter sous root
```bash
ssh root@192.168.0.8
```
Télécharger et installer le bootstrap
```bash
DiskStation> wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/syno-mvkw-bootstrap_1.2-7_arm.xsh
DiskStation> chmod 700 syno-mvkw-bootstrap_1.2-7_arm.xsh
DiskStation> sh syno-mvkw-bootstrap_1.2-7_arm.xsh
DiskStation> vi bootstrap.sh #https://github.com/basmussen/ds414-boostrap-dsm5
DiskStation> sh bootstrap.sh
DiskStation> reboot
DiskStation> /opt/bin/ipkg update
DiskStation> /opt/bin/ipkg list
DiskStation> /opt/bin/ipkg install pkg
```
Nettoyer le dossier /root/ ([:fa-link:http://objnux.1s.fr/index.php?post/2009/11/25/IPKG-sur-SYNOLOGY-ds107](http://objnux.1s.fr/index.php?post/2009/11/25/IPKG-sur-SYNOLOGY-ds107))
```bash
DiskStation> rm syno*.*
DiskStation> rm -Rf bootstrap
```
### Mettre à jour iPKG:
Se connecter sous root
```bash
ssh root@192.168.0.8
```
Mettre à jour les paquets installés
```bash
DiskStation> /opt/bin/ipkg update
DiskStation> /opt/bin/ipkg upgrade
```
### Désinstaller iPKG:
```bash
rm -rf /volume1/@optware
rm -rf /usr/lib/ipkg
```
### Rajouter /opt/bin dans le PATH
```bash
DiskStation> cd /root
DiskStation> /opt/bin/nano .profile
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/opt/bin
```
### Configuration de nail:
Editer le fichier /opt/etc/nail.rc:
```bash
set from="bruno@funnymac.com"
set smtp=smtp://smtp.funnymac.com
#set smtp-use-starttls
set smtp-auth=login
set smtp-auth-user=postmaster%funnymac.com
set smtp-auth-password=dt7ek7wA
set ssl-verify=ignore
```

145
docs/Synology/opkg/iPKG6.md Normal file
View File

@@ -0,0 +1,145 @@
# iPKG (DSM 6)
### Installer iPKG:
Se connecter en root:
```bash
ssh bruno@192.168.1.7
#puis
bruno@DS916:~ $ sudo -i
root@DS916:~#
```
Télécharger et installer le bootstrap correspondant au processeur du NAS.
Pour le DS414 → MARVELL Armada XP MV78230 → processeur ARM v7 avec FPU → ARMv7 EABI hardfloat
Pour le DS916 → INTEL Pentium N3710
[Optware-ng](https://github.com/Optware/Optware-ng)
```bash
DiskStation> cd /volume1/@tmp
# DS414
DiskStation> wget -O - http://ipkg.nslu2-linux.org/optware-ng/bootstrap/buildroot-armeabihf-bootstrap.sh | sh
# DS916
DiskStation> wget -O - http://ipkg.nslu2-linux.org/optware-ng/bootstrap/buildroot-i686-bootstrap.sh | sh
DiskStation> chmod +x buildroot-armeabihf-bootstrap.sh
DiskStation> sh buildroot-armeabihf-bootstrap.sh
```
```bash
./data.tar.gz
./
./opt/
./opt/bin/
./opt/bin/ipkg-static
./opt/bin/ipkg
./opt/bin/update-alternatives
./opt/var/
./opt/var/lock/
./opt/share/
./opt/share/man/
./opt/share/man/man1/
./opt/share/man/man1/opkg-cl.1
./opt/share/opkg/
./opt/share/opkg/intercept/
./opt/share/opkg/intercept/update-modules
./opt/share/opkg/intercept/depmod
./opt/share/opkg/intercept/ldconfig
./opt/etc/
./opt/etc/ipkg/
./opt/etc/ipkg/ipkg.conf
./opt/etc/ipkg.conf
Bootstraping done
Installing glibc-locale package to generate needed /opt/lib/locale/locale-archive
```
Une fois l'installation terminée, mettre à jour la liste des packages
```
DiskStation> /opt/bin/ipkg update
```
### Nettoyer le dossier d'installation:
```bash
DiskStation> cd /volume1/@tmp
DiskStation> rm buildroot-armeabihf-bootstrap.sh
```
### Principales commandes
Afficher la liste des packages
```bash
DiskStation> /opt/bin/ipkg list
```
Afficher la liste des packages installés
```bash
DiskStation> /opt/bin/ipkg list-installed
```
Installer une application
```bash
DiskStation> /opt/bin/ipkg install pkg
```
Mettre à jour les packages
```bash
DiskStation> /opt/bin/ipkg upgrade
```
Supprimer un package
```bash
DiskStation> /opt/bin/ipkg remove pkg
```
### Mettre à jour iPKG:
Se connecter sous un compte admin
```bash
ssh bruno@192.168.0.8
```
Mettre à jour les paquets installés
```bash
DiskStation> /opt/bin/ipkg update
DiskStation> /opt/bin/ipkg upgrade
```
### Désinstaller iPKG:
```bash
rm -rf /volume1/@optware
rm -rf /usr/lib/ipkg
```
### Rajouter /opt/bin dans le PATH:
```bash
DiskStation> cd /root
DiskStation> /opt/bin/nano .profile
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin:/opt/bin
```

273
docs/Synology/opkg/oPKG.md Normal file
View File

@@ -0,0 +1,273 @@
# opkg (Entware)
https://github.com/Entware/Entware/wiki
### Installer oPKG:
Se connecter en root:
```bash
ssh bruno@192.168.1.7
#puis
bruno@DS916:~ $ sudo -i
root@DS916:~#
```
Créer un dossier sur le disque:
```bash
mkdir -p /volume1/@Entware/opt
```
Supprimer le dossier /opt et monter le dossier optware
```bash
rm -rf /opt
mkdir /opt
mount -o bind "/volume1/@Entware/opt" /opt
```
Lancer le script d'installation:
- for armv7 (DS414)
```bash
wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | /bin/sh
```
- for x64 (DS916)
```bash
wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
```
Créer une tâche de démarrage:
DSM -> Panneau de configuration -> Planificateur de tâche -> Créer une tâche déclenchée
- Tâche: Entware
- Utilisateur: root
- Evènement: Démarrage
- Paramètres de tâche -> Exécuter la commande:
```bash
#!/bin/sh
# Mount/Start Entware
mkdir -p /opt
mount -o bind "/volume1/@Entware/opt" /opt
/opt/etc/init.d/rc.unslung start
# Add Entware Profile in Global Profile
if grep -qF '/opt/etc/profile' /etc/profile; then
echo "Confirmed: Entware Profile in Global Profile"
else
echo "Adding: Entware Profile in Global Profile"
cat >> /etc/profile <<"EOF"
# Load Entware Profile
. /opt/etc/profile
EOF
fi
# Update Entware List
/opt/bin/opkg update
```
Redémarrer le NAS
Ajouter `/opt/bin & /opt/sbin` à la variable $PATH
### Utiliser oPKG
Se connecter sous un compte admin:
```bash
ssh bruno@192.168.0.8
```
##### Mettre à jour la liste des paquets:
```bash
bruno@DS916:~ $ sudo opkg update
Password:
Downloading http://bin.entware.net/x64-k3.2/Packages.gz
Updated list of available packages in /opt/var/opkg-lists/entware
```
##### Mettre à jour tous les paquets:
```bash
bruno@DS916:~ $ sudo opkg upgrade
```
##### Installer un paquet:
```bash
bruno@DS916:~ $ sudo opkg install ffmpeg
Password:
Installing ffmpeg (3.2.10-3) to root...
Downloading http://bin.entware.net/x64-k3.2/ffmpeg_3.2.10-3_x64-3.2.ipk
```
##### Supprimer un paquet:
```bash
bruno@DS916:~ $ sudo opkg remove <paquet>
```
##### Marquer un paquet:
```bash
bruno@DS916:~ $ sudo opkg flag <flag><paquet>
```
##### Liste des paquets disponibles:
```bash
bruno@DS916:~ $ sudo opkg list [paquet]
```
http://bin.entware.net/armv7sf-k3.2/Packages.html
##### Liste des paquets installés:
```bash
bruno@DS916:~ $ sudo opkg list-installed
alsa-lib - 1.1.5-1
entware-opt - 227000-3
entware-release - 1.0-2
entware-upgrade - 1.0-1
...
```
##### Liste des mises-à-jour de paquets disponibles:
```bash
bruno@DS916:~ $ sudo opkg list-upgradable
```
##### Liste des fichiers d'un paquet:
```bash
bruno@DS916:~ $ sudo opkg files nano
Package nano (2.9.6-1) is installed on root and has the following files:
/opt/share/nano/texinfo.nanorc
/opt/share/nano/po.nanorc
...
```
##### Chercher un paquet:
```bash
bruno@DS916:~ $ sudo opkg search <paquet> ???
```
##### Afficher les infos sur un paquet:
```bash
bruno@DS916:~ $ sudo opkg info vim
Package: vim
Version: 8.0.586-2
Depends: libc, libssp, librt, libpthread, libncurses
Status: unknown ok not-installed
Section: utils
Architecture: x64-3.2
MD5Sum: 49db8c4294e7edd8236eb2609dfd4527
Size: 350167
Filename: vim_8.0.586-2_x64-3.2.ipk
Description: Vim is an almost compatible version of the UNIX editor Vi.
(Tiny build)
```
##### Status d'un paquet:
```bash
bruno@DS916:~ $ sudo opkg status nano
Package: nano
Version: 2.9.6-1
Depends: libc, libssp, librt, libpthread, libncursesw, zlib, file
Status: install user installed
Architecture: x64-3.2
Conffiles:
/opt/etc/nanorc ff3c86182093564e3313eeaa0eb367cb092c4bd838128bda02a91dd5e3017e63
Installed-Time: 1536489744
```
##### Options:
-V --verbosity <niveau> mode bavard
-A tous les paquets (pas seulement ceux installés)
https://wiki.openwrt.org/doc/techref/opkg
### Ne plus rentrer de mot-de-passe pour opkg:
```bash
bruno@DS916:~ $ cd kymsu/
-rwx------ 1 bruno users 1078 Sep 11 18:45 kymsu2.sh
-drwxr-xr-x 1 bruno users 30 Sep 12 16:39 plugins.d
```
Créer un fichier de config sudo pour l'utilisateur dans `sudoers.d` (apparemment, pas la peine de décommenter la ligne `#includedir /etc/sudoers.d` dans `sudoers`)
```bash
root@DS916:/etc/sudoers.d# ls -la
total 12
drwxr-x--- 2 root root 4096 Sep 12 20:08 .
drwxr-xr-x 48 root root 4096 Sep 10 17:07 ..
-r--r----- 1 root root 68 Sep 12 20:34 bruno
root@DS916:/etc/sudoers.d# nano bruno
```
```bash
bruno ALL=(ALL) NOPASSWD:/var/services/homes/bruno/kymsu/kymsu2.sh
```
Permet à l'utilisateur bruno de lancer le script kymsu2.sh avec sudo mais sans mot de passe.
Pas besoin de redémarrer.
Au prochain lancement du script par la commande sudo, le mot-de-passe n'est plus demandé:
```bash
bruno@DS916:~/kymsu $ sudo ./kymsu2.sh
📦 oPKG
Downloading http://bin.entware.net/x64-k3.2/Packages.gz
Updated list of available packages in /opt/var/opkg-lists/entware
No availables updates.
```
Pour cette commande (passage à root), le mot-de-pass est bien demandé pour la commande sudo:
```bash
bruno@DS916:~/kymsu $ sudo -i
Password:
```
Exécuter kymsu2.sh à distance:
```bash
bruno@silverbook:~$ ssh dsm916 ./kymsu/kymsu2.sh
```

149
docs/Synology/owncloud.md Normal file
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/)

64
docs/Synology/python.md Normal file
View File

@@ -0,0 +1,64 @@
# 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
```

24
docs/Synology/scripts.md Normal file
View File

@@ -0,0 +1,24 @@
# FFmpeg
[:fa-link: Doc](http://ffmpeg.org/ffmpeg.html#Options)
[:fa-link: Encode AAC](https://trac.ffmpeg.org/wiki/Encode/AAC)
#### Copier un fichier sur le NAS
```bash
$ scp -P42666 wsgi.py bruno@192.168.1.7:/var/services/homes/bruno/scripts/
$ scp -P42666 httpd_vhost.conf bruno@clicclac.synology.me:/var/services/homes/bruno/
```
#### Réception d'un fichier depuis le NAS
```bash
$ scp -P42666 bruno@clicclac.synology.me:/var/services/homes/bruno/httpd-vhost.conf /Users/bruno/Desktop
```

Binary file not shown.

Binary file not shown.

Binary file not shown.