First, connect to your VPS server. You can do this using SSH (Secure Shell):
$ ssh username@your_server_ip
Replace “username” and “your_server_ip” with your real username and server IP address.
After successfully connecting to your VPS, follow the steps below to install Node.js:
1. Update package repository:
$ sudo apt-get update1. You need to install the software-properties-common package, which is required to manage your independent software vendor (ISV) software sources and adding PPAs etc:
$ sudo apt-get install software-properties-common1. Now, you need to install curl if not already installed:
$ sudo apt-get install curl1. After installing curl, use the command below to import the Node.js PPA in our system:
$ curl -sL https://deb.nodesource.com/setup\_14.x | sudo bash - You can replace “14.x” with the version number of Node.js you want to install.1. Once the Node.js PPA is added in your system, use the following commands to install Node.js:
$ sudo apt-get install nodejs1. Once completed, you can verify the installation and check the installed version of Node.js using the following command:
$ node -v1. The npm (Node Package Manager) will also be installed with Node.js. So you can check the installed version of npm also using the following command:
$ npm -vThat’s it! You have successfully installed Node.js on your VPS.
Note: The commands and processes may differ slightly depending on the type of VPS and the Ubuntu version you’re using.