HowtoNodeJS: New repository layout

This commit is contained in:
David Prevot 2024-05-10 15:12:44 +02:00
parent 3283e25423
commit b3e8037cc0

View file

@ -3,8 +3,8 @@ categories: web
title: Howto NodeJS
...
* Documentation : <https://nodejs.org/dist/latest-v10.x/docs/api/>
* Rôle Ansible : <https://forge.evolix.org/projects/ansible-roles/repository/show/nodejs>
* Documentation : <https://nodejs.org/dist/latest/docs/api/>
* Rôle Ansible : <https://gitea.evolix.org/evolix/ansible-roles/src/branch/stable/nodejs>
[Node.js](https://nodejs.org/) est une implémentation libre en langage Javascript orientée pour les applications réseau événementielles. Node.js intègre une bibliothèque HTTP permettant de faire tourner un serveur web, notamment en utilisant le protocole [WebSocket](https://fr.wikipedia.org/wiki/WebSocket).
@ -20,31 +20,18 @@ En temps normal, nous préconisons l'installation de NodeJS avec les paquets Deb
> **Note** : On va avoir tendence à préférer les versions *paires* de NodeJS qui sont des version à support long terme (LTS)
### Utilisation de NodeSource (**Stretch**, **Buster** et **Bullseye**)
### Utilisation de NodeSource
L'url du dépot à utiliser suit le modèle `https://deb.nodesource.com/<VERSION_NODEJS> <DISTRIBUTION_LINUX> main`
L'url du dépot à utiliser suit le modèle `https://deb.nodesource.com/node_<VERSION>.x nodistro main`
Avec `<DISTRIBUTION_LINUX>` étant le nom de code de la distribution :
* *stretch*
* *buster*
* *bullseye*
Et `<VERSION_NODEJS>` étant la branche de version souhaitée :
Avec `<VERSION>` étant la branche de version souhaitée : 10, 12, 13, 16, 18, 20, 22, etc.
* *node_10.x*
* *node_12.x*
* *node_14.x*
* *node_16.x*
* *node_18.x*
* *node_20.x* : Version LTS actuelle
Exemple pour avoir la version 18.x en Debian 11 (bullseye)
Exemple pour avoir la version 22.x
~~~
# apt install apt-transport-https
# echo "deb https://deb.nodesource.com/node_20.x $(awk -F= '/VERSION_CODENAME/{print $2}' /etc/os-release) main" > /etc/apt/sources.list.d/nodesource.list
# wget https://deb.nodesource.com/gpgkey/nodesource.gpg.key -O /etc/apt/trusted.gpg.d/nodesource.asc
# echo "deb https://deb.nodesource.com/node_22.x nodistro main" > /etc/apt/sources.list.d/nodesource.list
# wget https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key -O /etc/apt/trusted.gpg.d/nodesource.asc
# chmod 644 /etc/apt/trusted.gpg.d/nodesource.asc
# apt update && apt install nodejs
@ -58,8 +45,8 @@ Nous préconisons l'installation des paquets Debian distribués par NodeSource (
~~~
# apt install apt-transport-https
# echo "deb http://deb.nodesource.com/node_10.x buster main" >> /etc/apt/sources.list.d/nodesource.list
# wget https://deb.nodesource.com/gpgkey/nodesource.gpg.key -O /etc/apt/trusted.gpg.d/nodesource.asc
# echo "deb http://deb.nodesource.com/node_10.x nodistro main" >> /etc/apt/sources.list.d/nodesource.list
# wget https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key -O /etc/apt/trusted.gpg.d/nodesource.asc
# chmod 644 /etc/apt/trusted.gpg.d/nodesource.asc
# apt update && apt install nodejs