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

Oracle Linux 的 node 默认版本为 16,运行dnf update也无法改变大版本,还需要进行额外操作^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 ↩︎
相关推荐
蒜蓉大猩猩3 分钟前
Vue.js - 组件化编程
开发语言·前端·javascript·vue.js·前端框架·ecmascript
xiaoerbuyu12338 分钟前
ubuntu 连不上网 桌面 右上角没有网络图标 Ubuntu复制后虚拟网络失效问题
linux·运维·ubuntu
胖胖不胖、20 分钟前
解决:Openstack创建实例进入控制台报错Something went wrong, connection is closed
linux·服务器·openstack
Clockwiseee23 分钟前
JS原型、原型链以及原型链污染学习
javascript·学习·原型模式
小扳31 分钟前
微服务篇-深入了解使用 RestTemplate 远程调用、Nacos 注册中心基本原理与使用、OpenFeign 的基本使用
java·运维·分布式·后端·spring·微服务·架构
pouop33 分钟前
Linux进程信号保存/操作系统运行原理
运维·服务器
遇到困难睡大觉哈哈1 小时前
JavaScript面向对象
开发语言·javascript·ecmascript
檀越剑指大厂1 小时前
【Python系列】异步 Web 服务器
服务器·前端·python
我是Superman丶1 小时前
【前端】js vue 屏蔽BackSpace键删除键导致页面后退的方法
开发语言·前端·javascript
楚疏笃1 小时前
linux安全管理-账号口令
linux·服务器·安全