1. NodeSource PPA 추가
이 명령은 Ubuntu 20.04 설치에 NodeJS 16을 설치하는 데 필요한 PPA 소스를 추가합니다.
curl -s https://deb.nodesource.com/setup_16.x | sudo bash
결과
## Installing the NodeSource Node.js 16.x repo...
## Populating apt-get cache...
+ apt-get update
Hit:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
## Confirming "focal" is supported...
+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_16.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 16.x repo...
+ echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.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_16.x focal main' >> /etc/apt/sources.list.d/nodesource.list
## Running `apt-get update` for you...
+ apt-get update
Hit:1 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://ap-northeast-2.ec2.archive.ubuntu.com/ubuntu focal-backports InRelease
Get:4 https://deb.nodesource.com/node_16.x focal InRelease [4583 B]
Get:5 https://deb.nodesource.com/node_16.x focal/main amd64 Packages [773 B]
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease
Fetched 5356 B in 1s (7667 B/s)
Reading package lists... Done
## Run `sudo apt-get install -y nodejs` to install Node.js 16.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
2. NodeJS 16 설치
이제 PPA 소스가 추가되었으므로 Ubuntu 20.04 설치에 NodeJS 16을 설치할 수 있습니다. 다음 명령을 실행합니다.
sudo apt install nodejs -y
결과
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 40 not upgraded. Need to get 27.2 MB of archives. After this operation, 128 MB of additional disk space will be used. Get:1 https://deb.nodesource.com/node_16.x focal/main amd64 nodejs amd64 16.18.0-deb-1nodesource1 [27.2 MB] Fetched 27.2 MB in 1s (26.9 MB/s) Selecting previously unselected package nodejs. (Reading database ... 63415 files and directories currently installed.) Preparing to unpack .../nodejs_16.18.0-deb-1nodesource1_amd64.deb ... Unpacking nodejs (16.18.0-deb-1nodesource1) ... Setting up nodejs (16.18.0-deb-1nodesource1) ... Processing triggers for man-db (2.9.1-1) ...
3. 설치된 NodeJS 버전 확인
마지막으로 설치된 버전을 확인해보자. 다음 명령을 실행합니다.
node -v
728x90
'OS > Linux' 카테고리의 다른 글
[Linux] 심볼릭 링크 (바로가기) 만들기 (0) | 2023.03.30 |
---|---|
[Linux] 파일 권한 명령어 (2) | 2023.01.03 |
[Linux] Ubuntu NGINX 설치 (0) | 2022.09.28 |
[Linux] Ubuntu 현재 버전 확인 (0) | 2022.09.28 |
[Linux] Ubuntu 20.04 zsh, oh-my-zsh 설치 (0) | 2022.09.28 |
댓글