第一步 指定版本源
执行 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
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

Ubuntu 下超简单的安装指定版本的nodejs的更多相关文章

  1. 【Linuc-CentOS 】通过yum安装 指定版本的nodejs

    原 [Linuc-CentOS ]通过yum安装 指定版本的nodejs 2018年06月21日 06:56:32 黑夜的风 阅读数:884    版权声明:本文为博主原创文章,未经博主允许不得转载. ...

  2. Mac下通过brew安装指定版本的nodejs

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px "PingFang SC Semibold"; color: #2c303 ...

  3. 安装指定版本的nodejs

    node有一个模块n,是专门用来管理node.js的版本的. 1.安装n模块: npm install -g n 2.升级node.js到最新稳定版 n stable 3.安装指定版本: n v6.1 ...

  4. centos7下安装指定版本mysql5.7.23

    现在mysql版本已经到MySQL 8.0(GA)稳定版本了,所以需求是想简单又快速在centos7下安装指定版本例如MySQL 5.7(GA)版本有下面这种方法 首先需要到mysql官网这里下载对应 ...

  5. Ubuntu通过apt-get安装指定版本和查询软件源有多少个版本

    一.通过apt-get安装指定版本 apt-get install <<package name>>=<<version>> 二.查询指定软件有多少个版 ...

  6. Ubuntu通过apt-get安装指定版本和查询指定软件有多少个版本

    一.通过apt-get安装指定版本 apt-get install <<package name>>=<<version>> 二.查询指定软件有多少个版 ...

  7. mysql 5.7.29 在centos7.6下超简单的本地yum源安装与配置

    目录 生成yum源元数据 从网易镜像站下载MySQL 5.7 的 bundle包 创建文件 mysql-local.repo 执行yum install命令 生成yum源元数据 createrepo ...

  8. 运维笔记--ubuntu安装指定版本的RabbitMQ

    场景描述: 日常开发or生产环境经常会需要安装指定版本的软件,出于和其他软件的配合兼容性,以及稳定性的考虑. 现在我们的需求是安装指定版本的RabbitMQ,版本号: 操作步骤: 注意事项: 异常处理 ...

  9. Opencv 2.4.9在Ubuntu下的配置与安装

    [原]Opencv 2.4.9在Ubuntu下的配置安装  Opencv 2.4.9在Ubuntu下的配置与安装 surgewong@gmail.com http://blog.csdn.net/su ...

随机推荐

  1. shell脚本的多线程

    shell脚本的多线程 #!/bin/bash ###这是个多线程脚本!!!! ..} do { .$i >/dev/null ];then echo "192.168.2.$i 存活 ...

  2. L1-061 新胖子公式

    根据钱江晚报官方微博的报导,最新的肥胖计算方法为:体重(kg) / 身高(m) 的平方.如果超过 25,你就是胖子.于是本题就请你编写程序自动判断一个人到底算不算胖子. 输入格式: 输入在一行中给出两 ...

  3. [Deep Learning] mini-batch

    转自 http://hp.stuhome.net/index.php/2016/09/20/tensorflow_batch_minibatch/ 深度学习的优化算法,说白了就是梯度下降.每次的参数更 ...

  4. jQuery 入口函数主要有4种写法

    jqery  入口函数主要有4种写法,其中以第3种方法最为方便. <!DOCTYPE html> <html lang="en"> <head> ...

  5. [.NET] 使用ValidationContext快速进行模型资料的验证

    在进行WebAPI功能开发的时候,一般传统的验证资料是否合法的方式,都是透过if/else的方式进行判断若是使用ValidationContext,就可以省去很多自行撰写程式码的工作 要使用Valid ...

  6. NVCC src/caffe/util/math_functions.cu

    解决办法:由于安装的cuda版本是7.5,当前下载的caffe版本比较新,需要修改里面的makefile文件,屏蔽下面的代码,cuda<8.0 In the Makefile.example, ...

  7. nim读写注册表的小例子

    nim读写注册表的小例子 2018年5月7日 15:11:58 codegay 贴一个nim读写注册表的例子,虽然简单,但是nim官方没有写windows注册表相关的文档, 我贴的例子兴许能帮大家省点 ...

  8. PostMan Test 的脚本scripts编写方法

    设置环境变量 pm.environment.set("variable_key", "variable_value"); 将一个嵌套的对象设置为一个环境变量 v ...

  9. 判断库中为字符串格式的时间是否为最近三个月(Java)

    今天分享一个问题,就是标题中提到的问题,今天在调用一个接口的时候,发现调用到的数据的时间格式为字符串类型,我有点蒙圈,于是,我就百度解决了这个问题,同时在这里记录一下,为了之后不再蒙圈::: 首先需要 ...

  10. svn 部署

    安装svn [root@localhost ~]# yum -y install subversion 创建两个目录 一个 数据存储 一个用户密码 [root@localhost ~]# mkdir ...