How to install a Specific Version of Node on Ubuntu Server
Solution 1
Install nodejs 6
Get your nodejs tarball from node site e.g. node-v6.11.3-linux-x64.tar.gz
from v6.11.3
wget https://nodejs.org/dist/v6.11.3/node-v6.11.3-linux-x64.tar.gz
Unpack provided archive files to /opt/nodejs
mkdir -p /opt/nodejs
tar -xvzf node-v6.11.3-linux-x64.tar.gz -C /opt/nodejs/
Create link to current node version
cd /opt/nodejs
mv node-v6.11.3-linux-x64 6.11.3
ln -s 6.11.3 current
Create link to current node binary
ln -s /opt/nodejs/current/bin/node /bin/node
Verify Node version
node -v
v6.11.3
Solution 2
Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one or more of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11, 13, 14, 15, 16, 17 and 18 are currently available, with the Snap Store being updated within hours or minutes of a Node.js release.
Node can be installed with a single command, for example:
sudo snap install node --classic --channel 11/stable
The node snap can be accessed by the command node
, for example:
$ node -v v11.5.0
An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:
sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config
Replace your-username
in the above command with your own username. Then run npm -v
to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn
and then updated the existing yarn package to the latest version with the command npm update yarn
Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:
sudo snap refresh node --channel=10/stable
Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel by switching with:
sudo snap switch node --edge
This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.
Node.js LTS schedule
Release | Status | Codename | Initial release | LTS Start | Maintenance Start | Maintenance End |
---|---|---|---|---|---|---|
6.x | EOL | Boron | 2016-04-26 | 2016-10-18 | 2018-04-30 | 2019-04-30 |
7.x | EOL | 2017-05-30 | 2017-06-30 | |||
8.x | EOL | Carbon | 2016-10-25 | 2017-10-31 | 2019-01-01 | 2019-12-31 |
9.x | EOL | 2017-10-01 | 2018-06-30 | |||
10.x | EOL | Dubnium | 2018-04-24 | 2018-10-30 | 2020-05-19 | 2021-04-30 |
11.x | EOL | 2018-10-23 | 2019-06-01 | |||
12.x | Maintenance LTS | Erbium | 2019-04-23 | 2019-10-21 | 2020-11-301 | 2022-04-30 |
13.x | EOL | 2019-10-22 | 2020-06-01 | |||
14.x | Maintenance LTS | Fermium | 2020-04-21 | 2020-10-27 | 2021-10-30 | 2023-04-30 |
16.x | Active LTS | Gallium | 2021-04-20 | 2021-10-26 | 2022-10-18 | 2024-04-30 |
17.x | Current | 2021-10-19 | 2022-04-01 | 2022-06-01 | ||
18.x | Current | 2022-04-19 | 2022-10-25 | 2023-10-18 | 2025-04-30 |
Related videos on Youtube
Rahul Singh
My Angular Blog Angular Concepts My React SSR Page React SSR My Github Contributions @ rahulrsingh09 Presently I am working with Amazon, on their new Venture https://amazon.academy.in, I very happy and privileged to be part of this team from scratch and can happily say that i make an impact to our Customer Needs About me, A Technology Nerd who Loves to Code in JavaScript, but luckily I can get my hands dirty on any language . Presently i have fallen for React, Redux, Stencil, ReactNative, Reusability across platfrom & NodeJS .
Updated on September 18, 2022Comments
-
Rahul Singh over 1 year
I am trying to install
Node 6.11.3
on my Ubuntu Server. I don't want to use nvm for this.I have already used this link but it just does not work out while using jenkins and stuff.
I want to specifically install NodeJS 6.11.3. How do I do that? Please help.
I tried this
sudo apt-get install nodejs=6.11.3
but nothing happens.Steps for NVM which I don't want to use
Please bear with me. This is my first attempt on anything on server and also on askUbuntu.
-
Rahul Singh over 6 yearsi might be really stupid asking this , but just on the base directly when we login i need to run this commands in sequence i have no idea on servers and installation my first hands on please help
-
Rahul Singh over 6 yearsAlso this file is downloaded locally how to get it up to the server ? i am noob so please dnt laugh
-
Rahul Singh over 6 yearsI am running this command
tar -xvzf node-v6.11.3-linux-x64.tar.gz -C /home/rahul/Downloads/
gives me error -
storm over 6 years1-Do you have ssh access to your server ? 2- You can move the tarball to the server with scp or use wget to download it directly if you have internet connexion
wget https://nodejs.org/dist/v6.11.3/node-v6.11.3-linux-x64.tar.gz
3- What's the error message you get after tar? -
Rahul Singh over 6 yearsI have ssh access to the server and a active internet connection, says no such file or directry
-
Rahul Singh over 6 yearswhen i run the mv node command i get this error
mv: cannot stat 'node-v6.11.3-linux-x64': No such file or directory
-
Rahul Singh over 6 yearsany idea @strom
-
storm over 6 yearsyou need to go where
node-v6.11.3-linux-x64
is , just cd to the path you gave to tar -C -
Rahul Singh over 6 yearsnode is installed but the third step thows error for me
sudo ln -s /opt/nodejs/current/bin/node /bin/node ln: failed to create symbolic link '/bin/node': File exists
-
Rahul Singh over 6 yearsI am up voting it but why the third step did not work ?
-
Rahul Singh over 6 yearsno it is a new box no node verison installed just the command didnot work . But while checking node -v shows 6.11.3 without that step will it fail. Or is it fine?
-
Rahul Singh over 6 yearsgreat . Hope u r right
-
Gautam almost 6 yearsincredible answer .. actually saved my day.. it allows me to easily switch between node / npm versions ( although with a little nix difficulty ) easily
-
Kevin Bowen over 5 yearsWhilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
-
chudasamachirag over 5 yearsThanks, @KevinBowen will update more information along with a link to justify my response as separate answer