This tutorial contains 3 ways to install Node.js on the Fedora system. Use one of the below options as suitable to you.

Prerequisites

We assume you already have shell access to your Fedora system with sudo privileged account. Login to your Fedora system and open a terminal.

Method 1 – Install Node.js from Default Package Repository

The Fedora default package repositories contain a stable version of Node.js. It may not be the latest version but it will be a stable release and can be used for working with it. Open a terminal on your system and type below to install Node.js on the Fedora Linux system: Once the installation is completed, you can check the installed Node.js version on your Fedora machine by running the following command.

Method 2 – Install Node.js from Official Repository

Node.js’ official team provides a repository for installing the latest packages for your Fedora system. You can choose between the latest or stable version of Node.js to install on your system. During the time of writing this tutorial, NodeJs 17 is the latest release and Node.js 16 is the stable version available. Choose one of the below options to configure the Node.js DNF repository on Fedora for the latest version or stable version. For Latest Release:- For Stable Release:- After adding the required repository to your Fedora system, Simply run the below command to install the Node.js on Fedora based on configured repository. This will also install NPM on the Fedora system including other required dependencies. Once the installation is finished, check for the installed Node.js version: To check the NPM version:

Method 3 – Install Node.js on Fedora via NVM

NVM is the Node Version Manager used to manage multiple Node.js versions on a single system. Using the NVM, you can install any version of Node.js. First, install the NVM tool on your system by running the following command: Then, reload the system environment using this command. It will set the required environment variables to use nvm on the system. Now, run the following command to install Node.js on the Fedora system. You can change v12.16.2 with any version, you required on your system. You can also install multiple Node.js versions by running the command multiple times. For more details and instruction for nvm, follow this tutorial.

Run Demo HTTP Server (Optional)

This is an optional step. If you want to test your node.js install. Let’s create a web server with the “Welcome Node.js” text. Create a file demo_server.js and add the following content Now start the webserver using the command. The web server has been started on port 3001. Now access http://127.0.0.1:3001/ URL in browser.

Conclusion

This tutorial helped you to install Node.js on the Fedora Linux system. Additionally provided a small script to create a web server using Node.js.