Installation and configuration of nvm on CentOS

The CentOS system is very stable because of the support of RHEL. The Nodejs single-threaded development model can reduce the development cost of enterprises. The Nodejs cluster feature facilitates enterprises to implement server clusters. These three features make the nodejs server architecture on CentOS the choice of more and more enterprise servers. However, Nodejs officially does not provide Linux system deb or rpm format installation packages. How does the enterprise install and configure the Nodejs environment? I share one of our practices: nvm.
The current latest version of nvm on github is 0.33.8, first run:

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

When the installation is complete, when the user is prompted to set the environment variable, modify it .bash_profileand add at the end:

export NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

Then make the configuration take effect, run

cd ~
source .bash_profile

Currently, the method to make the configuration take effect is to exit the terminal directly and open a new terminal.
run:

nvm ls
nvm ls-remote

You can view the version installed locally, the version used by default, and the version of the remote repository. Share one of my effects:
write picture description here

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326678182&siteId=291194637