Amazon AWS Linux安装nodejs(官网文档翻译)



  1. Connect to your Linux instance as ec2-user using SSH.

  2. Install the current version of node version manager (nvm) by typing the following at the command line to install version 33.8.

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

    We will use nvm to install Node.js because nvm can install multiple versions of Node.js and allow you to switch between them. See the nvm repo on GitHub for the current version to install.

  3. Activate nvm by typing the following at the command line.

     
      
    . ~/.nvm/nvm.sh
  4. Use nvm to install the version of Node.js you intend to use by typing the following at the command line.

     
      
    nvm install 6.11.5

    To install the latest LTS (long-term-support) release of Node.js, type the following at the command line.

     
      
    nvm install --lts

    Installing Node.js also installs the Node Package Manager (npm) so you can install additional modules as needed.

  5. Test that Node.js is installed and running correctly by typing the following at the command line.

     
      
    node -e "console.log('Running Node.js ' + process.version)"

    This should display the following message that confirms the installed version of Node.js running.

    Running Node.js v6.11.5

这种方法不用手动配置文件,还是很方便,百度找的几个配置方法都没成功,最后找到这个,终于可以了。。

1.通过SSH连接Linux(我用的xshell)

2.安装nvm / node version manager

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

3.激活nvm

  1. . ~/.nvm/nvm.sh
    

4.安装nodejs 和 LTS (long-term-support) 

nvm install 6.11.5
nvm install --lts

5.测试安装是否成功。成功的话会输出 Running Node.js v6.11.5

node -e "console.log('Running Node.js ' + process.version)"

原文链接

https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-up-node-on-ec2-instance.html



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值