Node Version Manager (NVM) is a command-line tool that installs and manages multiple versions of Node.js on one machine. The AppStream repositories of Red Hat Enterprise Linux and its rebuilds offer only a few Node.js streams, and they lag behind upstream releases. NVM lets you install any Node.js release in seconds, run several versions side by side and switch between them per project. Everything goes into your home directory, so you don’t need sudo for Node.js or global npm packages, and the system packages stay untouched.
This guide shows how to install NVM on RHEL 10 and RHEL 9, and on the compatible distributions Rocky Linux 10 and 9, AlmaLinux 10 and 9, and CentOS Stream 10 and 9. The steps are the same on all of them. They also work on RHEL 8 and its rebuilds, which still run current Node.js releases.
Last tested: November 2026 with NVM v0.41.0, Node.js 26 LTS and Node.js 22 on RHEL 10.3, AlmaLinux 10.3, RHEL 9.9, Rocky Linux 9.9 and RHEL 8.10.
Prerequisites
- A system running RHEL, Rocky Linux, AlmaLinux or CentOS Stream, version 10 or 9 (8 also works).
- A user account with
sudoprivileges to install the required packages. - An internet connection to download NVM and Node.js.
Step 1 of 6Update the System and Install Required Packages
Update the installed packages:
sudo dnf update -y
Install tar and gzip, which NVM uses to unpack Node.js, and libatomic, which Node.js 26 needs to start. Minimal and cloud images often don’t include libatomic:
sudo dnf install -y tar gzip libatomic
The curl command is already installed on every supported release. On RHEL 9, Rocky Linux 9 and AlmaLinux 9 it comes from the curl-minimal package, so sudo dnf install curl fails with a package conflict. You don’t need the full package for NVM. If another tool needs it, replace curl-minimal explicitly:
sudo dnf install -y --allowerasing curl
You also don’t need the Development Tools group, because NVM downloads prebuilt Node.js binaries. Install it only if you plan to compile Node.js from source with nvm install -s.
Step 2 of 6Install NVM on RHEL, Rocky Linux or AlmaLinux
Run the official install script as your normal user, not with sudo, because NVM installs into your home directory:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bash
If you prefer wget, this command does the same thing:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bash
The script clones NVM into ~/.nvm and adds the lines that load it to ~/.bashrc (or ~/.zshrc for Zsh). Check the NVM releases page for a newer version number before you run it.
Step 3 of 6Load NVM and Verify the Installation
Load NVM into the current terminal session, or log out and back in:
source ~/.bashrc
Verify that NVM is available:
command -v nvmnvm --version
nvm
0.41.0
The first command prints nvm because NVM is a shell function, not a binary file.
Step 4 of 6Install Node.js with NVM
Install the current Long Term Support (LTS) release of Node.js. This is the right choice for most projects:
nvm install --lts
To install another release, give its major or full version number, for example Node.js 22:
nvm install 22
List the LTS releases you can install:
nvm ls-remote --lts
Check the active version of Node.js and npm:
node -vnpm -v
Step 5 of 6Switch Between Node.js Versions
List the installed versions. The arrow marks the one in use:
nvm ls
Switch the current shell to another installed version:
nvm use 22
The change applies only to the current terminal session. Each project can pin its own version too: use an .nvmrc file in the project folder, and nvm use picks it up automatically.
Step 6 of 6Set a Default Node.js Version
New terminal sessions use the default version. Point it to the latest LTS release, so it moves forward when you install a newer LTS:
nvm alias default 'lts/*'
Or pin it to a specific major version:
nvm alias default 22
For more options, see how to set a default Node.js version with NVM.
Update or Uninstall NVM
To update NVM itself, run the install command again with the newer version number. Your installed Node.js versions are kept.
To remove a Node.js version you no longer need:
nvm uninstall 22
To remove NVM completely, delete its directory and then remove the three NVM lines from ~/.bashrc:
rm -rf ~/.nvm
Troubleshooting
nvm: command not found
The install script adds NVM to your shell profile, but the current session hasn’t read it yet. Reload it, or open a new terminal:
source ~/.bashrc
If that doesn’t help, check that the NVM lines are in the profile. The installer only edits files that already exist, so create ~/.bashrc and run the installer again if they are missing:
grep NVM_DIR ~/.bashrc
error while loading shared libraries: libatomic.so.1
Node.js 26 binaries need the libatomic runtime library. Install it and run node -v again; there is no need to reinstall Node.js:
sudo dnf install -y libatomic
package curl-minimal conflicts with curl
You ran dnf install curl on a release that ships curl-minimal (RHEL 9 and its rebuilds). Skip that step, because curl already works, or add --allowerasing as shown in Step 1.
Using RHEL 8, CentOS 8 or CentOS 7?
RHEL 8, Rocky Linux 8 and AlmaLinux 8 have glibc 2.28, so current Node.js releases, including Node.js 26, run fine with the steps above. CentOS Linux 8 and CentOS 7 have reached end of life. CentOS 7 also has glibc 2.17, which can’t run the official Node.js 18 or newer binaries. Move those systems to RHEL, Rocky Linux or AlmaLinux 9 or 10.
On Fedora the steps are almost the same; see how to install NVM on Fedora.
Conclusion
You have installed NVM on RHEL, Rocky Linux or AlmaLinux and used it to install Node.js, switch between versions and set a default. The same commands work on version 10 and version 9 of all three distributions, and NVM keeps every project on the Node.js version it needs without touching the system packages. To learn more commands, see our complete guide to managing Node.js with NVM.
How did it make you feel?
