You can download this file from the browser or from the console. The latter is shown below (note: the specific Node.js version might be different for you):

Example :

wget http://nodejs.org/dist/v8.1.1/node-v8.1.1-linux-x64.tar.gz

sudo tar -C /usr/local --strip-components 1 -xzf node-v8.1.1-linux-x64.tar.gz

 #tar options:

 -x, --extract, --get
   extract files from an archive

 -f, --file ARCHIVE
   use archive file or device ARCHIVE

 -z, --gzip, --gunzip --ungzip`

You may find list of node version on http://nodejs.org/dist/

You should now have both Node.js and npm installed in “/usr/local/bin”. You can check this typing:

ls -l /usr/local/bin/node ls -l /usr/local/bin/npm

*An alternative way to install Node.js via the package manager:

Installing Node.js via package manager

Answer from Nullpointer on Stack Overflow
Top answer
1 of 13
59

You can download this file from the browser or from the console. The latter is shown below (note: the specific Node.js version might be different for you):

Example :

wget http://nodejs.org/dist/v8.1.1/node-v8.1.1-linux-x64.tar.gz

sudo tar -C /usr/local --strip-components 1 -xzf node-v8.1.1-linux-x64.tar.gz

 #tar options:

 -x, --extract, --get
   extract files from an archive

 -f, --file ARCHIVE
   use archive file or device ARCHIVE

 -z, --gzip, --gunzip --ungzip`

You may find list of node version on http://nodejs.org/dist/

You should now have both Node.js and npm installed in “/usr/local/bin”. You can check this typing:

ls -l /usr/local/bin/node ls -l /usr/local/bin/npm

*An alternative way to install Node.js via the package manager:

Installing Node.js via package manager

2 of 13
26

As @mckenzm had pointed out the approach of dumping the contents of the archive into the in-path folders like /usr/local/bin/ is not a great one. You will be in a lot of trouble when you have to remove this and upgrade to the next version due to some security issue.

The following are two approaches to follow

Manual installation

The approach to follow is to keep it in a way that it is easy to remove and upgrade, the way to do it is to keep all the stuff in one place and add that place to your path, for that One can do

sudo tar -xf node-v20.11.0-linux-x64.tar.xz --directory=/opt/

and add the bin folder to your $PATH variable using the following

echo 'export PATH="/opt/node-v20.11.0-linux-x64/bin/:$PATH"' >> ~/.bashrc && source ~/.bashrc

This is a better approach because you can remove it, and upgrade it easily compared to just dumping all the files in the /bin folder, like many, including my previously written answer ( deleted now ), are telling.

Now on any given day, you can remove the entire folder from /opt and replace it with the version you want or even you can use multiple versions at the same time.

Using tools like nvm

node version manager is a tool, that can be very useful, specially for personal use, when you might need more than one version, you can install it via reading the documentation - it is very simple to do and nvm is a very useful script - for more visit https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script

If you ask me, I prefer the nvm approach.

🌐
GitHub
github.com › nodejs › help › wiki › Installation
Installation · nodejs/help Wiki
December 17, 2021 - cd /opt wget https://nodejs.org/dist/latest-v10.x/node-v10.17.0-aix-ppc64.tar.gz VERSION=v10.17.0 DISTRO=aix-ppc64 sudo gunzip -c node-$VERSION-$DISTRO.tar.gz | tar -xvf- edit /etc/profile and add the following to the bottom · # Nodejs ...
Author   nodejs
🌐
Stack Abuse
stackabuse.com › how-to-install-node-js-on-ubuntu
How to Install Node.js on Ubuntu
January 21, 2016 - Just make sure you install the correct version for your system. They have binaries for all different version, operatings systems, and CPU architectures. If you're not exactly sure what the name of the binary will be for your system, try browsing through the distributions. In my case here, I needed version 5.1.0 for 64-bit Linux: wget http://nodejs.org/dist/v5.1.0/node-v5.1.0-linux-x64.tar.gz sudo tar -C /usr/local --strip-components 1 -xzf node-v5.1.0-linux-x64.tar.gz
🌐
YouTube
youtube.com › study read educate
How to Install Node.js in Ubuntu Using tar file - YouTube
Learn how to install node.js by using tar file in Ubuntu or linux.#nodejs #linux #ubuntu #ubuntunodejs
Published   September 25, 2019
Views   20K
🌐
TutorialKart
tutorialkart.com › nodejs › install-nodejs-ubuntu-linux
Install Node.js - Instructions for Ubuntu, Windows, MacOS & SunOS
November 29, 2020 - ~$ tar xvfz node-v8.4.0-linux-x64.tar.gz · Make nodejs directory in /usr/local/. Replace the file name, if it is different from what you have downloaded. ~$ sudo mkdir -p /usr/local/nodejs · Move the extracted nodejs package to /usr/local/nodejs/. ...
Top answer
1 of 2
31

If you want to install and switch between multiple versions of node then nvm (Node.js version manager) is better option.

  1. Check whether you have nvm or not. If not then you can pull down the nvm installation script from the project's GitHub page. The version number may be different, but in general, you can download it with curl:

    curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh
    

    Run the script with bash:

    bash install_nvm.sh
    

    It will install the software into a subdirectory of your home directory at ~/.nvm. It will also add the necessary lines to your ~/.profile file to use the file.

    To gain access to the nvm functionality, you'll need to log out and log back in again, or you can source the ~/.profile file so that your current session knows about the changes:

    source ~/.profile
    

  1. If you have multiple Node.js versions, you can see what is installed by typing:

    nvm ls
    
  2. You can install your specific node version by typing:

    nvm install 6.7.0
    
  3. If you wish to default one of the versions, you can type:

    nvm alias default 6.7.0
    
  4. Now you can also reference it by the alias like this:

    nvm use default
    
  5. Check now node version to verify whether changes are made or not by typing:

    node -v
    
2 of 2
9

If you only want to install tar.xz file from nodejs.org then follow below answer.

Try below links that might help you.

  1. Install NodeJS NPM on Linux

    if your downloaded NODE-LTS file is in *.tar.xz format, then replace:

    tar --strip-components 1 -xzf /usr/save/node-v4.2.1-linux-x64.tar.gz
    

    with

    tar --strip-components 1 -xf /usr/save/node-v4.2.1-linux-x64.tar.xz
    
  2. If the above method does not work, then follow this guide.


If these answers do not work, there is another way that works by using nvm. This method is specified in another answer.

🌐
techPiezo
techpiezo.com › nodejs › install-node-js-in-ubuntu-20-04-lts
Install Node.js in Ubuntu 20.04 LTS – techPiezo
Alternately, we can install LTS release through Linux Binaries available on official website of Node.js. Visit the official website of Node.js and on the Downloads page, click LTS tab & Linux Binaries (x64). It would download the package – node-v12.16.2-linux-x64.tar.xz.
Find elsewhere
🌐
GoLinuxCloud
golinuxcloud.com › home › ubuntu › how to install node.js on ubuntu from tar.xz? [solved]
How to install Node.js on Ubuntu from tar.xz? [SOLVED] | GoLinuxCloud
November 28, 2022 - foc@ubuntu22:~$ wget -q -O - http://127.0.0.1:8080 Hello World!foc@ubuntu22:~$ Great, the server worked! In this article, we explained how to install Node.js from the tar.gz file.
🌐
GitHub
github.com › nodejs › help › issues › 418
How do i install nodejs on Ubuntu 14.04 after downloading the package (.tar) from nodejs.org · Issue #418 · nodejs/help
December 23, 2016 - How do i install nodejs on Ubuntu 14.04 after downloading the package (.tar) from nodejs.org#418 · Copy link · Assignees · zenismaharjan · opened · on Dec 23, 2016 · Issue body actions · No description provided. gibfahn · No labels · No labels · No type ·
Author   zenismaharjan
🌐
Medium
iamsaleempasha.medium.com › install-node-js-and-npm-on-linux-rhel-7-from-binaries-tar-file-248d0b0f305f
Install Node.js and NPM on Linux (RHEL 7) from Binaries / Tar File - Saleem Pasha - Medium
March 16, 2021 - Unzip and install under /usr/local folder cd /usr/local tar --strip-components 1 -xzf /home/user/download/node-v12.14.1-linux-x64.tar.gz
🌐
Medium
medium.com › @rabbi.cse.sust.bd › install-nodejs-via-binary-archive-on-ubuntu-18-04-63118473d9e9
Install NodeJS via binary archive on Ubuntu 18.04 | by Md. Mehedi Hasan | Medium
May 20, 2019 - Install NodeJS via binary archive on Ubuntu 18.04 Step 1: Download linux binary from https://nodejs.org/en/download/. You can download LTS version or Current version. Step 2: Copy the binary archived …
🌐
Muhammetkucuk
muhammetkucuk.com › install-node-js-from-linux-tar-gz-file
Install Node.js from linux tar.gz file – Muhammet Küçük
December 14, 2019 - wget https://nodejs.org/dist/v12.13.1/node-v12.13.1-linux-x64.tar.gz sudo tar -C /usr/local --strip-components 1 -xzf node-v12.13.1-linux-x64.tar.gz #To verify our installation: node --version · If node.js’s website directs you to tar.xz file, change url with tar.gz.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-install-node-js-on-ubuntu-22-04
How to Install Node.js on Ubuntu (Step-by-Step Guide) | DigitalOcean
March 17, 2026 - wget https://nodejs.org/dist/v24.13.0/node-v24.13.0.tar.gz · For this example, we’re downloading v24.13.0 but you can replace this with the version you want to download. ... Navigate to the node-v24.13.0 folder and let’s configure the build. The ./configure script prepares the build environment: ... This will install Node.js to /usr/local which is the default.
🌐
Medium
medium.com › hackernoon › installing-node-js-on-windows-and-ubuntu-d5707ace435b
Installing node.js on Windows and Ubuntu | by K | HackerNoon.com | Medium
May 22, 2019 - There are various ways to install ... install build-essential $ wget http://nodejs.org/dist/v0.8.16/node-v0.8.16.tar.gz $ tar -xzf node-v0.8.16.tar.gz $ cd node-v0.8.16/ $ ./configure $ make $ sudo make install ·...
🌐
Medium
anandacdr.medium.com › how-to-install-node-tar-xz-in-linux-latest-version-of-node-3c5308e0861c
How to install node.tar.xz in Linux & Latest Version of Node - Ananda Chaudhary - Medium
April 19, 2023 - Steps to Download and Install Node in Ubuntu Linux · Step 1 : Download Latest Version of node.tar.xz file from official website · https://nodejs.org/en · Step 2 : Go to the directory where (.tar.xz file) is downloaded.
🌐
GitHub
gist.github.com › developeryashraj › 14fd206668936d1e9be2b818bf8b0be2
Installing Node on Ubuntu using tar.xz binary · GitHub
Run below command to install node. Do change file name with your downloaded file. sudo tar -C /usr/local --strip-components 1 -xf node-v8.11.4-linux-x64.tar.xz
🌐
GoogleIP
betanet.net › view-post › how-to-install-node-js-on-ubuntu-from-tar-gz-7113
How to Install Node.js on Ubuntu from tar.gz
Node.js is a popular runtime environment that allows you to run JavaScript on the server-side. In this guide, we will walk you through the process of installing Node.js on Ubuntu from a tar.gz file.
🌐
Codegrepper
codegrepper.com › code-examples › shell › how+to+install+node+tar.gz+in+ubuntu
how to install node tar.gz in ubuntu Code Example
July 28, 2022 - Download the desired .tar.gz or (.tar.bz2) file Open Terminal Extract the .tar.gz or (.tar.bz2) file with the following commands tar xvzf PACKAGENAME.tar.gz tar xvjf PACKAGENAME.tar.bz2 Navigate to the extracted folder using cd command cd ...