How to Install Node.js on Linux
Table of Contents
Node.js is a popular open-source server-side runtime environment that allows you to build scalable and high-performance web applications. It uses an event-driven, non-blocking I/O model, making it efficient and lightweight. Installing Node.js on Linux is a straightforward process that can be done using package managers or from the official Node.js website. In this guide, we will show you how to install Node.js on some of the most popular Linux distributions.
Debian/Ubuntu-based distros
Step 1: Update your system:
sudo apt update
Step 2: Install the cURL package if not already installed:
sudo apt install curl
Step 3: Download and install the Node.js setup script:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash –
Note: You can replace 16.x with any other Node.js version you want to install.
Step 4: Install Node.js:
sudo apt install nodejs
Step 5: Verify that Node.js is installed properly:
node -v
Fedora/RPM-based distros
Step 1: Enable the EPEL (Extra Packages for Enterprise Linux) repository:
sudo dnf install epel-release
Step 2: Install the cURL package if not already installed:
sudo dnf install curl
Step 3: Download and install the Node.js setup script:
curl -sL https://rpm.nodesource.com/setup_16.x | sudo bash –
Note: You can replace 16.x with any other Node.js version you want to install.
Step 4: Install Node.js:
sudo dnf install nodejs
Step 5: Verify that Node.js is installed properly:
node -v
Arch-based distros
Step 1: Update your system:
sudo pacman -Syu
Step 2: Install the Node.js package:
sudo pacman -S nodejs
Step 3: Verify that Node.js is installed properly:
node -v
That’s it! You now have Node.js installed on your Linux system.