Skip to content

Instantly share code, notes, and snippets.

@agmm
Last active March 10, 2020 18:56
Show Gist options
  • Save agmm/80c58ca8114abd5d16259488a601fd4f to your computer and use it in GitHub Desktop.
Save agmm/80c58ca8114abd5d16259488a601fd4f to your computer and use it in GitHub Desktop.
Script to install N, Node and NPM in a Debian machine
# To run this script execute:
# curl -L https://gist.githubusercontent.com/agmm/80c58ca8114abd5d16259488a601fd4f/raw/1a016ca9e6e9281a57a931c6209ba41dc7ea27d7/debian-install-node.sh -o setup && sudo bash setup
echo -e "\n\nRemember to run with sudo"
# Exit if one of the commands fails
set -e
set -o pipefail
# Install Git
echo -e "\nInstalling Git"
apt-get install git
# Configure git credentials cache to last 1hr
echo -e "\nConfiguring Git cache time"
git config --global credential.helper 'cache --timeout=3600'
# Download and install the node manager named n
echo -e "\nDownloading node manager"
curl -L https://raw.githubusercontent.com/tj/n/master/bin/n -o n
echo -e "\nInstalling the latest version of Node"
bash n lts
# Echo the version of Node
echo -e "\nNode version"
node -v
# Echo the version of NPM
echo -e "\nNPM version"
npm -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment