CentOS Stream 8
Sponsored Link

Node.js 10 : インストール2021/03/15

 
Node.js 10 をインストールします。
[1] 現在、有効になっている Node.js のバージョンを確認してインストールします。
[root@dlp ~]#
dnf module list nodejs

CentOS Stream 8 - AppStream
Name      Stream    Profiles                                Summary
nodejs    10 [d]    common [d], development, minimal, s2i   Javascript runtime
nodejs    12        common [d], development, minimal, s2i   Javascript runtime
nodejs    14        common [d], development, minimal, s2i   Javascript runtime

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

# Node.js 10 を指定してインストール

[root@dlp ~]#
dnf module -y install nodejs:10/common

Dependencies resolved.
==============================================================================================
 Package            Arch    Version                                           Repo        Size
==============================================================================================
Installing group/module packages:
 nodejs             x86_64  1:10.23.1-1.module_el8.4.0+645+9ce14ba2           appstream  8.9 M
 npm                x86_64  1:6.14.10-1.10.23.1.1.module_el8.4.0+645+9ce14ba2 appstream  3.7 M
Installing weak dependencies:
 nodejs-full-i18n   x86_64  1:10.23.1-1.module_el8.4.0+645+9ce14ba2           appstream  7.3 M
Installing module profiles:
 nodejs/common
Enabling module streams:
 nodejs                     10

Transaction Summary
==============================================================================================
Install  3 Packages
.....
.....

[root@dlp ~]#
node -v

v10.23.1

# テストスクリプトを作成して動作確認

[root@dlp ~]# cat > nodejs_test.js <<'EOF' 
var http = require('http');
var server = http.createServer(function(req, res) {
  res.write("Hello, This is the Node.js Simple Web Server!\n");
  res.end();
}).listen(8080);
EOF 

[root@dlp ~]#
node nodejs_test.js &

[1] 3193
[root@dlp ~]#
curl localhost:8080

Hello, This is the Node.js Simple Web Server!
[root@dlp ~]#
kill 3193

関連コンテンツ