Oracle Linux 9 (CentOS Stream 9) 安装 node.js 20

Oracle Linux 的 node 默认版本为 16,运行dnf update也无法改变大版本,还需要进行额外操作[1](#1)

  1. 查看支持的版本

    bash 复制代码
    sudo dnf module list nodejs

    输出如下

    复制代码
    Last metadata expiration check: 3:37:22 ago on Fri 11 Oct 2024 09:08:18 PM JST.
    Oracle Linux 9 Application Stream Packages (x86_64)
    Name                Stream              Profiles                                           Summary
    nodejs              18                  common [d], development, minimal, s2i              Javascript runtime
    nodejs              20                  common [d], development, minimal, s2i              Javascript runtime
    
    Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
  2. 启用 20 版本

    bash 复制代码
    sudo dnf module -y enable nodejs:20

    输出如下

    复制代码
    Last metadata expiration check: 3:40:19 ago on Fri 11 Oct 2024 09:08:18 PM JST.
    Dependencies resolved.
    ==========================================================================================================================
     Package                      Architecture                Version                      Repository                    Size
    ==========================================================================================================================
    Enabling module streams:
     nodejs                                                   20
    
    Transaction Summary
    ==========================================================================================================================
    
    Complete!
  3. 正常升级

    bash 复制代码
    sudo dnf update

    输出如下,可见已成功找到新版。

    复制代码
    Last metadata expiration check: 3:41:36 ago on Fri 11 Oct 2024 09:08:18 PM JST.
    Dependencies resolved.
    ==========================================================================================================================
     Package                Architecture Version                                                    Repository           Size
    ==========================================================================================================================
    Upgrading:
     nodejs                 x86_64       1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0                  ol9_appstream        14 M
     nodejs-docs            noarch       1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0                  ol9_appstream       9.0 M
     nodejs-full-i18n       x86_64       1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0                  ol9_appstream       8.4 M
     npm                    x86_64       1:10.8.1-1.20.16.0.1.module+el9.4.0+90390+ec2aa9c0         ol9_appstream       3.6 M
    
    Transaction Summary
    ==========================================================================================================================
    Upgrade  4 Packages
    
    Total download size: 35 M
    Is this ok [y/N]: y
    Downloading Packages:
    (1/4): nodejs-docs-20.16.0-1.module+el9.4.0+90390+ec2aa9c0.noarch.rpm                     9.0 MB/s | 9.0 MB     00:00
    (2/4): nodejs-full-i18n-20.16.0-1.module+el9.4.0+90390+ec2aa9c0.x86_64.rpm                6.7 MB/s | 8.4 MB     00:01
    (3/4): nodejs-20.16.0-1.module+el9.4.0+90390+ec2aa9c0.x86_64.rpm                          8.5 MB/s |  14 MB     00:01
    (4/4): npm-10.8.1-1.20.16.0.1.module+el9.4.0+90390+ec2aa9c0.x86_64.rpm                    4.9 MB/s | 3.6 MB     00:00
    --------------------------------------------------------------------------------------------------------------------------
    Total                                                                                      20 MB/s |  35 MB     00:01
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                                                                  1/1
      Upgrading        : nodejs-docs-1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0.noarch                                     1/8
      Upgrading        : nodejs-full-i18n-1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0.x86_64                                2/8
      Upgrading        : npm-1:10.8.1-1.20.16.0.1.module+el9.4.0+90390+ec2aa9c0.x86_64                                    3/8
      Upgrading        : nodejs-1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0.x86_64                                          4/8
      Cleanup          : nodejs-1:16.20.2-8.0.1.el9_4.x86_64                                                              5/8
      Cleanup          : npm-1:8.19.4-1.16.20.2.8.0.1.el9_4.x86_64                                                        6/8
      Cleanup          : nodejs-docs-1:16.20.2-8.0.1.el9_4.noarch                                                         7/8
      Cleanup          : nodejs-full-i18n-1:16.20.2-8.0.1.el9_4.x86_64                                                    8/8
      Running scriptlet: nodejs-full-i18n-1:16.20.2-8.0.1.el9_4.x86_64                                                    8/8
      Verifying        : nodejs-1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0.x86_64                                          1/8
      Verifying        : nodejs-1:16.20.2-8.0.1.el9_4.x86_64                                                              2/8
      Verifying        : nodejs-docs-1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0.noarch                                     3/8
      Verifying        : nodejs-docs-1:16.20.2-8.0.1.el9_4.noarch                                                         4/8
      Verifying        : nodejs-full-i18n-1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0.x86_64                                5/8
      Verifying        : nodejs-full-i18n-1:16.20.2-8.0.1.el9_4.x86_64                                                    6/8
      Verifying        : npm-1:10.8.1-1.20.16.0.1.module+el9.4.0+90390+ec2aa9c0.x86_64                                    7/8
      Verifying        : npm-1:8.19.4-1.16.20.2.8.0.1.el9_4.x86_64                                                        8/8
    
    Upgraded:
      nodejs-1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0.x86_64
      nodejs-docs-1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0.noarch
      nodejs-full-i18n-1:20.16.0-1.module+el9.4.0+90390+ec2aa9c0.x86_64
      npm-1:10.8.1-1.20.16.0.1.module+el9.4.0+90390+ec2aa9c0.x86_64
    
    Complete!

  1. CentOS Stream 9 : Node.js インストール : Server World ↩︎
相关推荐
AI浩4 小时前
【Labelme数据操作】LabelMe标注批量复制工具 - 完整教程
运维·服务器·前端
2401_878454535 小时前
浏览器工作原理
前端·javascript
石像鬼₧魂石5 小时前
如何配置Fail2Ban的Jail?
linux·学习·ubuntu
sunxunyong5 小时前
doris运维命令
java·运维·数据库
Guheyunyi5 小时前
智慧消防管理系统如何重塑安全未来
大数据·运维·服务器·人工智能·安全
椰子今天很可爱5 小时前
五种I/O模型与多路转接
linux·c语言·c++
Lueeee.6 小时前
Linux kernel Makefile 语法
linux
by__csdn6 小时前
Vue3 setup()函数终极攻略:从入门到精通
开发语言·前端·javascript·vue.js·性能优化·typescript·ecmascript
天天扭码7 小时前
前端如何实现RAG?一文带你速通,使用RAG实现长期记忆
前端·node.js·ai编程
Luna-player7 小时前
在前端中,<a> 标签的 href=“javascript:;“ 这个是什么意思
开发语言·前端·javascript