首先安装网络请求命令工具curl:

sudo apt install curl

然后使用curl下载install.sh文件,并运行:

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

下载完成后会有类似以下输出:

...
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

把上述除了省略号以外的代码,添加到当前用户home目录下的.bashrc文件中,然后执行source ~/.bashrc即可完成安装。