Skip to content

Instantly share code, notes, and snippets.

@190ikp
Last active January 15, 2023 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 190ikp/51febed3bc5a4744e02848ccd644ff28 to your computer and use it in GitHub Desktop.
Save 190ikp/51febed3bc5a4744e02848ccd644ff28 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -euo pipefail
# This script is based on NodeSource's repository.
# see: https://github.com/nodesource/distributions
# shellcheck disable=SC1091
source /etc/os-release
export NODE_VERSION=node_16.x
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key |
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/nodesource.gpg --import
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/$NODE_VERSION $VERSION_CODENAME main" |
sudo tee /etc/apt/sources.list.d/nodesource.list
echo "deb-src [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/$NODE_VERSION $VERSION_CODENAME main" |
sudo tee -a /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
# npm included
sudo apt-get install --yes nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment