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
🌐
npm
npmjs.com › package › node-tar.gz
node-tar.gz - npm
It's also possible to use tar.gz as a command line utility, you just need to install it globally with npm install -g tar.gz.
      » npm install node-tar.gz
    
Published   Aug 09, 2015
Version   1.0.0
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.

🌐
npm
npmjs.com › package › targz
targz - npm
TarGz for NodeJS. Latest version: 1.0.1, last published: 10 years ago. Start using targz in your project by running `npm i targz`. There are 166 other projects in the npm registry using targz.
      » npm install targz
    
Published   Aug 02, 2015
Version   1.0.1
Author   Miska Kaipiainen
🌐
GitHub
github.com › alanhoff › node-tar.gz
GitHub - alanhoff/node-tar.gz: ⚠️ DEPRECATED ⚠️ Native gzip compression and decompression utility for Node.js.
To interact with gzipped tarballs please use the tar module instead: https://www.npmjs.com/package/tar
Starred by 158 users
Forked by 36 users
Languages   JavaScript 100.0% | JavaScript 100.0%
🌐
Example Code
example-code.com › nodejs › gzip_tar_extract.asp
Node.js GZip Tar Extract (.tgz or .tar.gz)
Chilkat • HOME • Android™ • AutoIt • C • C# • C++ • Chilkat2-Python • CkPython • Classic ASP • DataFlex • Delphi DLL • Go • Java • Node.js • Objective-C • PHP Extension • Perl • PowerBuilder • PowerShell • PureBasic • Ruby • SQL Server • Swift • Tcl • Unicode C • Unicode C++ • VB.NET • VBScript • Visual Basic 6.0 • Visual FoxPro • Xojo Plugin
Find elsewhere
🌐
npm
npmjs.com › package › tar.gz
tar.gz - npm
October 22, 2017 - Please use tar module instead: https://npmjs.com/tar ... No one should be using this module since it's not being maintained anymore. This repository and the package will still be online for research purpose only.
      » npm install tar.gz
    
Published   Oct 22, 2017
Version   1.0.7
Author   Alan Hoffmeister
🌐
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 - Let’s be old school and use our terminal, I guess it’s downloaded in your Downloads folder, right? C’mon let’s navigate there and press a few buttons from our keyboards. (shortcut ctrl+alt+t for terminal) 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
🌐
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
🌐
Node.js
nodejs.org › dist › latest
Index of /dist/latest/
../ docs/ - - win-arm64/ - - win-x64/ - - SHASUMS256.txt.asc 01-Apr-2026 14:45 3.2 KB SHASUMS256.txt.sig 01-Apr-2026 14:45 119 B SHASUMS256.txt 01-Apr-2026 14:44 2.9 KB node-v25.9.0-aix-ppc64.tar.gz 01-Apr-2026 14:44 77 MB node-v25.9.0-arm64.msi 01-Apr-2026 14:44 30 MB node-v25.9.0-darwin-arm64.tar.gz 01-Apr-2026 14:44 54 MB node-v25.9.0-darwin-arm64.tar.xz 01-Apr-2026 14:44 28 MB node-v25.9.0-darwin-x64.tar.gz 01-Apr-2026 14:44 55 MB node-v25.9.0-darwin-x64.tar.xz 01-Apr-2026 14:44 30 MB node-v25.9.0-headers.tar.gz 01-Apr-2026 14:44 10.0 MB node-v25.9.0-headers.tar.xz 01-Apr-2026 14:44 580 KB
🌐
GitHub
github.com › coderaiser › node-inly
GitHub - coderaiser/node-inly: :outbox_tray: extract .zip, .gz, .bz2, .tar, .tar.gz, .tgz, .tar.bz2
:outbox_tray: extract .zip, .gz, .bz2, .tar, .tar.gz, .tgz, .tar.bz2 - coderaiser/node-inly
Starred by 22 users
Forked by 3 users
Languages   JavaScript 100.0% | JavaScript 100.0%
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.

🌐
Stack Overflow
stackoverflow.com › questions › 66334953 › nodejs-downloading-tar-gz-file-with-http-get
node.js - Nodejs downloading tar.gz file with HTTP get - Stack Overflow
Firstly: Is the file that i am downloading from the third party server in the http responses body or does the response have a body when downloading a file? Secondly: I don't want to save the file to my server, so how do I stream it to the clients http response. Is there a fileStreams that i should use or is there just regular streams. At the moment I'am trying to pipe the third party response to the clients responses body. I've played around with the server and I've gotten some gibberish to my client. When I "file upload.tar.gz" I get that its data and not gzip.
🌐
npm
npmjs.com › package › tar
tar - npm
March 23, 2026 - A writable stream that parses a tar archive stream. All the standard writable stream stuff is supported. If the archive is gzipped, then tar will detect this and unzip it.
      » npm install tar
    
Published   Mar 23, 2026
Version   7.5.13
🌐
npm
npmjs.com › package › download-package-tarball
download-package-tarball - npm
Download node at nodejs.org and install it, if you haven't already. ... /* eslint-disable import/no-extraneous-dependencies */ import download from 'download-package-tarball'; download({ // a npm tarball url will work url: 'https://registry...
      » npm install download-package-tarball
    
Published   Oct 04, 2017
Version   1.0.7
Author   David Björklund
Top answer
1 of 3
14

For anyone interested in the answer, it is possible using streams and the module tar-stream. Here is a complete example that extracts a file called documents.json from the archive archive.tar.gz:

var tar = require('tar-stream');
var fs = require('fs');
var zlib = require('zlib');

var extract = tar.extract();
var data = '';

extract.on('entry', function(header, stream, cb) {
    stream.on('data', function(chunk) {
    if (header.name == 'documents.json')
        data += chunk;
    });

    stream.on('end', function() {
        cb();
    });

    stream.resume();
});

extract.on('finish', function() {
    fs.writeFile('documents.json', data);
});

fs.createReadStream('archive.tar.gz')
    .pipe(zlib.createGunzip())
    .pipe(extract);
2 of 3
3

This is old, but Gianni's solution didn't quite work for me, maybe because he was extracting text files, I'm not sure.

Also, you can optimize quite a bit by only checking the header name once instead of for every data chunk for every file record.

var tar = require('tar-stream');
var fs = require('fs');
var zlib = require('zlib');

var extract = tar.extract();
var chunks = [];

extract.on('entry', function(header, stream, next) {
    if (header.name == 'documents.bin') {
        stream.on('data', function(chunk) {
            chunks.push(chunk);
        });
    }

    stream.on('end', function() {
        next();
    });

    stream.resume();
});

extract.on('finish', function() {
    if (chunks.length) {
        var data = Buffer.concat(chunks);
        fs.writeFile('documents.bin', data);
    }
});

fs.createReadStream('archive.tar.gz')
    .pipe(zlib.createGunzip())
    .pipe(extract);
🌐
GitHub
github.com › isaacs › node-tar
GitHub - isaacs/node-tar: tar for node · GitHub
A writable stream that parses a tar archive stream. All the standard writable stream stuff is supported. If the archive is gzipped, then tar will detect this and unzip it.
Starred by 911 users
Forked by 255 users
Languages   JavaScript 55.3% | TypeScript 44.6% | Shell 0.1%