Node.js is a popular runtime environment for JavaScript applications, widely used for building server-side applications, web applications, and more. Node.js 18, being a Long Term Support (LTS) version, provides stability and long-term support for developers. In this blog post, we’ll guide you through the steps to install Node.js 18 LTS on CentOS 7/8 or Fedora 38-34.
Prerequisites
Before we get started, ensure that you have the following:
- A CentOS 7/8 or Fedora 38-34 server or workstation.
- Terminal access with sudo or root privileges.
- Basic knowledge of the command line.
Now, let’s begin the installation process.
Step 1: Update Your System
First, open a terminal and update your system’s package repositories to ensure you have the latest information about available packages:
For CentOS:
$ sudo yum update -y
For Fedora:
$ sudo dnf update -y
Step 2: Install Node.js 12 on CentOS 7/8 or Fedora 38-34
Node.js can be installed on CentOS and Fedora using the NodeSource repository, which provides up-to-date Node.js versions. Follow these steps to add the NodeSource repository and install Node.js 18 LTS:
For CentOS 7/8:
1 Install the NodeSource repository by running the following command:
$ sudo curl -sL https://rpm.nodesource.com/setup_18.x | bash -
2 After adding the repository, install Node.js 18 with npm (Node Package Manager) using the following command:
$ sudo yum install -y nodejs
For Fedora 38-34:
1 Install the NodeSource repository by running the following command:
$ sudo dnf install -y https://rpm.nodesource.com/pub_12.x/fc/nodesource-release-fc38-1.noarch.rpm
Note: Replace fc38
with your specific Fedora version (e.g., fc34
, fc35
, etc.).
2 Install Node.js 18 with npm using the following command:
$ sudo dnf install -y nodejs
Step 3: Verify the Installation
After Node.js and npm are installed, you can verify the versions by running the following commands:
$ node -v
$ npm -v
You should see the Node.js and npm version numbers printed to the terminal.
Conclusion
You have successfully installed Node.js 18 LTS on your CentOS 7/8 or Fedora 38-34 system. You can now start developing and running JavaScript applications with the latest features and long-term support provided by Node.js 18. If you encounter any issues or need additional information, refer to the official Node.js documentation or community resources to help you get the most out of your Node.js environment.
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.