Supported Ubuntu versions:
NodeSource will maintain Ubuntu distributions in active support by Canonical, including LTS and the intermediate releases.
- Ubuntu 14.04 LTS (Trusty Tahr) – not available for Node.js 10 and later
- Ubuntu 16.04 LTS (Xenial Xerus)
- Ubuntu 18.04 LTS (Bionic Beaver)
- Ubuntu 18.10 (Cosmic Cuttlefish)
Installing Node.js via package manager
# Using Ubuntu curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash - sudo apt-get install -y nodejs # Using Debian, as root curl -sL https://deb.nodesource.com/setup_11.x | bash - apt-get install -y nodejs
# Using Ubuntu curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - sudo apt-get install -y nodejs # Using Debian, as root curl -sL https://deb.nodesource.com/setup_10.x | bash - apt-get install -y nodejs
# Using Ubuntu curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs # Using Debian, as root curl -sL https://deb.nodesource.com/setup_8.x | bash - apt-get install -y nodejs
To check which version of Node.js you have installed after these initial steps, type:
If you’re not a fan of
curl <url> | bash -, or are using an unsupported distribution, you can try a manual installation.
These instructions assume
sudo is present, however some distributions do not include this command by default, particularly those focused on a minimal environment. In this case, you should install
su to root to run the commands directly.
1. Remove the old PPA if it exists
This step is only required if you previously used Chris Lea’s Node.js PPA.
# add-apt-repository may not be present on some Ubuntu releases: # sudo apt-get install python-software-properties sudo add-apt-repository -y -r ppa:chris-lea/node.js sudo rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list sudo rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list.save
2. Add the NodeSource package signing key
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - # wget can also be used: # wget --quiet -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
3. Add the desired NodeSource repository
# Replace with the branch of Node.js or io.js you want to install: node_6.x, node_8.x, etc... VERSION=node_8.x # The below command will set this correctly, but if lsb_release isn't available, you can set it manually: # - For Debian distributions: jessie, sid, etc... # - For Ubuntu distributions: xenial, bionic, etc... # - For Debian or Ubuntu derived distributions your best option is to use the codename corresponding to the upstream release your distribution is based off. This is an advanced scenario and unsupported if your distribution is not listed as supported per earlier in this README. DISTRO="$(lsb_release -s -c)" echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
4. Update package lists and install Node.js
sudo apt-get update sudo apt-get install nodejs