Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Programming»Nodejs»How To Install NVM on CentOS/RHEL 8

    How To Install NVM on CentOS/RHEL 8

    RahulBy RahulOctober 15, 20203 Mins Read

    NVM stands for Node Version Manager is a command-line utility for managing Node versions. Sometimes you required to deploy multiple node application with different-2 versions. Nvm will help you here.

    Why NVM ?

    Node Version Manager has multiple benefits, Like:

    • Use nvm to install multiple node versions on single system. Also switch node version any time with single command
    • It allowed users to install any specific node version instead of latest version.
    • The node installed using nvm is for specific user. It create .nvm directory under user home directory and keep everythink inside it

    Installing NVM on CentOS 8

    A shell script is available for the installation of nvm on the CentOS 8 or RHEL 8 Linux system. Open a terminal on your system or connect a remote system using SSH. Use the following commands to install curl on your system, then run the nvm installer script.

    sudo dnf install curl  
    curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash   
    

    This creates a .nvm directory under the home directory. Where nvm keeps own binary file and all other required files. Then it sets environment in users .bashrc file. You need to load this environment to set required configuration by running the following command:

    source ~/.bashrc
    

    Installing Node with NVM

    Nvm allows to install multiple node versions on a single system or the logged in user. Execute below command to view a list of available node versions.

    nvm ls-remote 
    

    Then, install the required node version using the following command.

    nvm install 12.19.0 
    

    Here you change 12.19.0 with your required version like 11.15.0, 10.11.0, etc.

    It also provided alias for the latest stable node version, LTS version and other previous LTS version.

    nvm install node        # Install latest stable version 
    nvm install lts/*       # Install latest lts version 
    

    You can also use lts/dubnium, lts/carbon etc to install other nodejs LTS versions.

    Working with NVM

    Here is some frequently used commands with nvm:

    • List all the installed node versions for the current user
      nvm ls 
      
    • To list all the available version’s for the installation on your system.
      nvm ls-remote 
      
    • Switch to other installed node version for the current session. The new version will be the default version for current shell only
      nvm use 12.19.0
      
    • Find the default Node version set for the current user, type:
      nvm run default --version 
      
    • Run a script file with specific node version using exec option. This will not change the shell version.
      nvm exec 12.19.0 server.js 
      

    Uninstall Specific Node Version with NVM

    You can remove any unused version by running the following command. Just make sure the version you are removing is not currently active version.

    To remove node.js 5.9.0 from your account, type:

    nvm uninstall 5.9.0 
    

    Conclusion

    In this tutorial, you have learned to install nvm and node on CentOS 8 Linux system.

    node nvm
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install TeamViewer on Debian 9
    Next Article How To Install Python 3.9 on Ubuntu 18.04

    Related Posts

    How To Install Node.js on Ubuntu 22.04

    Updated:April 16, 20223 Mins Read

    How To Install NVM on Ubuntu 22.04

    Updated:April 16, 20223 Mins Read

    How To Install NVM on Windows

    Updated:April 16, 20223 Mins Read

    How To Install Node.Js on Debian 11

    Updated:February 11, 20226 Mins Read

    How To Install NVM on Debian 11

    Updated:August 31, 20213 Mins Read

    How To Use Environment Variables in Node.js

    6 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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