CentOS, Red Hat, and Fedora do not provide Node.js package in their default yum repository, though they still give a slightly outdated version in their epel repository. If you require the latest version of Node.js for your CentOS and Red Hat installation, you'll have to install it from NodeSource's Node.js repository.
You can install a more stable and tested version of Node.js by installing the one provided in the epel repository.
Related: How to install Node.js on CentOS / Red Hat / Fedora
Steps to install latest version of Node.js for CentOS, Red Hat or Fedora:
- Install curl if it's not already available in your system.
$ sudo yum install --assumeyes curl
- Add and enable NodeSource's Node.js repository.
$ curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -
Replace 10.x with 12.x, 11.x or 9.x depending on your requirement
- Install nodejs.
$ sudo yum install --assumeyes nodejs ########################## ============================================================================================== Package Arch Version Repository Size ============================================================================================== Installing: nodejs x86_64 2:10.9.0-1nodesource nodesource 18 M Transaction Summary ============================================================================================== Install 1 Package ##########################
npm is automatically installed in nodejs package and does not require separate installation.
- Check version of installed node and npm.
$ node -v v10.9.0 $ npm -v 6.2.0
Author: Mohd
Shakir Zakaria
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Discuss the article:
Comment anonymously. Login not required.