In this tutorial we will show you how to install Node js on Ubuntu 18.04. This method works for both local Linux machines and virtual private servers (VPS). You will also learn how to remove the too, just in case you want it.

What is Node.js?

Node.js is one of the most popular web technologies nowadays. It is used by many developers, as well as large companies, to increase the functionality of their applications. That is why it is possible to imagine its full potential.

In short, Node.js is a runtime environment on the server that allows JavaScript to operate without the client. Node.js is open source and cross platform compatible, making it ideal for different projects - from educational to business.

By the time we are writing this article, the latest version of Node.js is 12.4.0. But, the most recommended version for most users is 10.15.1.

There are several ways to install Node.js, but we will focus on the simpler ones. Install Node js and NPM from the Ubuntu Official Repository The fastest and easiest way to install Node.js on Ubuntu 18.04 server is through the official repository.

First, access your server via SSH.


ssh user@ip_address

If you are operating from a system with Ubuntu, just open an emulator terminal from the main menu.

Once connected, update the APT cache. To do this, execute the command:


sudo apt update

With this we make sure that the repositories are synchronized and the system can safely download what is stored in it.

Then, install Node.js with the following command:


sudo apt install nodejs

After entering the password, the installation will be started.

You can also install NPM, which is a management package from Node.js.


sudo apt install npm

After this, your installation is supposed to be complete. In case you want to remove node.js, just issue the following command:


sudo apt remove nodejs

Installing a Specific Version of Node.js with NVM Is there another way to install Node.js on a server with Ubuntu 18.04. With NVM (Node Version Manager), we can choose a specific version to be installed. It is great if you want to use an LTS version or the latest version available.

First, download NVM using wget. Run the following command:


sudo apt install wget

After, issue the following command:


wget -qO- | bash

Next step is to allow NVM to be used from your bash username. Just issue the command below:


source ~/.profile

Now, you can use NVM to show all the Node.js versions available to be installed:


nvm ls-remote

Feel free to choose any version you want. Because we need to maintain stability and good support, we recommend you to use the version 10.15.1. For this, run the following command:


nvm install 10.15.1

You can verify if the installation was successful by checking the Node.js version:


node -v

If the version you see in the output is the version you installed, you have your Node.js installed!


Node.js is an extremely useful technology for developing web applications. Installing it on Ubuntu 18.04 server is simple, all you have to do is follow one of the two methods we have just taught.