Programming/Node.js

[nodejs] 리눅스 node.js 설치

통통만두 2022. 2. 3. 20:53
반응형
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
## Installing the NodeSource Node.js 14.x repo...


## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release || rpm -q --whatprovides fed
ora-release
+ uname -m

## Confirming "el7-x86_64" is supported...

+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_14.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.3rGGzukDrN' 'https://rpm.nodesource.com/pub_14.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.3rGGzukDrN'

## Cleaning up...

+ rm -f '/tmp/tmp.3rGGzukDrN'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `sudo yum install -y nodejs` to install Node.js 14.x and npm.
## You may run dnf if yum is not available:
     sudo dnf install -y nodejs
## You may also need development tools to build native addons:
     sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
     sudo yum install yarn

14버전 미만의 버전의 저장소를 연결하려면 아래와 같은 경고문구를 만날 수 있다.

 

================================================================================
================================================================================

                              DEPRECATION WARNING                            

  Node.js 10.x is no longer actively supported!

  You will not receive security or critical stability updates for this version.

  You should migrate to a supported version of Node.js as soon as possible.
  Use the installation script that corresponds to the version of Node.js you
  wish to install. e.g.

   * https://rpm.nodesource.com/setup_12.x - Node.js v12 LTS "Erbium"
   * https://rpm.nodesource.com/setup_14.x - Node.js v14 LTS "Fermium" (recommended)
   * https://rpm.nodesource.com/setup_16.x - Node.js v16 "Gallium"

  Please see https://github.com/nodejs/Release for details about which
  version may be appropriate for you.

  The NodeSource Node.js distributions repository contains
  information both about supported versions of Node.js and supported Linux
  distributions. To learn more about usage, see the repository:
    https://github.com/nodesource/distributions

================================================================================
================================================================================

 

암튼, 저장소를 연결해두고 아래와 같은 명령어를 실행한다.

sudo yum install nodejs
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
nodesource                                                                                                                                                          | 2.5 kB  00:00:00     
nodesource/x86_64/primary_db                                                                                                                                        |  53 kB  00:00:00     
1 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:14.19.0-1nodesource will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================================
 Package                                 Arch                                    Version                                                 Repository                                   Size
===========================================================================================================================================================================================
Installing:
 nodejs                                  x86_64                                  2:14.19.0-1nodesource                                   nodesource                                   33 M

Transaction Summary
===========================================================================================================================================================================================
Install  1 Package

Total download size: 33 M
Installed size: 93 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/2/nodesource/packages/nodejs-14.19.0-1nodesource.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 34fa74dd: NOKEY       ]  0.0 B/s |  24 MB  --:--:-- ETA 
Public key for nodejs-14.19.0-1nodesource.x86_64.rpm is not installed
nodejs-14.19.0-1nodesource.x86_64.rpm                                                                                                                               |  33 MB  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Importing GPG key 0x34FA74DD:
 Userid     : "NodeSource <gpg-rpm@nodesource.com>"
 Fingerprint: 2e55 207a 95d9 944b 0cc9 3261 5ddb e8d4 34fa 74dd
 Package    : nodesource-release-el7-1.noarch (installed)
 From       : /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
  Installing : 2:nodejs-14.19.0-1nodesource.x86_64                                                                                                                                     1/1 
  Verifying  : 2:nodejs-14.19.0-1nodesource.x86_64                                                                                                                                     1/1 

Installed:
  nodejs.x86_64 2:14.19.0-1nodesource                                                                                                                                                      

Complete!

 

설치가 완료되었다면 아래의 명령어로 설치 된 버전을 확인 한다.

node -v

 

반응형