在CentOS 8上安装Node.js 12(通过AppStream)

首先

使用Application Stream(AppStream)在CentOS8上安装Node.js 12。
参考资料:RHEL8的软件包结构 – BaseOS和Application Stream – 红帽工程师博客

支持

如果使用这种方法进行引入,根据《Red Hat Enterprise Linux 8 Application Streams Life Cycle – Red Hat Customer Portal》指出,2021年11月可能会被视为EOL(终止支持)。
之后可能不会进行对已报告的漏洞和问题的处理。

日志

安装

# cat /etc/redhat-release
CentOS Linux release 8.1.1911 (Core)

# yum install -y @nodejs:12/common
... 略

确认的多种形式

# which node
/usr/bin/node

# node -v
v12.4.0

# yum module info nodejs:12
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:09:35 ago on Sat Jan 18 07:24:40 2020.
Name         : nodejs
Stream       : 12 [e] [a]
Version      : 8010020191122190621
Context      : cdc1202b
Architecture : x86_64
Profiles     : common [i], development, minimal, s2i
Repo         : AppStream
Summary      : Javascript runtime
Description  : Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Artifacts    : nodejs-1:12.4.0-2.module_el8.1.0+251+8afea200.src
             : nodejs-1:12.4.0-2.module_el8.1.0+251+8afea200.x86_64
             : nodejs-debuginfo-1:12.4.0-2.module_el8.1.0+251+8afea200.x86_64
             : nodejs-debugsource-1:12.4.0-2.module_el8.1.0+251+8afea200.x86_64
             : nodejs-devel-1:12.4.0-2.module_el8.1.0+251+8afea200.x86_64
             : nodejs-devel-debuginfo-1:12.4.0-2.module_el8.1.0+251+8afea200.x86_64
             : nodejs-docs-1:12.4.0-2.module_el8.1.0+251+8afea200.noarch
             : nodejs-nodemon-0:1.18.3-1.module_el8.1.0+251+8afea200.noarch
             : nodejs-nodemon-0:1.18.3-1.module_el8.1.0+251+8afea200.src
             : nodejs-packaging-0:17-3.module_el8.1.0+251+8afea200.noarch
             : nodejs-packaging-0:17-3.module_el8.1.0+251+8afea200.src
             : npm-1:6.9.0-1.12.4.0.2.module_el8.1.0+251+8afea200.x86_64

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