LoginSignup
0
0

More than 1 year has passed since last update.

VPSにNode.jsをインストールする

Last updated at Posted at 2021-06-19
[root@<ホスト名> ~]# 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
+ 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.XPYzdAXJk4' '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.XPYzdAXJk4'

## Cleaning up...

+ rm -f '/tmp/tmp.XPYzdAXJk4'

## 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 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
[root@<ホスト名> ~]# yum install nodejs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: ftp.riken.jp
 * extras: ftp.iij.ad.jp
 * updates: ty1.mirror.newmediaexpress.com
nodesource                                                                             | 2.5 kB  00:00:00     
nodesource/x86_64/primary_db                                                           |  42 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 2:14.17.1-1nodesource will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================
 Package              Arch                 Version                             Repository                Size
==============================================================================================================
Installing:
 nodejs               x86_64               2:14.17.1-1nodesource               nodesource                32 M

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

Total download size: 32 M
Installed size: 92 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/nodesource/packages/nodejs-14.17.1-1nodesource.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 34fa74dd: NOKEY
Public key for nodejs-14.17.1-1nodesource.x86_64.rpm is not installed
nodejs-14.17.1-1nodesource.x86_64.rpm                                                  |  32 MB  00:00:03     
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.17.1-1nodesource.x86_64                                                        1/1 
  Verifying  : 2:nodejs-14.17.1-1nodesource.x86_64                                                        1/1 

Installed:
  nodejs.x86_64 2:14.17.1-1nodesource                                                                         

Complete!
[root@<ホスト名> ~]# node -v
v14.17.1
[root@<ホスト名> ~]# npm -v
6.14.13
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0