Skip to content

Instantly share code, notes, and snippets.

@yspkm
Last active October 30, 2023 14:31
Show Gist options
  • Save yspkm/272b8b0fb8ca34d60ab3ef5221aa7611 to your computer and use it in GitHub Desktop.
Save yspkm/272b8b0fb8ca34d60ab3ef5221aa7611 to your computer and use it in GitHub Desktop.
New way to install node
# Installation Instructions Node.js
# If you're root, you could just ommit the sudo
#!/bin/bash
# Download and import the Nodesource GPG key
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
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
#Create deb repository
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
#Optional: NODE_MAJOR can be changed depending on the version you need.
#NODE_MAJOR=16
#NODE_MAJOR=18
#NODE_MAJOR=20
# Run Update and Install
sudo apt-get update
sudo apt-get install nodejs -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment