I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 18.04 LTS Bionic Beaver minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Node.js on Ubuntu 18.04
Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:
apt-get update -y apt-get upgrade -y apt-get install -y build-essential
Step 2. Installing Node.js on Ubuntu 18.04.
First, download and execute the Node.js 10.x installer:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
Run the following command to make sure that you install the latest version of Node.js:
apt update apt install nodejs
Also you can install npm (Node.js package manager) to install modules and packages. To install npm, run the command below:
apt install npm
Step 3. Verify Node.js Installation.
Check if the installation was successful, by printing the Node.js and npm versions:
$ node --version v6.5.0 $ npm -v 3.10.3
Congratulation’s! You have successfully install and configured Node.js on your Ubuntu 18.04 server. Thanks for using this tutorial installing Node.js on Ubuntu 18.04 LTS (Bionic Beaver) system.