- KVM Debian Buster
- Migration serveur
- Yunohost yanfi.space
- Applications Restaurées (Borg)
- Fin restauration
- Applications Installées
- Sauvegardes Borg + Synchronisations
Yunohost réinstallé à partir d’une sauvegarde borg.
Pour une installation complète ,voir HostMyServers, server32771 Debian 10 (HDD 250Go) - yunohost INSTALLATION
https://www.hostmyservers.fr/
Accès client
KVM Debian Buster
Virtualization Type (KVM)
CPU 2
Memory 4 GB
Disk Space 250 Go
Operating System Debian 10 Buster (64-bit)
server32771
IPv4 Address 45.145.166.178
IPv6 Address 2a04:ecc0:8:a8:4567:4989::1
Connexion root
ssh root@45.145.166.178
Mise à jour
apt update && apt upgrade
Europe/Paris
dpkg-reconfigure tzdata
Current default time zone: 'Europe/Paris'
Local time is now: Wed Oct 6 09:07:40 CEST 2021.
Universal Time is now: Wed Oct 6 07:07:40 UTC 2021.
Désactiver init réseau cloud
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
echo "{config: disabled}" > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
Recréer interface réseau
cat > /etc/network/interfaces << EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 45.145.166.178/24
gateway 45.145.166.1
# control-alias eth0
iface eth0 inet6 static
address 2a04:ecc0:8:a8:4567:4989::1/64
gateway 2a04:ecc0:8:a8::1
EOF
Redémarrer le serveur , se connecter et vérifier le réseau
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether ce:5d:61:05:e9:45 brd ff:ff:ff:ff:ff:ff
inet 45.145.166.178/24 brd 45.145.166.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 2a04:ecc0:8:a8:4567:4989:0:1/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::cc5d:61ff:fe05:e945/64 scope link
valid_lft forever preferred_lft forever
Migration serveur
- Ancien serveur : Hertzner cx21 IPV4 95.216.222.127
- Nouveau serveur : Hms server32771 IPV4 45.145.166.178
1 - Installer yunohost
Installer yunohost sur le nouveau serveur
Pré-requis
- Un serveur dédié ou virtuel avec Debian 10 (Buster) pré-installé (avec un kernel >= 3.12), avec au moins 512Mo de RAM et 16Go de capacité de stockage ;
- Un ordinateur ou un smartphone pour lire ce guide et accéder à votre serveur.
- Installer curl :
apt install curl
Ouvrir la ligne de commande sur le serveur et lancer
curl https://install.yunohost.org | bash
[INFO] Installation logs are available in /var/log/yunohost-installation_20211001_191518.log
[ OK ] YunoHost installation completed !
===============================================================================
You should now proceed with Yunohost post-installation. This is where you will
be asked for :
- the main domain of your server ;
- the administration password.
You can perform this step :
- from the command line, by running 'yunohost tools postinstall' as root
- or from your web browser, by accessing :
- https://45.145.166.178/ (global IP, if you're on a VPS)
If this is your first time with YunoHost, it is strongly recommended to take
time to read the administator documentation and in particular the sections
'Finalizing your setup' and 'Getting to know YunoHost'. It is available at
the following URL : https://yunohost.org/admindoc
===============================================================================
2 - Post-installation
Vous devez faire la post-installation pour configurer l’application Borg.
yunohost tools postinstall
Main domain: yanfi.space
[...]
Warning: The ssh configuration has been manually modified, but you need to explicitly specify category 'ssh' with --force to actually apply the changes.
Success! YunoHost is now configured
Warning: The post-install completed! To finalize your setup, please consider:
- adding a first user through the 'Users' section of the webadmin (or 'yunohost user create <username>' in command-line);
- diagnose potential issues through the 'Diagnosis' section of the webadmin (or 'yunohost diagnosis run' in command-line);
- reading the 'Finalizing your setup' and 'Getting to know Yunohost' parts in the admin documentation: https://yunohost.org/admindoc.
Le mot de passe root remplacé par celui de l’admin yunohost
Motd
rm /etc/motd && nano /etc/motd
_____ ____ _____ _____ _
___ ___ _ __ __ __ ___ _ __|___ /|___ \|___ ||___ |/ |
/ __| / _ \| '__|\ \ / // _ \| '__| |_ \ __) | / / / / | |
\__ \| __/| | \ V /| __/| | ___) |/ __/ / / / / | |
|___/ \___||_| \_/ \___||_| |____/|_____|/_/ /_/ |_|
_ _ ____ _ _ _ ____ _ __ __ _ _____ ___
| || | | ___| / || || | | ___| / | / /_ / /_ / ||___ |( _ )
| || |_|___ \ | || || |_|___ \ | || '_ \ | '_ \ | | / / / _ \
|__ _|___) |_ | ||__ _|___) |_ | || (_) || (_) |_ | | / / | (_) |
|_| |____/(_)|_| |_| |____/(_)|_| \___/ \___/(_)|_| /_/ \___/
__ _
_ _ __ _ _ __ / _|(_) ___ _ __ __ _ ___ ___
| | | | / _` || '_ \ | |_ | | / __|| '_ \ / _` | / __|/ _ \
| |_| || (_| || | | || _|| | _ \__ \| |_) || (_| || (__| __/
\__, | \__,_||_| |_||_| |_|(_)|___/| .__/ \__,_| \___|\___|
|___/ |_|
3 - Utilisateur yann
Création utilisateur yann
yunohost user create yann
First name: yann
Last name: space
Password:
Confirm password:
Available domains:
- yanfi.space
Domain to use for the user's email address and XMPP account (default: yanfi.space):
Success! User created
fullname: yann space
mail: yann@yanfi.space
username: yann
4 - Modifier les DNS OVH
Il faut changer les adresses IP V4 et V6 sur les domaines concernées
yanfi.space (main)
$TTL 3600
@ IN SOA dns113.ovh.net. tech.ovh.net. (2021040101 86400 3600 3600000 60)
IN NS dns113.ovh.net.
IN NS ns113.ovh.net.
IN MX 10 yanfi.space.
IN A 45.145.166.178
IN AAAA 2a04:ecc0:8:a8:4567:4989::1
IN CAA 128 issue "letsencrypt.org"
IN TXT "v=spf1 a mx -all"
* IN A 45.145.166.178
* IN AAAA 2a04:ecc0:8:a8:4567:4989::1
_dmarc IN TXT "v=DMARC1; p=none"
_xmpp-client._tcp IN SRV 0 5 5222 yanfi.space.
_xmpp-server._tcp IN SRV 0 5 5269 yanfi.space.
mail._domainkey IN TXT ( "v=DKIM1; h=sha256; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDM7ja2oZ0efNg8WWoRY82kneRiJOciFAgyBfaDpNzRQdaphq082256m6Ol9tWEqCjWakO5nmvP03s+zw53lZoUfZyY4FE58AAesHszSyvVYhCz7uSfEijD4snvIYSqkuFvRNLv2WCYPQFelx9VPl5095f+8X0Y8dx4H2TvGGqsUQIDAQAB" )
muc IN CNAME yanfi.space.
pubsub IN CNAME yanfi.space.
vjud IN CNAME yanfi.space.
xmpp-upload IN CNAME yanfi.space.
cinay.eu
$TTL 3600
@ IN SOA dns100.ovh.net. tech.ovh.net. (2021090800 86400 3600 3600000 300)
IN NS dns100.ovh.net.
IN NS ns100.ovh.net.
IN MX 10 cinay.eu.
IN A 45.145.166.178
IN AAAA 2a04:ecc0:8:a8:4567:4989::1
IN CAA 128 issue "letsencrypt.org"
IN TXT "v=spf1 a mx -all"
* IN A 45.145.166.178
* IN AAAA 2a04:ecc0:8:a8:4567:4989::1
_dmarc IN TXT "v=DMARC1; p=none"
_xmpp-client._tcp IN SRV 0 5 5222 cinay.eu.
_xmpp-server._tcp IN SRV 0 5 5269 cinay.eu.
mail._domainkey IN TXT ( "v=DKIM1; h=sha256; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDn4KD67wSLqb4ACbBdFniSYnPkbNHAjCdah4fYFuyVkefSW5lZjmwPiZ26GJpf1gBT4/kUc5XtRdXosCDJuGsmfq0JwA7813Gmn00wNIuOGQ5WglGSvpm73iVomF/psI/+ElbA0TX0T8babIciq+jdA7g4ZhJ/zUX93oAAOoqaOQIDAQAB" )
muc IN CNAME cinay.eu.
pubsub IN CNAME cinay.eu.
static IN CNAME cinay.eu.
vjud IN CNAME cinay.eu.
xmpp-upload IN CNAME cinay.eu.
yanfi.net
$TTL 3600
@ IN SOA dns110.ovh.net. tech.ovh.net. (2021090800 86400 3600 3600000 300)
IN NS ns110.ovh.net.
IN NS dns110.ovh.net.
IN MX 10 yanfi.net.
IN A 45.145.166.178
IN AAAA 2a04:ecc0:8:a8:4567:4989::1
IN CAA 128 issue "letsencrypt.org"
IN TXT "v=spf1 a mx -all"
* IN A 45.145.166.178
* IN AAAA 2a04:ecc0:8:a8:4567:4989::1
_dmarc IN TXT "v=DMARC1; p=none"
_xmpp-client._tcp IN SRV 0 5 5222 yanfi.net.
_xmpp-server._tcp IN SRV 0 5 5269 yanfi.net.
mail._domainkey IN TXT ( "v=DKIM1; h=sha256; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7jDcuICl4E9fLUhdum1TW7Pxj+pKDrn7np1nu4umYuZd7qVt69JGjtF4RvBGOASxguG1uVZLoBBYPgA8sZmmbT1Laf7g74YQm+i345yjzklT96aCJu1PvZMosvzMOBfbx6N08Nav5Rp++PTuMHFXhyDmJMr/c2/epVWm4eXbdAwIDAQAB" )
muc IN CNAME yanfi.net.
pubsub IN CNAME yanfi.net.
vjud IN CNAME yanfi.net.
xmpp-upload IN CNAME yanfi.net.
5 - Clé SSH borg
Actions à effectuer sur le nouveau serveur client "yanfi.space" (server32771)
En root,créer une clé SSH pour l’authentification borg sur le serveur xoyaz.xyz
sudo -s
ssh-keygen -t ed25519 -f /root/.ssh/id_borg_ed25519
Validez en appuyant sur la touche « Entrée » à toutes les questions
Vous devriez maintenant avoir une clé privée contenue dans le fichier /root/.ssh/id_borg_ed25519
, et une clé publique contenue dans le fichier /root/.ssh/id_borg_ed25519.pub
La clé privée ne doit jamais être partagée.
Ajouter la clé publique Borg client au serveur hms.xoyaz.xyz (/home/backup/.ssh/authorized_keys
)
6 - Installer borg yunohost
Prérequis:
- Dépôt distant borg :
ssh://borgbackup@hms.xoyaz.xyz:55051/home/backup/borg/yanfi_space
- PassPhrase du dépôt borg
En mode su , installer borg yunohost sur server32771
yunohost app install borg
In which borg repository location do you want to backup your files ?: ssh://borgbackup@hms.xoyaz.xyz:55051/home/backup/borg/yanfi_space
Provide a strong passphrase to encrypt your backups. No blank space:
Should Borg backup your YunoHost configuration? [yes | no] (default: yes):
Should Borg backup emails and user home directory? [yes | no] (default: yes):
Which apps should Borg backup ? (default: all):
With which regular time schedule should the backups be performed? (see systemd OnCalendar format) (default: Daily):
Do you want admin to receive mail notifications on backups ? [always | errors_only | never]: never
Info: Installing borg...
[...]
Success! Installation completed
Le fichier de configuration borg /etc/yunohost/apps/borg/settings.yml
apps: all
apt_dependencies: python3-pip, python3-dev, libacl1-dev, libssl-dev, liblz4-dev, python3-jinja2,
python3-setuptools, python3-venv, virtualenv, libfuse-dev, pkg-config
checksum__etc_sudoers.d_borg: 85440e00f71eb32f9d873b0c750d212b
checksum__etc_systemd_system_borg.service: f8524abba7273903a9461715c04e1f97
checksum__etc_systemd_system_borg.timer: f34be57d7674c1e4f18f5e2a0e22e662
checksum__etc_yunohost_hooks.d_backup_method_05-borg_app: fb245168906edce7b94ef8b96002426d
checksum__usr_local_bin_backup-with-borg: b0beb7d48488fc6b2328e5a303452a8a
conf: '1'
current_revision: 87965e12798204e7c729dd87cf689add495b3937
data: '1'
id: borg
install_time: 1633155753
mailalert: never
on_calendar: Daily
passphrase: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
repository: ssh://borgbackup@hms.xoyaz.xyz:55051/home/backup/borg/yanfi_space
server: '[hms.xoyaz.xyz]:55051'
7 - Restauration
Sur le nouveau serveur (server32771), identifiez les archives que vous voulez restaurer
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg list "$(yunohost app setting $app repository)"
_auto_conf-2021-10-01_03:20 Fri, 2021-10-01 01:20:27 [d1570465f85e1e8750518e110c249392abb1b1c68c0291147d56a02e464c26db]
_auto_data-2021-10-01_03:20 Fri, 2021-10-01 01:20:59 [cb5103417e12cc610e8fa19019036d93400076c64a262c7974279d91139d72a0]
_auto_borg-2021-10-01_03:21 Fri, 2021-10-01 01:21:28 [5484053ed4f7faf549c21f711918558ceeddfe1b3e2fb75ee23faf8a150398e3]
_auto_calibreweb-2021-10-01_03:21 Fri, 2021-10-01 01:22:00 [9b637358f1b0587f754b7682bf935e0ed04bcafb0ba6a3d37ca49bdb3466ac0a]
_auto_gitea-2021-10-01_03:23 Fri, 2021-10-01 01:23:09 [b4279a648ea4889cc22b4a07736566ab66c8ccfb5f4c2d24393d8f97fdb92efa]
_auto_librespeed-2021-10-01_03:23 Fri, 2021-10-01 01:23:39 [662a08c38db0441f6d665658759fb023c9e2ed062ead74ff4a583f0b1a7850f0]
_auto_my_webapp-2021-10-01_03:23 Fri, 2021-10-01 01:24:06 [dd47fd4645e9dd95a4465bc885ec6b48dc00478f1a80bde368fa2b4d313c62f7]
_auto_my_webapp__2-2021-10-01_03:24 Fri, 2021-10-01 01:24:36 [1dca56652138d7bf240326875e74d73c3179a5600ae66b7fe91f4063d888c8a0]
_auto_my_webapp__3-2021-10-01_03:24 Fri, 2021-10-01 01:25:03 [111d3a6030b16e178939177a13eaad8e8d5f81d7b9e6ab75ab574e14e87e663e]
_auto_navidrome-2021-10-01_03:25 Fri, 2021-10-01 01:25:33 [46646d5324cb6d9f105f371290558c892059fee513fc4cc22be4acd5adbcc134]
_auto_nextcloud-2021-10-01_03:25 Fri, 2021-10-01 01:26:03 [95f23fc246985abaad7af5964a3ac6c968a82bf7c858879c012d82c7c5151fca]
_auto_rainloop-2021-10-01_03:26 Fri, 2021-10-01 01:26:40 [88bb4e12dfc913a4bb5daee241794f377d07fc6adce6b099c88a088823c8f45c]
_auto_redirect-2021-10-01_03:26 Fri, 2021-10-01 01:27:05 [731fff7c7884ef480cac0766d73005e74093dd425ea6b68bee636fd06eeda17d]
_auto_shaarli-2021-10-01_03:27 Fri, 2021-10-01 01:27:36 [dcd098db4956256a61ab334ae04c1378bdd8407718cdab6c32aa4336a3a3eb37]
_auto_ttrss-2021-10-01_03:27 Fri, 2021-10-01 01:28:03 [35eeed5c1fd45fd4c3d2965bec7428cc6e916f1586283ad14b96e9aea7b8a3e5]
Installer tmux pour pouvoir exécuter des tâches après déconnexion SSH et des outis
apt install tmux figlet tree
tmux
Recréer les archives tar.gz en local dans le dossier /home/yunohost.backup/archives/
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_conf-2021-10-01_03:20" /home/yunohost.backup/archives/_auto_conf-2021-10-01_03:20.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_data-2021-10-01_03:20" /home/yunohost.backup/archives/_auto_data-2021-10-01_03:20.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_borg-2021-10-01_03:21" /home/yunohost.backup/archives/_auto_borg-2021-10-01_03:21.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_calibreweb-2021-10-01_03:21" /home/yunohost.backup/archives/_auto_calibreweb-2021-10-01_03:21.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_gitea-2021-10-01_03:23" /home/yunohost.backup/archives/_auto_gitea-2021-10-01_03:23.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_librespeed-2021-10-01_03:23" /home/yunohost.backup/archives/_auto_librespeed-2021-10-01_03:23.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_my_webapp-2021-10-01_03:23" /home/yunohost.backup/archives/_auto_my_webapp-2021-10-01_03:23.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_my_webapp__2-2021-10-01_03:24" /home/yunohost.backup/archives/_auto_my_webapp__2-2021-10-01_03:24.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_my_webapp__3-2021-10-01_03:24" /home/yunohost.backup/archives/_auto_my_webapp__3-2021-10-01_03:24.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_navidrome-2021-10-01_03:25" /home/yunohost.backup/archives/_auto_navidrome-2021-10-01_03:25.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_nextcloud-2021-10-01_03:25" /home/yunohost.backup/archives/_auto_nextcloud-2021-10-01_03:25.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_rainloop-2021-10-01_03:26" /home/yunohost.backup/archives/_auto_rainloop-2021-10-01_03:26.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_redirect-2021-10-01_03:26" /home/yunohost.backup/archives/_auto_redirect-2021-10-01_03:26.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_shaarli-2021-10-01_03:27" /home/yunohost.backup/archives/_auto_shaarli-2021-10-01_03:27.tar.gz
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 " borg export-tar "$(yunohost app setting $app repository)::_auto_ttrss-2021-10-01_03:27" /home/yunohost.backup/archives/_auto_ttrss-2021-10-01_03:27.tar.gz
Enfin vous pouvez restaurer dans l’ordre que vous donnez (conf, données et enfin apps par apps)
Ce qui est restauré depuis /home/yunohost.backup/archives/
yunohost backup restore _auto_conf-2021-10-01_03:20.tar.gz --system
yunohost backup restore _auto_data-2021-10-01_03:20.tar.gz --system
Ce qui n’est pas restauré depuis /home/yunohost.backup/archives/
yunohost backup restore _auto_navidrome-2021-10-01_03:25.tar.gz --apps
yunohost backup restore _auto_borg-2021-10-01_03:21.tar.gz --apps
yunohost backup restore _auto_calibreweb-2021-10-01_03:21.tar.gz --apps
Yunohost yanfi.space
Compléments après restauration, les programmes utilitaires
sudo apt install rsync curl tmux jq figlet git dnsutils tree
Utilisateur userdata
Le dossier datayan contient tous les dossiers de données :
BiblioCalibre CalibreTechnique media musique static www
Créer un utilisateur Linux avec un répertoire Home personnalisé /srv/datayan
, un Shell, un commentaire, un UID et un GID personnalisés
useradd -m -d /home/userdata -s /bin/bash -c "Dossiers yannick" -u 1000 userdata
Ajouter cet utilisateur au groupe users
sudo usermod -a -G users userdata
Vérifier
grep "users" /etc/group
users:x:100:userdata
Création dossier .ssh
, y mettre la clé privée ‘hms-sto-250’ du server85393 (hms.xoyaz.xyz) pour accéder au serveur hms.xoyaz.xyz
sudo mkdir /home/userdata/.ssh
Droits sur le dossier
sudo chown userdata.users -R /home/userdata/
Transfert des dossiers du server85393 (hms.xoyaz.xyz) vers server32771 (yanfi.space) avec utilisateur ‘userdata’
sudo -s
sudo -u userdata rsync -avz --progress --delete --rsync-path="sudo rsync" -e "ssh -p 55051 -i /home/userdata/.ssh/hms-sto-250 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" userhms@hms.xoyaz.xyz:/home/userhms/sshfs/* /srv/datayan/
SSH
La connexion ssh se fait avec une clé de puis un poste linux
ssh admin@45.145.166.178 -p 55127 -i /home/yann/.ssh/server32771-admin
La clé publique est dans le dossier /home/admin/.ssh/authorized_keys
Ajouter le droit de connexion ssh à un utilisateur
yunohost user permission add ssh yann
La connexion ssh se fait avec une clé de puis un poste linux
ssh yann@45.145.166.178 -p 55127 -i /home/yann/.ssh/server32771-yann
Il faut une clé publique dans le dossier /home/yann/.ssh/authorized_keys
Historique de la ligne de commande
Ajoutez la recherche d’historique de la ligne de commande au terminal. Tapez un début de commande précédent, puis utilisez shift + up (flèche haut) pour rechercher l’historique filtré avec le début de la commande.
# Global, tout utilisateur
echo '"\e[1;2A": history-search-backward' | sudo tee -a /etc/inputrc
echo '"\e[1;2B": history-search-forward' | sudo tee -a /etc/inputrc
Script ssh_rc_bash
ATTENTION!!! Les scripts sur connexion peuvent poser des problèmes pour des appels externes autres que ssh
Logo
nano ~/logo
__ _
_ _ __ _ _ __ / _|(_) ___ _ __ __ _ ___ ___
| | | | / _` || '_ \ | |_ | | / __|| '_ \ / _` | / __|/ _ \
| |_| || (_| || | | || _|| | _ \__ \| |_) || (_| || (__| __/
\__, | \__,_||_| |_||_| |_|(_)|___/| .__/ \__,_| \___|\___|
|___/ |_|
wget https://static.cinay.eu/files/ssh_rc_bash
chmod +x ssh_rc_bash # rendre le bash exécutable
Modifier le fichier pour afficher le logo
sed -i 's/31m\$logo/31m\`cat logo\`/g' ssh_rc_bash
Exécuter le bash
./ssh_rc_bash # exécution
SSHFS partage xoyaz.xyz
Secure shell file system (ou SSHFS) permet le partage d’un système de fichiers de manière sécurisée en utilisant le protocole SFTP de SSH
Le but, créer un accès réseau sur un autre serveur pour les gros volumes de fichiers (musique, livres, etc…)
Le dossier local /opt/sshfs/
sudo mkdir -p /opt/sshfs
Il faut créer une liaison réseau sécurisée entre cinay.eu ← → xoyaz.xyz
sudo apt install sshfs
Autorisations
- Autorisations “utilisateur”
- Exécuter
sshfs
(ou toute autre commande de montage FUSE) avec l’option-o allow_other
- Exécuter
- Autoriser l’accès “root” des supports fuse
- Ajouter
user_allow_other
au fichier /etc/fuse.conf - Exécuter
sshfs
(ou toute autre commande de montage FUSE) avec l’option-o allow_root
- Ajouter
Partage avec serveur hms.xoyaz.xyz : Clé privée hms-sto-250
Droits : chmod 600 /home/admin/.ssh/hms-sto-250
Montage manuelle pour authentifier la clé avec utilisateur “debian”
sudo -s
sshfs -o allow_other userhms@hms.xoyaz.xyz:/home/userhms/sshfs /opt/sshfs -C -p 55051 -oIdentityFile=/home/admin/.ssh/hms-sto-250
NOTE: Il faut mettre l’adresse IP du serveur , si les domaines peuvent ne pas être “résolus”
Après vérification , ls /opt/sshfs
, déconnexion fusermount -u /opt/sshfs
Montage auto
Ajouter la ligne suivante au fichier /etc/fstab
userhms@hms.xoyaz.xyz:/home/userhms/sshfs /opt/sshfs fuse.sshfs _netdev,identityfile=/home/admin/.ssh/hms-sto-250,allow_other,port=55051 0 0
Montage pour authentifier la clé avec utilisateur “root”
sudo mount -a
Thème “yann”
A partir d’un thème existant : cp -r /usr/share/ssowat/portal/assets/themes/{light,yann}
Les images : /usr/share/ssowat/portal/assets/img/
Image de fond : iceland-aurore-polaire.jpg
Logo : ym-70x70.png , yannick-white16x16.png
Le fichier css : /usr/share/ssowat/portal/assets/themes/yann/custom_portal.css
Modifier la balise body {
/*
===============================================================================
This file contain extra CSS rules to customize the YunoHost user portal and
can be used to customize app tiles, buttons, etc...
===============================================================================
*/
body {
margin:0;
padding:0;
background: url("../../img/iceland-aurore-polaire.jpg") no-repeat center fixed;
-webkit-background-size: cover; /* pour anciens Chrome et Safari */
background-size: cover; /* version standardisée */
}
Personnaliser le logo
Modifier le fichier /usr/share/ssowat/portal/assets/themes/yann/custom_portal.css
/* Logo */
.ynh-logo {
opacity: 0.7;
margin-top: 6em;
width: 100%;
height: 9em;
background-image: url("../../img/ym-70x70.png");
background-repeat: no-repeat;
background-position: center 100%;
background-size: contain;
}
.user-container:before {
content: url("../../img/yannick-white64x64.png");
background: #0000;
}
Modifier le fichier /usr/share/ssowat/portal/assets/themes/yann/custom_overlay.css
#ynh-overlay-switch {
/* FIXME : idk if this is an issue or not to have /yunohost/sso hard-coded here */
background-image: url("/yunohost/sso/assets/img/ym-70x70.png");
right: 60px;
border-color: #7EA93D;
background-color: #7EA93D;
}
Activer le thème nano /etc/ssowat/conf.json.persistent
{
"theme" : "yann",
}
!!! Rrafraîchir le cache du navigateur pour que le thème se propage complètement ( Ctrl+Maj+R sur Firefox)
Applications Restaurées (Borg)
Nextcloud (/nextcloud)
Restauration: yunohost backup restore _auto_nextcloud-2021-10-01_03:25.tar.gz --apps
Sur le domaine cinay.eu admin, yann
yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh --debug
[...]
Choose a domain for Nextcloud (default: cinay.eu):
Choose a path for Nextcloud (default: /nextcloud):
Choose the Nextcloud administrator (must be an existing YunoHost user): yann
Access the users home folder from Nextcloud? [yes | no] (default: no): no
[...]
Dans les paramètres fichier de nextcloud , activer l’affichage des fichiers masqués
Optimisation Nextcloud
Fichier de configuration
/etc/php/7.3/fpm/php.ini
Augmenter la limite de mémoire à un nombre élevé, ou désactiver complètement la limite de mémoire. Si votre serveur a suffisamment de mémoire à consacrer à PHP, allez-y et augmentez-la à, disons, 1 Go. Si ce serveur n’est utilisé que pour Nextcloud, vous pouvez désactiver la limite (encore une fois, surveillez-la de près pour éviter tout problème).
Pour désactiver la limite, la ligne serait :
memory_limit = -1
Si vous voulez augmenter la limite à, disons, 1 GB, la ligne serait :
memory_limit = 1024M
OPcache (qui signifie Optimizer Plus Cache) est introduit depuis la version 5.5.0 de PHP. Il sert à cacher l’opcode de PHP, c’est-à-dire les instructions de bas niveau générées par la machine virtuelle PHP lors de l’exécution d’un script. Autrement dit, le code pré-compilé est stocké en mémoire. Cela évite ainsi l’étape de compilation à chaque requête PHP. De plus, OPcache va optimiser l’exécution du code afin d’en améliorer les performances.
[opcache]
opcache.enable = 1
opcache.interned_strings_buffer = 8
opcache.max_accelerated_files = 10000
opcache.memory_consumption = 128
opcache.save_comments = 1
opcache.revalidate_freq = 1
Redémarrage nginx fpm :
sudo systemctl restart php7.3-fpm.service
Activer les applications
Activer les applications Calendar, Contacts et Notes sur nextcloud
Paramètres de base
- Paramètres de base
- Serveur e-mail
- Personnaliser l’apparence
- Logo
- Image de connexion
Calendrier et contacts (android et thunderbird)
Paramétrage OpenSync android
Connexion avec le lien https://cinay.eu/nextcloud/remote.php/dav (login+mdp)
Paramétrer les applications qui utilisent le calendrier et les contacts
Contacts , acalendar et Tâches
Paramétrage agenda Thunderbird
Se désabonner de l’ancien agenda cinay.xyz
Paramétrage contacts Thunderbird
Outils → Préférences des modules → TbSync
Dans l’application
Actions sur les comptes → Ajouter un nouveau compte → Caldav & Carddav
Synchronisation toutes les heures pour les contacts
Liens caldav carddav sur thunderbird (yann)
https://cinay.eu/nextcloud/remote.php/dav/calendars/yann/personal/
https://cinay.eu/nextcloud/remote.php/dav/addressbooks/users/yann/contacts/
Compte nextcloud sur les postes clients de type PC
Ajout du compte https://cinay.eu/nextcloud sur les clients nextcloud
Synchronisations:
- ~/.keepassx → Home/.keepassx (créer le dossier)
- ~/media/Notes → Notes (créer le dossier)
Compte nextcloud sur android
Application nextcloud installée
Se connecter https://cinay.eu/nextcloud et vérifier la création du compte
Synchroniser le fichier de mot de passe avec l’application keepass
Corriger l’avertissement « La limite de mémoire PHP est inférieure à la valeur recommandée de 512 Mo »
Augmenter la mémoire :memory_limit = 512M
dans le fichier/etc/php/7.3/fpm/php.ini
Relancersudo systemctl restart php7.3-fpm
Tiny Tiny RSS (/ttrss)
Tiny Tiny RSS (ttrss) est un agrégateur de flux RSS et Atom libre sous licence libre GNU GPL v3
Restauration: yunohost backup restore _auto_ttrss-2021-10-01_03:27.tar.gz --apps
Installation en mode de commande (su)
yunohost app install ttrss
Choose a domain for Tiny-Tiny-RSS (default: cinay.eu):
Choose a path for Tiny-Tiny-RSS (default: /ttrss):
Success! Installation completed
Mise à jour
yunohost app upgrade ttrss -u https://github.com/YunoHost-Apps/ttrss_ynh/tree/testing --debug
Personnaliser le CSS , configuration
Ajout du contenu suivant dans la feuille de style
body.flat.ttrss_main #headlines-frame .hl.Unread:not(.active):not(.Selected),
body.flat.ttrss_main #headlines-frame .cdm.expandable.Unread:not(.active):not(.Selected) {
background: #696969;
}
Puis cliquer Save and reload
ttrss ldap
Le processus d’authentification a changé (les patchs ne fonctionnent plus)… Pour vous connecter à TTRSS, utilisez d’abord l’administrateur et le mot de passe, puis modifiez les informations d’identification dans le panneau d’administration de TTRSS.
Shaarli
Restauration: yunohost backup restore _auto_shaarli-2021-10-01_03:27.tar.gz --apps
Installation
yunohost app install https://github.com/YunoHost-Apps/shaarli_ynh/tree/testing
domaine : yanfi.space
racine : /shaarli
utilisateur admin : yann
Mp admin : idem mp yann
Site publique: oui
Basculer l’application de privée en publique
sed -i "s/is_public\: '0'/is_public\: '1'/g" /etc/yunohost/apps/shaarli/settings.yml
Regénérer la configuration
yunohost app ssowatconf
Gitea (gitea.cinay.eu)
Restauration: yunohost backup restore _auto_gitea-2021-10-01_03:23.tar.gz --apps
Ajout domaine et certificats gitea.cinay.eu
yunohost domain add gitea.cinay.eu
yunohost domain cert-install gitea.cinay.eu --no-checks
Installation à partir de github, on clône le dépôt
git clone https://github.com/YunoHost-Apps/gitea_ynh.git
Blocage sur fail2ban à l’installation
Commenter la mise en place FAIL2BAN
nano gitea_ynh/scripts/install
# SETUP FAIL2BAN
#ynh_script_progression --message="Configuring fail2ban..."
#ynh_add_fail2ban_config --logpath "/var/log/$app/gitea.log" --failregex ".*Failed authentication attempt for .* from <HOST>" --max_retry 5
Installer gitea
yunohost app install gitea_ynh
Fail2ban , règle qui n’est pas ajouté
ynh_add_fail2ban_config --logpath /var/log/gitea/gitea.log --failregex '.*Failed authentication attempt for .* from <HOST>' --max_retry 5
Modifier l’étiquette gitea
yunohost app change-label gitea 'Gitea gitea.cinay.eu'
Rainloop
Restauration: yunohost backup restore _auto_rainloop-2021-10-01_03:26.tar.gz --apps
En mode su
yunohost app install rainloop
Choose the domain where this app should be installed [cinay.eu | gitea.cinay.eu | static.cinay.eu | yanfi.net | yanfi.space | searx.yanfi.space | zic.yanfi.space] (default: yanfi.space):
Choose the path where this app should be installed (default: /rainloop):
Should this app be exposed to anonymous visitors? [yes | no] (default: no):
Choose an administration password for this app:
Do you want to add YunoHost users to the recipients suggestions? [yes | no] (default: yes):
Select default language [de | en | es | fr | it | pt] (default: en): fr
[...]
Info: [####################] > Installation of rainloop completed
Success! Installation completed
LibreSpeed
Test de vitesse de connexion très léger.LibreSpeed
Restauration: yunohost backup restore _auto_librespeed-2021-10-01_03:23.tar.gz --apps
domaine : yanfi.space
site : /librespeed
En mode su
yunohost app install librespeed # un mot de passe administartion est demandé
Le fichier de configuration nginx
/etc/nginx/conf.d/yanfi.space.d/librespeed.conf
rewrite ^/librespeed$ /librespeed/ permanent;
location /librespeed/ {
# Path to source
alias /var/www/librespeed/ ;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
### Example PHP configuration (remove it if not used)
index yann-singleServer-full.html index.php;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
client_max_body_size 256M;
try_files $uri $uri/ /index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm-librespeed.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
### End of PHP configuration part
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}
Le fichier original example-singleServer-full.html
a été remplacé par yann-singleServer-full.html
https://yanfi.space/librespeed
static.cinay.eu
En mode su
Restauration: yunohost backup restore _auto_my_webapp-2021-10-01_03:23.tar.gz --apps
Créer le domaine static.cinay.eu et les certificats
yunohost domain add static.cinay.eu
yunohost domain cert-install static.cinay.eu --no-checks
Installer l’application Custom web app
sur le domaine static.cinay.eu
yunohost app install https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing --debug
Domaine : static.cinay.eu
Racine : /
Utilisateur : yann
Create a database: no
Site publique: yes
SFTP : no + mot de passe
Accès au site https://static.cinay.eu
Le dossier /srv/datayan/static/ contient le site statique qui est issu d’une synchronisation d’un conteneur debian sur un ordinateur archlinux avec jekyll comme générateur
rm -r /var/www/my_webapp/www/ # supprimer dossier web
chown my_webapp.my_webapp -R /var/www/my_webapp
ln -s /srv/datayan/static /var/www/my_webapp/www # lien et droits my_webapp
ln -s /srv/datayan/static/htmldoc /var/www/my_webapp/www/htmldoc
Modifier l’étiquette my_webapp
(static.cinay.eu)
yunohost app change-label my_webapp 'Statique static.cinay.eu'
cinay.eu/site
Accès à des liens tel que “Diceware”
Le diceware, ou méthode du lancer de dés selon l’ Office québécois de la langue française, est, en cryptologie, une méthode employée pour créer des phrases secrètes, des mots de passe et d’autres variables cryptographiques en utilisant un dé ordinaire à six faces comme générateur de nombres aléatoires physique.
Restauration: yunohost backup restore _auto_my_webapp__2-2021-10-01_03:24.tar.gz --apps
Installer l’application Custom web app
sans sftp sur cinay.eu/site
yunohost app install https://github.com/YunoHost-Apps/my_webapp_ynh/tree/testing --debug
Application id: my_webapp__2
rm -r /var/www/my_webapp__2/www # supprimer dossier web
chown my_webapp__2.my_webapp__2 -R /var/www/my_webapp__2
ln -s /srv/datayan/www /var/www/my_webapp__2/www # lien et droits my_webapp
Modifier le fichier de configuration /etc/nginx/conf.d/cinay.eu.d/my_webapp__2.conf
pour lister le contenu d’un répertoire
# Deny access to hidden files and directories
# location ~ ^/site/(.+/|)\.(?!well-known\/) {
# deny all;
# }
fancyindex on; # Enable fancy indexes.
fancyindex_exact_size off; # Output human-readable file sizes.
Redémarrer le serveur nginx
systemctl restart nginx
Modifier l’étiquette my_webapp__2
yunohost app change-label my_webapp__2 'Cartographie Diceware'
https://cinay.eu/site
Cartes - map.cinay.eu
En mode su
Restauration: yunohost backup restore _auto_my_webapp__3-2021-10-01_03:24.tar.gz --apps
Créer le domaine map.cinay.eu et les certificats
yunohost domain add map.cinay.eu
yunohost domain cert-install map.cinay.eu --no-checks
Installer l’application Custom web app
sur le domaine map.cinay.eu
yunohost app install https://github.com/YunoHost-Apps/my_webapp_ynh
Choose the domain where this app should be installed [cinay.eu | gitea.cinay.eu | map.cinay.eu | static.cinay.eu | yanfi.net | yanfi.space | searx.yanfi.space | zic.yanfi.space] (default: yanfi.space): map.cinay.eu
Choose the path where this app should be installed (default: /site): /
Do you need a SFTP access? [yes | no] (default: yes): no
Choose an administration password for this app:
Should this app be exposed to anonymous visitors? [yes | no] (default: yes):
Do you need a MySQL database? [yes | no] (default: no):
[...]
Info: [####################] > Installation of my_webapp__3 completed
Success! Installation completed
Accès au site https://map.cinay.eu
Le dossier /srv/datayan/www/osm-new/ contient le site cartographique basé sur leaflet
rm -r /var/www/my_webapp__3/www/ # supprimer dossier web
chown my_webapp__3.my_webapp__3 -R /var/www/my_webapp__3
ln -s /srv/datayan/www/osm-new /var/www/my_webapp__3/www # lien et droits my_webapp__3
Modifier l’étiquette my_webapp__3
(map.cinay.eu)
yunohost app change-label my_webapp__3 'Cartes map.cinay.eu'
Fin restauration
Réinstaller Borg
On désinstalle yunohost borg qui a été utilisé pour récupérer les sauvegardes situées sur le serveur hms.xoyaz.xyz (server85393)
yunohost app remove borg
On restaure le borg de la sauvegarde
yunohost backup restore _auto_borg-2021-10-01_03:21.tar.gz
Applications Installées
Searx (searx.yanfi.space)
Ajout domaine et certificats searx.yanfi.space
sudo yunohost domain add searx.yanfi.space
sudo yunohost domain cert-install searx.yanfi.space --no-checks
Installer docker
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
Assurez-vous que vous êtes sur le point d’installer à partir du dépôt Docker au lieu du dépôt Debian par défaut :
apt-cache policy docker-ce
Vous verrez un résultat comme celui-ci, bien que le numéro de version de Docker puisse être différent :
Sortie de la politique apt-cache docker-ce
docker-ce:
Installed: (none)
Candidate: 5:20.10.8~3-0~debian-buster
Version table:
5:20.10.8~3-0~debian-buster 500
500 https://download.docker.com/linux/debian buster/stable amd64 Packages
5:20.10.7~3-0~debian-buster 500
500 https://download.docker.com/linux/debian buster/stable amd64 Packages
Remarquez que docker-ce n’est pas installé, mais que le candidat à l’installation provient du dépôt Docker pour Debian 10 (buster).
Enfin, installez Docker :
sudo apt install docker-ce
Docker est maintenant installé, le démon démarré, et le processus activé pour démarrer au démarrage. Vérifiez qu’il est en cours d’exécution :
sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-10-02 13:17:15 UTC; 16s ago
Docs: https://docs.docker.com
Main PID: 22127 (dockerd)
Tasks: 8
Memory: 38.2M
CGroup: /system.slice/docker.service
└─22127 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Oct 02 13:17:12 server32771 dockerd[22127]: time="2021-10-02T13:17:12.299846657Z" level=warning msg="Your
Oct 02 13:17:12 server32771 dockerd[22127]: time="2021-10-02T13:17:12.299859364Z" level=warning msg="Your
Oct 02 13:17:12 server32771 dockerd[22127]: time="2021-10-02T13:17:12.299870050Z" level=warning msg="Your
Oct 02 13:17:12 server32771 dockerd[22127]: time="2021-10-02T13:17:12.300340111Z" level=info msg="Loading
Oct 02 13:17:13 server32771 dockerd[22127]: time="2021-10-02T13:17:13.418298760Z" level=info msg="Default
Oct 02 13:17:13 server32771 dockerd[22127]: time="2021-10-02T13:17:13.808785056Z" level=info msg="Loading
Oct 02 13:17:14 server32771 dockerd[22127]: time="2021-10-02T13:17:14.446156262Z" level=info msg="Docker d
Oct 02 13:17:14 server32771 dockerd[22127]: time="2021-10-02T13:17:14.446395681Z" level=info msg="Daemon h
Oct 02 13:17:15 server32771 systemd[1]: Started Docker Application Container Engine.
Oct 02 13:17:15 server32771 dockerd[22127]: time="2021-10-02T13:17:15.317543691Z" level=info msg="API list
Searx - docker
L’image du docker est searx/searx (basée sur github.com/searx/searx).
sudo mkdir /opt/searx
sudo chown admin.1007 /opt/searx
cd /opt/searx
sudo docker pull searx/searx
sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
searx/searx latest 7f95cc8c8578 6 minutes ago 207MB
La méthode la plus simple pour déployer un conteneur en tant que service consiste à créer le conteneur s’il n’existe pas avec un nom donné et ensuite de mapper chacune des opérations de docker (démarrage et arrêt) aux commandes de service du système.
Une fois que nous avons créé ce conteneur, nous pouvons le démarrer, l’arrêter et le redémarrer en utilisant les commandes habituelles du docker en indiquant le nom du conteneur (docker stop searx
, docker start searx
, docker restart searx
).
Service systemd searx
Créer un nouveau fichier d’unité systemd searx.service
avec la description du service dans /etc/systemd/system/
.
/etc/systemd/system/searx.service
[Unit]
Description=searx container
After=docker.service
Wants=network-online.target docker.socket
Requires=docker.socket
[Service]
Restart=always
ExecStartPre=/bin/bash -c "/usr/bin/docker container inspect searx 2> /dev/null || /usr/bin/docker run --name searx --rm -d -v /opt/searx:/etc/searx -p 8089:8080 -e BASE_URL=http://localhost:8089/ searx/searx"
ExecStart=/usr/bin/docker start -a searx
ExecStop=/usr/bin/docker stop -t 10 searx
[Install]
WantedBy=multi-user.target
Recharger les services
sudo systemctl daemon-reload
Le fichier d’unité crée un nouveau service et associe les commandes de démarrage et d’arrêt du docker aux séquences de démarrage et d’arrêt du service.
Le fichier unit décrit comme des dépendances la cible réseau en ligne et la prise docker, si la prise docker ne démarre pas ce service ne le fera pas non plus. Il ajoute également une dépendance à docker.service, de sorte que ce service ne fonctionnera pas tant que docker.service n’aura pas démarré.
Nous pouvons maintenant démarrer/arrêter le service en émettant la commande correspondante :
sudo systemctl start searx # sudo systemctl stop searx
Vérifier localement
curl --location --verbose --head --insecure localhost:8089
[...]
* Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x5614e62aef90)
* Connected to localhost (127.0.0.1) port 8089 (#0)
> HEAD / HTTP/1.1
> Host: localhost:8089
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
[...]
Modifier le fichier de configuration
sudo nano ${PWD}/searx/settings.yml
general:
instance_name : "yann-searx" # displayed name
server:
base_url : http://localhost:8089/ # Set custom base_url. Possible values: False or "https://your.custom.host/lo
cation/"
ui:
theme_args :
oscar_style : logicodev-dark # default style of oscar
results_on_new_tab: True # Open result links in a new tab by default
# supprimer la ligne 'disabled : True' des éléments ci dessous
- name : ddg definitions
engine : duckduckgo_definitions
shortcut : ddd
weight : 2
- name : duckduckgo
engine : duckduckgo
shortcut : ddg
- name : duckduckgo images
engine : duckduckgo_images
shortcut : ddi
timeout: 3.0
Redémarrage pour prise en charge des modifications
sudo systemctl restart searx
Valider le service pour qu’il fonctionne au démarrage en courant :
sudo systemctl enable searx
Pour info, docker ID
sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5e6a0dfa0e7d searx/searx "/sbin/tini -- /usr/…" 55 seconds ago Up 51 seconds 0.0.0.0:8089->8080/tcp, :::8089->8080/tcp searx
Pour redémarrer le container par son ID : docker restart 5e6a0dfa0e7d
Proxy searx
Restauration: yunohost backup restore _auto_redirect-2021-10-01_03:26.tar.gz --apps
Proxy yunohost redirect (searx)
Installer application yunohost proxy redirect
sudo yunohost app install https://github.com/YunoHost-Apps/redirect_ynh
Choose a domain for your redirect (default: cinay.eu): searx.yanfi.space
Choose a path for your redirect (default: /redirect): /
Redirect destination path (default: http://127.0.0.1): http://127.0.0.1:8089
Redirect type [public_302 | public_301 | public_proxy | private_proxy] (default: public_302): public_proxy
Info: Installing redirect...
[...]
Success! Installation completed
Modifier l’étiquette redirect
(searx.cinay.eu)
sudo yunohost app change-label redirect 'Moteur Recherche searx.cinay.eu'
Accès lien https://searx.yanfi.space
Mise à jour image docker searx
cd /home/admin
Télécharge la dernière image searx
docker images –format “{{.Repository}}:{{.Tag}}” | grep ‘:latest’ | xargs -L1 docker pull; |
latest: Pulling from searx/searx
339de151aab4: Pull complete
cb464254eb0a: Pull complete
3df700c30092: Pull complete
9a4946c2a738: Pull complete
2c615ec6f7fa: Pull complete
ef48a2d171a2: Pull complete
Digest: sha256:b4df2141a868644563f82680d66dc0d3c1d366f598ffc1cdb484d796c117230f
Status: Downloaded newer image for searx/searx:latest
Liste des images
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
searx/searx latest 2b9a1d1fc86a 5 days ago 205MB
searx/searx <none> 096886989dad 7 months ago 161MB
Arrêt image searx
sudo systemctl stop searx.service
Supprimer l’image par ID
docker rmi 096886989dad
Les images restantes
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
searx/searx latest 2b9a1d1fc86a 5 days ago 205MB
Relancer le service
sudo systemctl start searx.service
sudo systemctl status searx.service
● searx.service - searx container
Loaded: loaded (/etc/systemd/system/searx.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-08-20 18:26:17 CEST; 17s ago
Process: 15680 ExecStartPre=/bin/bash -c /usr/bin/docker container inspect searx 2> /dev/null || /usr/bin/docker run --name sear
Main PID: 15788 (docker)
Tasks: 7 (limit: 4579)
Memory: 21.5M
CGroup: /system.slice/searx.service
└─15788 /usr/bin/docker start -a searx
Aug 20 18:26:16 yanfi.space systemd[1]: Starting searx container...
Aug 20 18:26:16 yanfi.space bash[15680]: []
Aug 20 18:26:16 yanfi.space bash[15680]: 6a7551c7a9fbbdc86e234aa07dbadde13ecd2878cef7beea49272b9de2a0b313
Aug 20 18:26:17 yanfi.space systemd[1]: Started searx container.
Aug 20 18:26:17 yanfi.space docker[15788]: searx version 1.0.0-200-313a9847
Aug 20 18:26:17 yanfi.space docker[15788]: Use existing /etc/searx/uwsgi.ini
Aug 20 18:26:17 yanfi.space docker[15788]: Use existing /etc/searx/settings.yml
Aug 20 18:26:17 yanfi.space docker[15788]: Listen on 0.0.0.0:8080
Aug 20 18:26:17 yanfi.space docker[15788]: [uWSGI] getting INI configuration from /etc/searx/uwsgi.ini
Aug 20 18:26:17 yanfi.space docker[15788]: [uwsgi-static] added mapping for /static => /usr/local/searx/searx/static
Calibre ebook.yanfi.space
En mode su
Source : https://github.com/janeczku/calibre-web
Caractéristiques
- Interface HTML5 Bootstrap 3
- configuration graphique complète
- Gestion des utilisateurs avec des permissions par utilisateur à grain fin
- Interface administrateur
- Interface utilisateur en brésilien, tchèque, néerlandais, anglais, finnois, français, allemand, grec, hongrois, italien, japonais, khmer, polonais, russe, chinois simplifié, espagnol, suédois, turc, ukrainien.
- Flux OPDS pour les applications de lecture de livres électroniques
- Filtrez et recherchez par titres, auteurs, tags, séries et langues.
- Créer une collection de livres personnalisée (étagères)
- Prise en charge de l’édition des métadonnées des livres électroniques et de la suppression des livres électroniques de la bibliothèque Calibre.
- Prise en charge de la conversion des eBooks par les binaires Calibre
- Restriction du téléchargement des livres électroniques aux utilisateurs connectés
- Support pour l’enregistrement public des utilisateurs
- Envoi d’eBooks vers des appareils Kindle d’un simple clic de souris
- Synchronisation de vos appareils Kobo avec votre bibliothèque Calibre via Calibre-Web
- Prise en charge de la lecture des eBooks directement dans le navigateur (.txt, .epub, .pdf, .cbr, .cbt, .cbz, .djvu)
- Téléchargement de nouveaux livres dans de nombreux formats, y compris les formats audio (.mp3, .m4a, .m4b)
- Prise en charge des colonnes personnalisées de Calibre
- Possibilité de masquer le contenu en fonction des catégories et du contenu des colonnes personnalisées par utilisateur.
- Possibilité de mise à jour automatique
- Connexion “Magic Link” pour faciliter la connexion aux eReaders
- Connexion via LDAP, google/github oauth et via l’authentification proxy.
Ajout domaine et certificats ebook.yanfi.space
yunohost domain add ebook.yanfi.space
yunohost domain cert-install ebook.yanfi.space --no-checks
Installer l’application Calibre-web
yunohost app install https://github.com/YunoHost-Apps/calibreweb_ynh
Choose the domain where this app should be installed [cinay.eu | gitea.cinay.eu | map.cinay.eu | static.c
inay.eu | yanfi.net | yanfi.space | ebook.yanfi.space | rss.yanfi.space | searx.yanfi.space | zic.yanfi.s
pace]: ebook.yanfi.space
Choose the URL path (after the domain) where this app should be installed: /
Choose an administrator user for this app [yann | claudine | yanfi | yakoyann]: yann
Should this app be exposed to anonymous visitors? [yes | no]: no
Select a default language [fr | en | es | de]: fr
Do you want to allow uploading of books? [yes | no]: no
Do you want to allow access to the library to all Yunohost users? [yes | no]: yes
Désactiver le backup
yunohost app setting calibreweb do_not_backup_data -v 1
Si la bibliothèque existait avant l’installation de Calibreweb, les accès à celle-ci doivent être géré manuellement
chown -R calibreweb: chemin/vers/bibliothèque
Le dossier des livres : /srv/datayan/BiblioCalibre/
Ouverture du lien https://ebook.yanfi.space
Rafraîchir poour afficher la liste importée des utilisateurs LDAP
Le dossier des livres
/srv/datayan/BiblioCalibre
Changer l’étiquette
sudo yunohost app change-label calibreweb 'BiblioCalibre ebook.yanfi.space'
ATTENTION , après une mise à jour par rsync des bibliothèques, il faut relancer l’application calibre web
sudo systemctl restart calibreweb
Mise à jour calibre
Problèmes liés à la version de Werkzeug dans pip qui rend l’application inopérante
Mise à jour dernière version pip
python3 -m pip install --upgrade pip
Version Werkzeug
pip install Werkzeug==2.0.3
Audio Navidrome
Navidrome (stream audio)
Navidrome est un serveur et un streamer de collection de musique en ligne open source. Il vous donne la liberté d’écouter votre playlist à partir de n’importe quel navigateur ou appareil mobile.
Votre musique est a stockée par default dans le dossier multimédia partagé /home/yunohost.multimedia/share/Music. Ce dossier, facilement accessible depuis Nextcloud avec Stockages externes activée, vous permettra d’uploader facilement vos fichiers de musique sur votre server.
Vous pouvez personnaliser le dossier de stockage de vos fichiers de musique en éditant le fichier de configuration /var/lib/navidrome/navidrome.toml et rediriger la variable MusicFolder = "/home/yunohost.multimedia/share/Music"
. Vous pouvez également changer d’autre réglage en vous aidant de la documentation.
En mode su
Ajout domaine et certificats zic.yanfi.space
yunohost domain add zic.yanfi.space
yunohost domain cert-install zic.yanfi.space --no-checks
Conditions préalables à la mise à jour et à l’installation
Assurez-vous que votre système est à jour et installez ffmpeg, libtag-extras1.
sudo apt update && sudo apt upgrade
sudo apt install ffmpeg libtag-extras1
Par défaut, la commande useradd ne crée pas de répertoires de base, mais pour un démon, je vous recommande d’utiliser l’option système et de remplacer le shell par un shell inexistant afin que personne ne puisse se connecter à ce compte (sous ssh par exemple):
sudo useradd -r -s /bin/false navidrome
Créer une structure de répertoire
Créez un répertoire pour stocker l’exécutable Navidrome et un répertoire de travail avec les permissions appropriées.
sudo install -d -o navidrome -g navidrome /opt/navidrome
sudo install -d -o navidrome -g navidrome /var/lib/navidrome
Obtenir Navidrome
Téléchargez la dernière version depuis la page des versions, extrayez le contenu dans le répertoire exécutable et définissez les autorisations pour les fichiers. (Remplacez l’URL ci-dessous par celle de la page des versions) :
wget https://github.com/navidrome/navidrome/releases/download/v0.45.1/navidrome_0.45.1_Linux_arm64.tar.gz -O Navidrome.tar.gz
sudo tar -xvzf Navidrome.tar.gz -C /opt/navidrome/
sudo chown -R navidrome:navidrome /opt/navidrome
sudo chmod +x /opt/navidrome/navidrome
Ce fichier exécutable navidrome
peut être issu d’une compilation go (pour avoir la langue française par défaut). Voir le lien Archlinux Debian - Compilation go Audio Navidrome
Créer le fichier de configuration
Dans le répertoire de travail, /var/lib/navidrome
créer un nouveau fichier nommé navidrome.toml
avec les paramètres suivants.
MusicFolder = "/srv/datayan/musique"
ND_PLAYLISTSPATH = "Playlists"
Pour d’autres options de configuration, voir la page des options de configuration.
Créer une unité Systemd
Créez un nouveau fichier sous /etc/systemd/system/
nommé navidrome.service
avec les données suivantes.
/etc/systemd/system/navidrome.service
[Unit]
Description=Navidrome Music Server and Streamer compatible with Subsonic/Airsonic
After=remote-fs.target network.target
AssertPathExists=/var/lib/navidrome
[Install]
WantedBy=multi-user.target
[Service]
User=navidrome
Group=navidrome
Type=simple
ExecStart=/opt/navidrome/navidrome --configfile "/var/lib/navidrome/navidrome.toml"
WorkingDirectory=/var/lib/navidrome
TimeoutStopSec=20
KillMode=process
Restart=on-failure
# See https://www.freedesktop.org/software/systemd/man/systemd.exec.html
DevicePolicy=closed
NoNewPrivileges=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
ReadWritePaths=/var/lib/navidrome
# You can uncomment the following line if you're not using the jukebox This
# will prevent navidrome from accessing any real (physical) devices
#PrivateDevices=yes
# You can change the following line to `strict` instead of `full` if you don't
# want navidrome to be able to write anything on your filesystem outside of
# /var/lib/navidrome.
ProtectSystem=full
# You can uncomment the following line if you don't have any media in /home/*.
# This will prevent navidrome from ever reading/writing anything there.
#ProtectHome=true
# You can customize some Navidrome config options by setting environment variables here. Ex:
#Environment=ND_BASEURL="/navidrome"
Démarrez le service Navidrome
Rechargez le démon de service, démarrez le service nouvellement créé, et vérifiez qu’il a démarré correctement.
sudo systemctl daemon-reload
sudo systemctl start navidrome.service
sudo systemctl status navidrome.service
Si le service a démarré correctement, vérifiez que vous pouvez accéder à http://localhost:4533.
Ouvrir un terminal sur le client linux qui dispose des clés ssh et lancer la commande
ssh -L 9500:localhost:4533 admin@45.145.166.178 -p 55127 -i /home/yann/.ssh/server32771-admin
Ouvrir un navigateur sur le client et saisir localhost:9500 pour afficher le serveur audio
Démarrez Navidrome au démarrage
sudo systemctl enable navidrome.service
Proxy yunohost redirect (navidrome)
Installer application yunohost proxy redirect
sudo yunohost app install https://github.com/YunoHost-Apps/redirect_ynh
Choose the domain where this app should be installed [cinay.eu | gitea.cinay.eu | map.cinay.eu | static.cinay.eu | yanfi.net | yanfi.space | ebook.yanfi.space | searx.yanfi.space | zic.yanfi.space] (default: yanfi.space): zic.yanfi.space
Choose the path where this app should be installed (default: /redirect): /
Redirect destination path (default: http://127.0.0.1): http://127.0.0.1:4533
Redirect type [public_302 | public_301 | public_proxy | private_proxy] (default: public_302): public_proxy
Info: Installing redirect...
Info: [++++................] > Configuring NGINX web server...
Info: [####++++++++........] > Configuring permissions...
Info: [############++++....] > Reloading NGINX web server...
Info: [####################] > Installation of redirect__2 completed
Success! Installation completed
Modifier l’étiquette redirect
(zic.yanfi.space)
sudo yunohost app change-label redirect__2 'Audio Navidrome zic.yanfi.space'
Transmission
yunohost app install transmission
Sauvegardes Borg + Synchronisations
Borg -> Boîte de stockage
BorgBackup Yunohost –> Boîte de stockage
Le fichier de paramétrage borg : /etc/yunohost/apps/borg/settings.yml
Sauvegarde borg chaque jour à 3h20 du matin
Vérification des sauvegardes depuis yanfi.space (en mode su)
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=yes " borg list --short "$(yunohost app setting $app repository)"
[...]
_auto_conf-2022-04-22_03:20
_auto_data-2022-04-22_03:21
_auto_borg-2022-04-22_03:21
_auto_calibreweb-2022-04-22_03:21
_auto_gitea-2022-04-22_03:22
_auto_librespeed-2022-04-22_03:22
_auto_my_webapp-2022-04-22_03:22
_auto_my_webapp__2-2022-04-22_03:23
_auto_my_webapp__3-2022-04-22_03:23
_auto_nextcloud-2022-04-22_03:24
_auto_rainloop-2022-04-22_03:24
_auto_redirect-2022-04-22_03:24
_auto_redirect__2-2022-04-22_03:25
_auto_shaarli-2022-04-22_03:25
_auto_transmission-2022-04-22_03:25
Vérification des sauvegardes depuis PC1 archyann
Préalables :
- “passphrase” pour accéder au dépôt :
/home/yann/Private/.borg/yanfi.space.passphrase
- Clé privée SSH reconnue par le dépôt :
/home/yann/Private/.borg/yanfi.space.borgssh
- Le dépôt :
/home/yann/Private/.borg/yanfi.space.repository
export BORG_RSH="ssh -i /home/yann/Private/.borg/yanfi.space.borgssh"; \
export BORG_PASSPHRASE="`cat /home/yann/Private/.borg/yanfi.space.passphrase`"; \
export BORG_REPOSITORY="`cat /home/yann/Private/.borg/yanfi.space.repository`"; \
borg info $BORG_REPOSITORY
La commande
BORG_PASSPHRASE="$(cat /home/yann/Private/.borg/yanfi.space.passphrase)" BORG_RSH="ssh -i /home/yann/Private/.borg/yanfi.space.borgssh -oStrictHostKeyChecking=yes " borg info "$(cat /home/yann/Private/.borg/yanfi.space.repository)"
Patientez …
Repository ID: e5b89a291cb4c980c9a7cae1521903049bba020af2d40f07879a6d35070acf6f
Location: ssh://u277865@u277865.your-storagebox.de:23/./backup/borg/yanfi_space
Encrypted: Yes (repokey)
Cache: /home/yann/.cache/borg/e5b89a291cb4c980c9a7cae1521903049bba020af2d40f07879a6d35070acf6f
Security dir: /home/yann/.config/borg/security/e5b89a291cb4c980c9a7cae1521903049bba020af2d40f07879a6d35070acf6f
------------------------------------------------------------------------------
Original size Compressed size Deduplicated size
All archives: 10.46 GB 9.05 GB 4.47 GB
Unique chunks Total chunks
Chunk index: 51693 80670
Synchro /srv/datayan -> boîte de stockage
Seul le répertoire /home/ est accessible en écriture sur la Storage Box. Pour adresser des répertoires ou des fichiers sur le Storage Box, nous vous recommandons donc d’utiliser des chemins relatifs.
En mode super utilisateur (su
ou sudo -s
)
Création du dossier sur la boîte de stockage
sudo -s
echo -e "mkdir datayan \n chmod 775 datayan" | sftp -P 23 -i /root/.ssh/id_borg_ed25519 u277865@u277865.your-storagebox.de
Synchronisation du dossier /srv/datayan yanfi.space avec la boîte de stockage
sudo -s
rsync -avz --progress --delete -e 'ssh -p23 -i /root/.ssh/id_borg_ed25519 ' --recursive /srv/datayan/* u277865@u277865.your-storagebox.de:datayan/
Vérification
sudo -s
echo -e "ls datayan" | sftp -P 23 -i /root/.ssh/id_borg_ed25519 u277865@u277865.your-storagebox.de
Connected to u277865@u277865.your-storagebox.de.
sftp> ls datayan
datayan/BiblioCalibre datayan/CalibreTechnique datayan/musique
datayan/static datayan/www
Tester la réponse des serveurs distants peut être utilisée pour une automisation des procédures. Il faut installer netcat-openbsd
Automatiser la procédure par crontab
sudo -s
crontab -e
15 4 * * * rsync -avz --progress --delete -e 'ssh -p23 -i /root/.ssh/id_borg_ed25519 ' --recursive /srv/datayan/* u277865@u277865.your-storagebox.de:datayan/