1

I am pretty new to ubuntu and wanted to start programming in ubuntu. I wanted to install node js in ubuntu. I have downloaded node-v6.9.2-linux-x64.tar.xz file from node js website. I do not have previous experience in installing from file (used only ubuntu software center). if anybody can explain step by step or with some screenshots, that will be helpful. Whenever I am reading some links, I did not understand whether i need to type some commands in terminal or just a click as in windows. even if it is typing in terminal, whether i need to go to the folder or whatever actions need to be performed, please give an idea in detail.

Any help will be appreciated. Thanks in advance.

4 Answers 4

3

According to the official website you can install node-v6.x as follow:

sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
0
1

Install Node.js (node-v6.9.4-linux-x64.tar.xz)

Download and extract the Node.js "Linux Binaries" package. For example, if you downloaded version 6.9.4 for 64-bit you could install Node.js into /opt:

cd /opt
tar -Jxf node-v6.9.4-linux-x64.tar.xz

Set PATH to include Node.js:

export PATH=/opt/node-v6.9.4-linux-x64/bin:$PATH
1

Update

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=11/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

Original revision

The node-v6.9.2-linux-x64.tar.xz file which you downloaded contains the compiled Node.js Linux 64-bit binary (a file named node) which can be run locally without installing it into a system directory. To install the same version of Node.js globally, you need to download and install the source code file instead from the same webpage.

sudo apt install curl build-essential gcc make
curl -O https://nodejs.org/dist/v6.9.2/node-v6.9.2.tar.gz
tar xzf node-v6.9.2.tar.gz  
cd node-v6.9.2
./configure
make
sudo make install # installs this version of Node.js into a system directory
1
  • when i gave the command, ./configure -> no such file or directory. then make -> no make file found
    – manjs
    Dec 22, 2016 at 16:42
0

You own a distribution, so use it:

apt-get install nodejs

Or use ubuntu sw center. Search for nodejs then click to install.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.