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 ↩︎
相关推荐
_.Switch16 分钟前
Python 自动化运维持续优化与性能调优
运维·开发语言·python·缓存·自动化·运维开发
南猿北者20 分钟前
Docker Volume
运维·docker·容器
Martin -Tang2 小时前
Vue 3 中,ref 和 reactive的区别
前端·javascript·vue.js
矛取矛求3 小时前
Linux如何更优质调节系统性能
linux
FakeOccupational3 小时前
nodejs 020: React语法规则 props和state
前端·javascript·react.js
放逐者-保持本心,方可放逐3 小时前
react 组件应用
开发语言·前端·javascript·react.js·前端框架
内核程序员kevin4 小时前
在Linux环境下使用Docker打包和发布.NET程序并配合MySQL部署
linux·mysql·docker·.net
kayotin4 小时前
Wordpress博客配置2024
linux·mysql·docker
曹天骄4 小时前
next中服务端组件共享接口数据
前端·javascript·react.js
Ztiddler5 小时前
【Linux Shell命令-不定期更新】
linux·运维·服务器·ssh