第一步 指定版本源
执行 curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
setup_5.x 需要安装的版本号,替换数字就行。

vagrant@ubuntu-xenial:~$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -

// 出现这个就说明正在成功安装了!

## Installing the NodeSource Node.js v6.x repo...

## Populating apt-get cache...

+ apt-get update
Hit:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease [95.7 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease [92.2 kB]
Get:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease [94.5 kB]
Hit:5 http://repo.mysql.com/apt/ubuntu xenial InRelease
Fetched 282 kB in 0s (615 kB/s)
Reading package lists... Done ## Confirming "xenial" is supported... + curl -sLf -o /dev/null 'https://deb.nodesource.com/node_6.x/dists/xenial/Release' ## Adding the NodeSource signing key to your keyring... + curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
OK ## Creating apt sources list file for the NodeSource Node.js v6.x repo... + echo 'deb https://deb.nodesource.com/node_6.x xenial main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src https://deb.nodesource.com/node_6.x xenial main' >> /etc/apt/sources.list.d/nodesource.list ## Running `apt-get update` for you... + apt-get update
Hit:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease [95.7 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease [92.2 kB]
Get:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease [94.5 kB]
Hit:5 http://repo.mysql.com/apt/ubuntu xenial InRelease
Get:6 https://deb.nodesource.com/node_6.x xenial InRelease [3,914 B]
Get:7 https://deb.nodesource.com/node_6.x xenial/main Sources [765 B]
Get:8 https://deb.nodesource.com/node_6.x xenial/main amd64 Packages [960 B]
Get:9 https://deb.nodesource.com/node_6.x xenial/main i386 Packages [959 B]
Fetched 289 kB in 5s (51.9 kB/s)
Reading package lists... Done ## Run `apt-get install nodejs` (as root) to install Node.js v6.x and npm

第二步
安装 nodejs,执行 apt-get install nodejs !

vagrant@ubuntu-xenial:~$ sudo apt-get install nodejs

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 90 not upgraded.
Need to get 10.1 MB of archives.
After this operation, 50.7 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_6.x xenial/main amd64 nodejs amd64 6.9.1-1nodesource1~xenial1 [10.1 MB]
Fetched 10.1 MB in 1min 25s (119 kB/s)
Selecting previously unselected package nodejs.
(Reading database ... 60366 files and directories currently installed.)
Preparing to unpack .../nodejs_6.9.1-1nodesource1~xenial1_amd64.deb ...
Unpacking nodejs (6.9.1-1nodesource1~xenial1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up nodejs (6.9.1-1nodesource1~xenial1) ...
vagrant@ubuntu-xenial:~$ node -v
v6.9.1
vagrant@ubuntu-xenial:~$ npm -v
3.10.8

作者:Junting
链接:https://www.jianshu.com/p/32057c07a076
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

最新文章

  1. Java获取用户ip
  2. Java-用switch判断季节
  3. python基础(三元运算+深浅拷贝+函数参数)
  4. POJ 2481 Cows(树状数组)
  5. 深入理解JavaScript闭包
  6. MFC编译程序,缺少MFC动态链接库的解决
  7. android 开发 对图片编码,并生成gif图片
  8. Keil Mdk5.0 破解包 和谐包【worldsing笔记】
  9. vector,list和deque区别
  10. HTML5 画布参考
  11. diff两个文件夹里的东西
  12. 装饰模式(decorator)
  13. Verdi 看波形常用快捷操作
  14. Codeforces 766D. Mahmoud and a Dictionary 并查集 二元敌对关系 点拆分
  15. Python爬虫1-使用urlopen
  16. 什么?又是404!趣图助你理解HTTP状态码~
  17. linux内核分析ELF文件分析实践报告
  18. Python单元测试框架之pytest 4 -- 断言
  19. Session原理
  20. 24.类的加载机制和反射.md

热门文章

  1. C# Global.asax.cs 定时任务
  2. Vultr新用户充值优惠 – 最多充值100美元送100美元
  3. java入门-day02
  4. php留言板程序
  5. sqlloader 往数据库导数据提示数据文件的字段超出最大长度
  6. TypeError: format string
  7. SharePoint Framework 基于团队的开发(四)
  8. Java学习——方法
  9. Thymeleaf前后端传值 页面取值与js取值
  10. 转换流 InputStreamReader