Add file 'README.install-node.js'.

This commit is contained in:
Christoph 2023-12-11 14:59:47 +01:00
parent 7bb08995f9
commit 9062d788ab

View File

@ -1,28 +1,48 @@
# ----------
# - Install nodejs - (we use the official NodeJs LTS release)
# ----------
apt update && apt full-upgrade
# Install Prerequisites
#
apt install curl \
gpg \
gnupg2 \
software-properties-common \
ca-certificates \
curl \
gnupg \
apt-transport-https \
lsb-release ca-certificates
lsb-release
# Download and import the Nodesource GPG key
#
mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
# NODE_MAJOR=16
# NODE_MAJOR=18
# NODE_MAJOR=20
# Create debian repository
#
NODE_MAJOR=21
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
# Run update
#
apt update
# Install nodejs
#
apt install nodejs
node -v
npm -v
# ----------
# Uninstall nodejs Ubuntu & Debian packages
# ----------
# To completely remove Node.js installed from the deb.nodesource.com package methods above:
#
apt-get purge nodejs
rm -r /etc/apt/sources.list.d/nodesource.list
rm -r /etc/apt/keyrings/nodesource.gpg
apt update