3 if [[ $
(/usr
/bin
/id
-u) -ne 0 ]]; then
4 echo "\nMust run script as root."
8 # Add the NodeSource package signing key
9 curl
-sSL https
://deb.nodesource.com
/gpgkey
/nodesource.gpg.key | apt-key add
-
11 # Add the desired NodeSource repository
13 # The below command will set this correctly, but if lsb_release isn't available, you can set it manually:
14 # - For Debian distributions: jessie, sid, etc...
15 # - For Ubuntu distributions: xenial, bionic, etc...
16 DISTRO
="$(lsb_release -s -c)"
17 echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" |
tee /etc
/apt
/sources.list.d
/nodesource.list
18 echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" |
tee -a /etc
/apt
/sources.list.d
/nodesource.list
20 # Update package lists and install Node.js
22 apt-get
install nodejs