Install NodeJS via binary archive on Ubuntu 18.04

Md. Mehedi Hasan
May 14, 2018 · 1 min read

Step 1: Download linux binary from You can download LTS version or Current version.

Step 2: Copy the binary archived file to a directory where you want to install NodeJS. I’ve used /opt/nodejs, Please make sure you have write access to that directory. I’ve downloaded the binary named:


Open terminal and write the following command:

cd /opt/

If you’ve no permission on that directory. Please add the following command for read/write permission:

sudo chmod -R 755 ./

Extract archived binary via:

tar xf node-v10.1.0-linux-x64.tar.xz

Step 3: Set the environment variable by editing ~/.profile. Write the following command:

nano ~/.profile

Add the following lines to the end:

# NodeJS
export NODEJS_HOME=/opt/node-v10.1.0-linux-x64/bin

Step 4: Refresh profile by:

. ~/.profile

Also add the lines inside ~/.bashrc file to the end of the file by:

nano ~/.bashrc

Step 5: Test Node installation via:

node -v

It should show the following output on terminal:


Also check the npm version via:

npm version

It should show the following output on terminal:

{ npm: ‘5.6.0’,
 ares: ‘1.14.0’,
 cldr: ‘33.0’,
 http_parser: ‘2.8.0’,
 icu: ‘61.1’,
 modules: ‘64’,
 napi: ‘3’,
 nghttp2: ‘1.29.0’,
 node: ‘10.1.0’,
 openssl: ‘1.1.0h’,
 tz: ‘2018c’,
 unicode: ‘10.0’,
 uv: ‘1.20.2’,
 v8: ‘6.6.346.27-node.6’,
 zlib: ‘1.2.11’ }

Happy coding. :)