Introduction
Node.js is a JavaScript runtime framework built on Chrome's V8 JavaScript engine for quickly building fast and scalable network applications. Node.js is lightweight and efficient because of its event-driven, non-blocking I/O approach. That's why Node.js is ideal for data-intensive real-time applications that operate across multiple devices.
You can install a Node server on Ubuntu using two methods.
- Ubuntu Official Repository to install node.js
- NodeSource Repository to install the latest version of Node.js
Also see, Difference Between Controller and Restcontroller
Install the Node server: Ubuntu Official Repository
Node.js is available in Ubuntu's Official repository and can be installed with only a few keystrokes. To install Node.js on your Ubuntu operating system, follow the steps below.
Step 1
Open your terminal (Ctrl + Alt + T) and run the following commands -
sudo apt install nodejs |
Enter your password and hit Enter.
Step 2
Verify the installation using the following command -
node -v // You can also use this command: node -version. |
You should see an output mentioning the Node.js version.
Important: Now, you have installed the Node server in your Ubuntu system. However, it is highly recommended to install NPM (Node Package Manager) alongside Node.js.
NPM is the package manager for the Node JavaScript platform. It is used for managing various server-side dependencies. It installs modules so that the Node server can find them and intelligently resolves dependency issues.
Step 3
You can install npm using the following command -
sudo apt install npm |
Step 4
Verify the installation -
npm -v |
You have successfully installed the Node server and NPM in your ubuntu system.