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.

🌐
MageComp
magecomp.com › home › nodejs › how to install node.js on mac?
How to Install Node.js on Mac?
September 8, 2023 - Step 1: Visit Node.js site https://nodejs.org/en/download · Step 2: Click on the appropriate installer for Mac (.pkg or .tar.gz) to download the Node.js installer. Step 3: Once downloaded, click on the installer to start the node.js installation ...
Discussions

macos - Install .tar.gz on MAC - Stack Overflow
I failed to understand the INSTALL.md file. I know few programming knowledge. I appreciate anyone can give me a thorough explanation or instruction. The software I wanna install is https://sourcefo... More on stackoverflow.com
🌐 stackoverflow.com
node.js - How to install node.tar.xz file in linux - Stack Overflow
I recently downloaded the Nodejs file from the official site and I don't know how to install the Nodejs from a archived file. Please help me how can I install this file so that I can run the "... More on stackoverflow.com
🌐 stackoverflow.com
How do i install nodejs on Ubuntu 14.04 after downloading the package (.tar) from nodejs.org
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 · More on github.com
🌐 github.com
15
December 23, 2016
How do I install a .tar.gz file onto a Mac - Apple Community
I am completely lost on installing this kind of file. I know it's something to do with the Terminal. I'm not sure if this is the right forum. ... A file ending with tar.gz is a zipped (compressed) file. If you double click the file it should automatically unzip using the Mac's built-in software. More on discussions.apple.com
🌐 discussions.apple.com
August 3, 2009
🌐
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/. Provide user password if asked.
🌐
Rheinwerk Computing
blog.rheinwerk-computing.com › how-to-install-node.js-on-windows-mac-and-linux-systems
How to Install Node.js on Windows, Mac, and Linux Systems
April 24, 2025 - The package is available as a zipped tar archive, and all you have to do is unzip it on the command line, as shown here. $ wget https://nodejs.org/dist/v16.8.0/node-v16.8.0-darwin-x64.tar.gz ·
Find elsewhere
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.

🌐
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
🌐
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
🌐
Blogger
stuckinerror.blogspot.com › home › how to install node.js › how to install node js tar.gz file
How to install node js tar.gz file
November 18, 2017 - Installation on UNIX/Linux/Mac OS X, and SunOS Based on your OS architecture, download and extract the archive node-v4.2.1- osname...
🌐
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
🌐
TutorialsTeacher
tutorialsteacher.com › nodejs › setup-nodejs-development-environment
Install Node.js on Windows or Mac
Visit Node.js official web site https://nodejs.org/en/download page. Click on the appropriate installer for Mac (.pkg or .tar.gz) or Linux to download the Node.js installer. Once downloaded, click on the installer to start the Node.js installation ...
🌐
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
🌐
Jason McCreary
jasonmccreary.me › articles › installing-node-js-npm-redis-mac-os-x
Installing Node.js, npm, and redis on Mac OS X
December 10, 2011 - 6curl http://nodejs.org/dist/node-v0.4.7.tar.gz | tar xz --strip-components=1 · 7./configure --prefix=~/local · 8make install · A few notes. First, this installs Node.js version 0.4.7. From what I read, this is currently the most compatible version. If you require a different version, I'll assume you know more about installing Node.js than me. Second, bash on Mac OS X uses .bash_profile not .bashrc.
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › software & applications
Need help installing Node.js (tar.xz) - Linux Mint Forums
December 29, 2021 - tar -xvf 'node-v16.13.1-linux-... Failing that, Node.JS is already in the Ubuntu (therefore Linux Mint) repositories, so you can just: sudo apt-get install nodejs...
🌐
Kcaran
kcaran.com › posts › adding-nodejs-to-macos.html
Adding Nodejs to MacOS | Keith's Krazy Web Site
July 29, 2025 - ARM64: For newer Macs with Apple Silicon (M1, M2, M3, etc.). ... This will download a file like node-v20.16.0-darwin-arm64.tar.gz into your Downloads folder. Now, we’ll unpack the archive and copy the files to /usr/local, a standard directory for user-installed software on macOS and other ...
🌐
Apple Community
discussions.apple.com › thread › 2103404
How do I install a .tar.gz file onto a Mac - Apple Community
August 3, 2009 - I am completely lost on installing this kind of file. I know it's something to do with the Terminal. I'm not sure if this is the right forum. ... A file ending with tar.gz is a zipped (compressed) file. If you double click the file it should automatically unzip using the Mac's built-in software.
🌐
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 - How to install node.tar.xz in Linux & Latest Version of Node Steps to Download and Install Node in Ubuntu Linux Step 1 : Download Latest Version of node.tar.xz file from official …