To install a tar.gz file on Linux, you will need to use the Node.js command.

50πŸ‘

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 a list of Node.js versions on http://nodejs.org/dist/

You should now have both Node.js and npm installed in β€œ/usr/local/bin”. You can check this by 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

17πŸ‘

First, download the .tar.xz file from https://nodejs.org/en/. After the download is complete, press Ctrl + Alt + T to open your terminal.

Next, navigate to the location where you saved the downloaded file. In my case, it is the Downloads folder. Execute the following command to install Node.js:

sudo tar -xf node-v16.0.0-linux-x64.tar.xz --directory=/usr/local --strip-components=1
   

7πŸ‘

In order to install from source code, you will need to download the source code from https://nodejs.org/dist/v4.1.2/node-v4.1.2.tar.gz.

The file with the extension .tar.gz is a compressed file similar to a zip file. Before you can proceed with any other operations, you must first extract this file.

You can extract the file to any location you desire. To do this, open your terminal and navigate to the directory where the .tar.gz file is located:

$ cd /path/to/tar.gz/file

Next, use the tar command to extract the contents of the file:

$ tar xvzf node-v4.1.2.tar.gz

Once the extraction is complete, change your current directory to the extracted directory:

$ cd node-v4.1.2

Afterwards, you can proceed with running the .configure command and the β€˜make’ command:

$ ./configure
$ make
$ [sudo] make install

Read more

Leave a comment