To install a specific nodejs version, Visit our tutorial Install Specific Nodejs Version with NVM.
Step 1 – Add Node.js Yum Repository
First of all, You need to enable the node.js yum repository in your system provided by the Node.js official website. You also need development tools to build native add-ons to be installed on your system. For Latest Release:- For Stable Release:-
Step 2 – Install Node.js on CentOS 8
After adding the repository to your system, Your system is ready to install Node.js. Execute the following command to install Node.js and NPM on CentOS 8 system.
Don’t Miss => Installing Yarn on CentOS 8
Step 3 – Check Node.js and NPM Version
After installing node.js verify and check the installed version. You can find more details about the current version on node.js official website. Also, check the version of npm. You have successfully installed Node.js on your CentOS/RHEL 8 system. You may try a demo HTTP server as given below.
Step 4 – Create Demo Web 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 web server using the below command. The web server has been started on port 3001. Now access http://127.0.0.1:3001/ URL in the browser.