peertube_installation_et_configuration
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| peertube_installation_et_configuration [2021/04/21 13:27] – Benjamin Labomedia | peertube_installation_et_configuration [2024/01/24 23:02] (Version actuelle) – n1c0 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | ====== Peertube | + | ====== Peertube |
| - | **Peertube est un logiciel libre pour reprendre le contrôle de vos vidéos en ligne.** | + | <WRAP center round important 60%> |
| + | Attention, ce tuto est plutôt obsolète. Mieux vaut voir [[https:// | ||
| + | </ | ||
| + | |||
| + | |||
| + | **Peertube est un logiciel libre semblable à Youtube | ||
| PeerTube, développé par Framasoft, est l' | PeerTube, développé par Framasoft, est l' | ||
| Ligne 11: | Ligne 16: | ||
| {{:: | {{:: | ||
| - | ===== Installation sur Debian 10 apache===== | + | ===== Installation sur Debian 10 ===== |
| + | |||
| + | On utilisera le serveur Apache pour rendre visible Peertube sur les Internets à l' | ||
| + | |||
| + | **Important** : ce tutoriel n' | ||
| On installe au préalable quelques outils : | On installe au préalable quelques outils : | ||
| + | |||
| apt install htop nano nload iotop wget locate tmux net-tools | apt install htop nano nload iotop wget locate tmux net-tools | ||
| - | [[https:// | + | On commence ensuite en suivant |
| + | |||
| + | Il y aura un choix à faire sur le format des vidéos et de la diffusion : [[https:// | ||
| + | |||
| + | ==== Pré-requis ==== | ||
| + | |||
| + | On a besoin de plusieurs programmes, dont [[https:// | ||
| + | |||
| + | < | ||
| + | apt install curl | ||
| + | curl -sL https:// | ||
| + | curl -sS https:// | ||
| + | echo "deb https:// | ||
| + | apt update | ||
| + | apt install unzip xz-utils nodejs yarn ffmpeg postgresql postgresql-contrib postgresql postgresql-client g++ make redis-server | ||
| + | </ | ||
| + | |||
| + | ==== Création d'un user spécifique ==== | ||
| + | |||
| + | On décide d' | ||
| + | |||
| + | < | ||
| + | mkdir -p / | ||
| + | useradd -s /bin/bash -d / | ||
| + | chown -R peertube: / | ||
| + | chmod 2775 / | ||
| + | </ | ||
| + | |||
| + | ==== Création de la Base de données ==== | ||
| + | |||
| + | Peertube utilise [[https:// | ||
| + | |||
| + | < | ||
| + | su - postgres | ||
| + | createuser peertube -d -P -R | ||
| + | createdb -O peertube peertube | ||
| + | psql -c " | ||
| + | psql -c " | ||
| + | exit | ||
| + | </ | ||
| + | |||
| + | ==== Création des répertoires de base ==== | ||
| + | |||
| + | Peertube utilisera ces répertoires pour fonctionner. Toujours dans le dossier **/ | ||
| + | |||
| + | < | ||
| + | su - peertube | ||
| + | mkdir -p config storage versions etc var/ | ||
| + | cd versions | ||
| + | </ | ||
| + | |||
| + | ==== Téléchargement de la dernière version ==== | ||
| + | |||
| + | On récupère la dernière version, on la décompresse, | ||
| + | |||
| + | < | ||
| + | VERSION=$(curl -s https:// | ||
| + | wget -q " | ||
| + | tar -xJf peertube-${VERSION}.tar.xz | ||
| + | rm -f peertube-${VERSION}.tar.xz | ||
| + | cd ../ | ||
| + | ln -s versions/ | ||
| + | </ | ||
| + | |||
| + | ==== Installation ==== | ||
| + | |||
| + | On entre dans le dossier de la dernière version, puis, grâce à Yarn, on install les dépendances de Peertube. Ensuite on copie les modèles de config dans notre dossier **config** précédemment créé : ce sont ces fichiers que l'on modifie pour la configuration. | ||
| + | |||
| + | < | ||
| + | cd ./ | ||
| + | yarn install --production --pure-lockfile | ||
| + | cp ./ | ||
| + | cp ./ | ||
| + | cp ./ | ||
| + | </ | ||
| + | |||
| + | ==== Configuration ==== | ||
| + | |||
| + | On modifie le fichier de config : | ||
| + | |||
| + | nano / | ||
| + | |||
| + | Le fichier est long, mais une partie de la config pourra se faire directement dans l' | ||
| + | |||
| + | **Important** : Supprimer le suffixe ' | ||
| + | |||
| + | < | ||
| + | ... | ||
| + | webserver: | ||
| + | https: true | ||
| + | hostname: ' | ||
| + | port: 443 | ||
| + | ... | ||
| + | database: | ||
| + | hostname: ' | ||
| + | port: 5432 | ||
| + | suffix: '' | ||
| + | username: ' | ||
| + | password: ' | ||
| + | ... | ||
| + | storage: | ||
| + | tmp: '/ | ||
| + | avatars: '/ | ||
| + | videos: '/ | ||
| + | streaming_playlists: | ||
| + | redundancy: '/ | ||
| + | logs: '/ | ||
| + | previews: '/ | ||
| + | thumbnails: '/ | ||
| + | torrents: '/ | ||
| + | captions: '/ | ||
| + | cache: '/ | ||
| + | plugins: '/ | ||
| + | ... | ||
| + | instance: | ||
| + | name: 'Mon instance !' | ||
| + | short_description: | ||
| + | description: | ||
| + | </ | ||
| + | |||
| + | Pour la configuration email, lorsqu' | ||
| + | |||
| + | email: | ||
| + | enabled: true | ||
| + | et pour la configuration smtp par exemple : | ||
| + | |||
| + | < | ||
| + | # SMTP server to send emails | ||
| + | smtp: | ||
| + | # smtp or sendmail | ||
| + | transport: smtp | ||
| + | # Path to sendmail command. Required if you use sendmail transport | ||
| + | sendmail: null | ||
| + | hostname: mail.monmail.net | ||
| + | port: 587 # If you use StartTLS: 587 | ||
| + | username: bot@mondomaine.org | ||
| + | password: **** | ||
| + | tls: false # If you use StartTLS: false - was true | ||
| + | disable_starttls: | ||
| + | ca_file: null # Used for self signed certificates | ||
| + | from_address: | ||
| + | |||
| + | </ | ||
| + | ==== Optimisation et démarrage ==== | ||
| + | |||
| + | On copie la config spécifique TCP de Peertube au bon endroit (elle permet de gérer l' | ||
| + | |||
| + | cp / | ||
| + | |||
| + | Pour démarrer Peertube, on ajoute son service aux daemons du système pour qu'il démarre tout seul au boot de la machine et que l'on puisse le démarrer / arrêter manuellement. | ||
| + | |||
| + | cp / | ||
| + | |||
| + | Modifier ce nouveau fichier en mettant le bon PATH de la config de votre instance Peertube, et celui de l' | ||
| + | |||
| + | < | ||
| + | ... | ||
| + | Environment=NODE_CONFIG_DIR=/ | ||
| + | ... | ||
| + | WorkingDirectory=/ | ||
| + | </ | ||
| + | |||
| + | Enfin, on reload les daemons, on active celui de peertube, on le démarre et on consulte son status : | ||
| + | |||
| + | < | ||
| + | systemctl daemon-reload | ||
| + | systemctl enable peertube | ||
| + | systemctl start peertube | ||
| + | systemctl status peertube | ||
| + | </ | ||
| + | |||
| + | ==== Compte admin de Peertube ==== | ||
| + | |||
| + | Par défaut, Peertube crée le compte administrateur principal, nommé **root**, sans mot de passe. Malheureusement on ne peut pas le renommer. On doit donc créé un mot de passe, en tant que l' | ||
| + | |||
| + | < | ||
| + | su - peertube | ||
| + | cd peertube-latest | ||
| + | NODE_CONFIG_DIR=/ | ||
| + | </ | ||
| + | |||
| + | ==== Apache2 et Certificat SSL ==== | ||
| + | |||
| + | On va utiliser Apache comme Proxy vers le port de Peertube par défaut (9000), il faut l' | ||
| + | |||
| + | < | ||
| + | apt install apache2 | ||
| + | a2enmod proxy proxy_http proxy_wstunnel ssl http2 rewrite headers | ||
| + | </ | ||
| + | |||
| + | On installe aussi [[https:// | ||
| + | |||
| + | < | ||
| + | apt install snapd | ||
| + | snap install core | ||
| + | snap install hello-world | ||
| + | snap refresh core | ||
| + | snap install --classic certbot | ||
| + | ln -s / | ||
| + | </ | ||
| + | |||
| + | Pour générer ce premier certificat, on va utiliser le //vhost// par défaut d' | ||
| + | |||
| + | < | ||
| + | cd / | ||
| + | nano 000-default.conf | ||
| + | </ | ||
| + | |||
| + | Changer le **ServerName** puis quitter nano et reload apache : | ||
| + | |||
| + | systemctl reload apache2 | ||
| + | |||
| + | Lancer la création du certificat via la commande suivante qui demandera quel vhost est concerné (choisir 000-default.conf donc) : | ||
| + | |||
| + | certbot certonly --apache | ||
| + | |||
| + | Enfin, on défini le vhost en créant le fichier **/ | ||
| + | |||
| + | < | ||
| + | < | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | < | ||
| + | ServerName videos.monsite.org | ||
| + | |||
| + | LogLevel error | ||
| + | ErrorLog " | ||
| + | CustomLog " | ||
| + | |||
| + | |||
| + | SSLEngine on | ||
| + | SSLCertificateFile / | ||
| + | SSLCertificateKeyFile / | ||
| + | |||
| + | # HSTS (mod_headers is required) (63072000 seconds = 2 years) (only activate it knowingly) | ||
| + | ## initialement commenté | ||
| + | Header always set Strict-Transport-Security " | ||
| + | |||
| + | Header always set X-Content-Type-Options nosniff | ||
| + | Header always set X-Robots-Tag none | ||
| + | Header always set X-XSS-Protection "1; mode=block" | ||
| + | |||
| + | # Activate http/2 | ||
| + | Protocols h2 h2c http/1.1 | ||
| + | |||
| + | H2Push | ||
| + | H2PushPriority | ||
| + | H2PushPriority | ||
| + | H2PushPriority | ||
| + | H2PushPriority | ||
| + | H2PushPriority | ||
| + | |||
| + | # Hard limit, PeerTube does not support videos > 4GB | ||
| + | LimitRequestBody 4294967294 | ||
| + | |||
| + | # Set caching on assets for 1 year | ||
| + | < | ||
| + | Header append Cache-Control " | ||
| + | </ | ||
| + | AliasMatch ^/ | ||
| + | |||
| + | # Set caching on image files for 1 year | ||
| + | < | ||
| + | Header append Cache-Control " | ||
| + | </ | ||
| + | AliasMatch ^/ | ||
| + | |||
| + | # Bypass PeerTube webseed route for better performances | ||
| + | Alias / | ||
| + | < | ||
| + | # Clients usually have 4 simultaneous webseed connections, | ||
| + | SetOutputFilter RATE_LIMIT | ||
| + | SetEnv rate-limit 800 | ||
| + | |||
| + | SetEnvIf Request_Method " | ||
| + | |||
| + | Header set Access-Control-Allow-Origin " | ||
| + | Header set Access-Control-Allow-Headers " | ||
| + | Header set Access-Control-Allow-Methods "GET, OPTIONS" | ||
| + | Header set toto " | ||
| + | SetEnvIf GETMETH " | ||
| + | |||
| + | SetEnvIf Request_Method " | ||
| + | |||
| + | Header set Access-Control-Allow-Origin " | ||
| + | Header set Access-Control-Allow-Headers " | ||
| + | Header set Access-Control-Allow-Methods "GET, OPTIONS" | ||
| + | Header set Access-Control-Max-Age " | ||
| + | Header set Content-Type " | ||
| + | Header set Content-Length " | ||
| + | </ | ||
| + | < | ||
| + | Header unset X-Frame-Options | ||
| + | </ | ||
| + | |||
| + | ProxyPreserveHost On | ||
| + | ProxyRequests On | ||
| + | ProxyTimeout 600 | ||
| + | |||
| + | # Websocket tracker | ||
| + | RewriteEngine On | ||
| + | RewriteCond %{HTTP: | ||
| + | RewriteRule /(.*) ws:// | ||
| + | |||
| + | < | ||
| + | ProxyPass http:// | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | # Config SSL | ||
| + | |||
| + | # Security configuration | ||
| + | SSLCipherSuite | ||
| + | SSLProtocol | ||
| + | SSLHonorCipherOrder | ||
| + | # Requires Apache >= 2.4 | ||
| + | SSLCompression | ||
| + | # To use stapling, we have to enable it globally | ||
| + | SSLStaplingCache | ||
| + | # OCSP Stapling requires Apache >= 2.3.3 | ||
| + | SSLUseStapling | ||
| + | SSLStaplingResponderTimeout | ||
| + | SSLStaplingReturnResponderErrors | ||
| + | SSLSessionTickets | ||
| + | </ | ||
| + | |||
| + | Activer le vhost et reload apache : | ||
| + | |||
| + | < | ||
| + | a2ensite videos.monsite.org.conf | ||
| + | systemctl reload apache2 | ||
| + | </ | ||
| + | ==== Configurations complémentaires ==== | ||
| + | |||
| + | === Installer les outils en ligne de commande === | ||
| + | |||
| + | Il faut suivre [[https:// | ||
| + | |||
| + | Pour installer les outils CLI, il faut cloner le dépôt Peertube dans un répertoire autre que celui de l' | ||
| + | |||
| + | < | ||
| + | cd / | ||
| + | git clone https:// | ||
| + | cd PeerTube | ||
| + | </ | ||
| + | |||
| + | Installation des dépendances et compilation des CLI tools : | ||
| + | |||
| + | < | ||
| + | NOCLIENT=1 yarn install --pure-lockfile | ||
| + | npm run setup:cli | ||
| + | </ | ||
| + | |||
| + | Puis dans le fichier **/ | ||
| + | |||
| + | alias peertube=" | ||
| + | |||
| + | On prend en compte les modifications : | ||
| + | |||
| + | source .bashrc | ||
| + | |||
| + | ==== Sauvegarde ==== | ||
| + | |||
| + | Il faut sauvegarder les fichiers et dossiers créés ou modifiés pour Peertube ainsi que la base de données PostgreSQL. | ||
| + | |||
| + | Liste des fichiers et dossiers : | ||
| + | |||
| + | * Dossier Peertube : / | ||
| + | * Config réseau : / | ||
| + | * Config du daemon/ | ||
| + | * Vhost apache : / | ||
| + | * Les outils CLI : / | ||
| + | |||
| + | En réalité, on ne sauve que les éléments qui changent, c'est à dire le dossier d' | ||
| + | |||
| + | Pour la base de données, en tant que root, on execute la commande suivante. Elle crée un dossier **/ | ||
| + | |||
| + | <code bash> | ||
| + | SQL_BACKUP_PATH=" | ||
| + | </ | ||
| + | |||
| + | ==== Mise à jour ==== | ||
| + | Suivre les préconisations de [[https:// | ||
| + | |||
| + | ==== Désactiver les commentaires ==== | ||
| + | A ce jour, il n'y a pas de mécanique pour désactiver les commentaires, | ||
| + | |||
| + | ==== Mettre un captcha à l' | ||
| + | Via le système de plug-in de peertube, on a installé https:// | ||
| + | ===== Pratique ===== | ||
| + | |||
| + | ==== Import de toutes les vidéos d'une chaine Youtube ou Vimeo ==== | ||
| + | |||
| + | Pour importer les vidéos d'un compte Vimeo, on peut executer une commande qui fera tout ce qu'il faut. Remplacer les noms en majuscules par vos propres informations. **TARGET_URL** est l'url du compte chez Vimeo, par exemple https:// | ||
| + | |||
| + | **Important** : il faut se mettre dans le répertoire contenant le clone de Peertube utilisé pour initialiser les outils CLI vu plus haut. | ||
| + | |||
| + | En ligne de commande depuis le serveur en tant que user non root : | ||
| + | |||
| + | node dist/ | ||
| + | |||
| + | Les vidéos seront alors importées et disponible dans le compte de l' | ||
| + | |||
| + | Les options : | ||
| + | < | ||
| + | .option(' | ||
| + | .option(' | ||
| + | .option(' | ||
| + | .option(' | ||
| + | .option(' | ||
| + | .option(' | ||
| + | .option(' | ||
| + | .option(' | ||
| + | .option(' | ||
| + | .usage(" | ||
| + | .parse(process.argv) | ||
| + | |||
| + | </ | ||
| + | ==== Editorialiser la page découvrir ==== | ||
| + | Il faut apparemment [[https:// | ||
| + | |||
| + | ==== Streaming live d'une session Jitsi dans Peertube ==== | ||
| + | * [[https:// | ||
| - | Il y a un choix à faire sur le format des vidéos et de la diffusion : [[https://docs.joinpeertube.org/admin-configuration? | + | ==== Embed Peertube dans dokuwiki ==== |
| + | Voir [[https://www.dokuwiki.org/plugin: | ||
| - | {{tag>bj futuretic peertube serveur}} | + | {{tag> |
peertube_installation_et_configuration.1619011663.txt.gz · Dernière modification : de Benjamin Labomedia
