最終更新日: 2021-06-26 土 17:40
ホーム | 文書トップ | 目次

Node.js インストール Ubuntu 20.04

Table of Contents

インストール

リポジトリ登録

$ curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
$ sudo bash nodesource_setup.sh

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


## Populating apt-get cache...

+ apt-get update
Get:1 https://download.docker.com/linux/ubuntu focal InRelease [52.1 kB]
Hit:3 http://jp.archive.ubuntu.com/ubuntu focal InRelease
Get:4 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:5 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:6 http://jp.archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:7 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,077 kB]
Get:8 http://jp.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [825 kB]
Hit:2 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal InRelease
Fetched 2,282 kB in 4s (650 kB/s)
Reading package lists... Done

## Confirming "focal" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_14.x/dists/focal/Release'

## Adding the NodeSource signing key to your keyring...

+ curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg >/dev/null

## Creating apt sources list file for the NodeSource Node.js 14.x repo...

+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_14.x focal main' > /etc/apt/sources.list.d/nodesource.list
+ echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_14.x focal main' >> /etc/apt/sources.list.d/nodesource.list

## Running `apt-get update` for you...

+ apt-get update
Hit:1 http://jp.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 https://deb.nodesource.com/node_14.x focal InRelease [4,583 B]
Get:4 https://download.docker.com/linux/ubuntu focal InRelease [52.1 kB]
Get:5 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:6 http://jp.archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:8 https://deb.nodesource.com/node_14.x focal/main amd64 Packages [768 B]
Hit:7 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu focal InRelease
Fetched 386 kB in 3s (148 kB/s)
Reading package lists... Done

## Run `sudo apt-get install -y nodejs` to install Node.js 14.x and npm
## You may also need development tools to build native addons:
     sudo apt-get install gcc g++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
     echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
     sudo apt-get update && sudo apt-get install yarn

確認

$ apt-cache madison nodejs
    nodejs | 14.17.1-deb-1nodesource1 | https://deb.nodesource.com/node_14.x focal/main amd64 Packages
    nodejs | 10.19.0~dfsg-3ubuntu1 | http://jp.archive.ubuntu.com/ubuntu focal/universe amd64 Packages

インストール

$ sudo apt 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 1 not upgraded.
Need to get 24.9 MB of archives.
After this operation, 121 MB of additional disk space will be used.
Get:1 https://deb.nodesource.com/node_14.x focal/main amd64 nodejs amd64 14.17.1-deb-1nodesource1 [24.9 MB]
Fetched 24.9 MB in 2s (11.5 MB/s)
Selecting previously unselected package nodejs.
(Reading database ... 195876 files and directories currently installed.)
Preparing to unpack .../nodejs_14.17.1-deb-1nodesource1_amd64.deb ...
Unpacking nodejs (14.17.1-deb-1nodesource1) ...
Setting up nodejs (14.17.1-deb-1nodesource1) ...
Processing triggers for man-db (2.9.1-1) ...
ホーム | 文書トップ | 目次
Created by Emacs 27.1 (Org mode 9.3)