Facebook X (Twitter) Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook X (Twitter) Instagram
    TecAdmin
    You are at:Home»Linux System Administration»How to Install NVM on CentOS Stream 9 & RHEL 9

    How to Install NVM on CentOS Stream 9 & RHEL 9

    By RahulApril 27, 20233 Mins Read

    Node Version Manager (NVM) is a popular utility that enables you to manage multiple versions of Node.js on your system. It allows you to switch between different Node.js versions easily, making it a valuable tool for developers working on different projects with varying requirements. In this article, we will guide you through the process of installing NVM on CentOS Stream 9 and RHEL 9.

    Prerequisites

    Before we begin, ensure that you have the following:

    • A system running CentOS Stream 9 or RHEL 9
    • A user account with shell access

    Step 1: Update Your System

    First, it’s a good idea to update your system to ensure you have the latest packages and security updates. Run the following command:

    sudo dnf update -y 
    

    Step 2: Install Build Tools

    To compile and install Node.js versions, you will need some build tools. Run the following command to install them:

    sudo dnf groupinstall "Development Tools" -y 
    

    Step 3: Install NVM

    Now, we will install NVM by using the official install script from the NVM GitHub repository. Run the following command to download and execute the script:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash 
    

    Note: The version number (v0.39.3) may change, so be sure to check the NVM repository (https://github.com/nvm-sh/nvm) for the latest release.

    Once the script finishes execution, it will install NVM and add the necessary lines to your shell’s configuration file (such as .bashrc, .zshrc, or .bash_profile).

    To apply the changes, you need to restart your shell or run the following command:

    source ~/.bashrc 
    

    To verify that NVM is installed correctly, run:

    nvm --version 
    

    If you see the version number displayed, NVM is successfully installed.

    Step 4: Install Node.js

    With NVM installed, you can now install different versions of Node.js. To install the latest LTS (Long Term Support) version, run:

    nvm install --lts 
    

    To install a specific version, use the following command:

    nvm install 18.16.0  
    

    Replace “18.16.0” with the desired version number.

    Step 5: Switch Between Node.js Versions

    NVM allows you to switch between installed Node.js versions easily. To switch to a specific version, use the following command:

    nvm use 18.16.0  
    

    Replace “18.16.0” with the version number you want to switch to.

    To view a list of all installed Node.js versions, run:

    nvm ls 
    

    To set the default Node.js version that will be used every time you open a new terminal, run:

    nvm alias default 18.16.0  
    

    Replace “18.16.0” with the desired version number.

    Conclusion

    You have now successfully installed NVM on your CentOS Stream 9 or RHEL 9 system and learned how to manage multiple Node.js versions. With NVM, you can easily switch between different Node.js versions to work on projects with varying requirements.

    CentOS 9 CentOS Stream 9 node nvm
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    What is Fish (Friendly Interactive SHell)?

    How to Increase Sudo Session Duration in Linux

    Setting Up Startup and Shutdown Scripts in Ubuntu

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Create and Use Custom Python Module
    • How to Install and Use Podman on Ubuntu 22.04 & 20.04
    • Setting Up Laravel with Docker and Docker-compose
    • Setting Up Development Environments with PHP and Docker
    • Using Composer with Different PHP Versions in Linux
    Facebook X (Twitter) Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.