
开发工具运维【免费下载链接】distributionsNodeSource Node.js Binary Distributions项目地址https://gitcode.com/gh_mirrors/di/distributions点击查看免费下载本文以 NodeSource 官方仓库的旧版 READMEOLD_README.md为骨架系统讲解如何通过 NodeSource 的 .deb / .rpm 二进制仓库在 Debian/Ubuntu 系与 Enterprise Linux 系发行版上安装、卸载 Node.js并借助仓库内的 setup 脚本源码scripts/deb、scripts/rpm深入剖析脚本的底层工作原理。读完本文你将掌握curl | bash快速安装、四步手动安装、签名密钥与仓库配置、版本选择LTS / Current / 指定大版本、彻底卸载以及常见问题代理、版本钉住、缓存、GPG 错误等的排查思路。文档版本说明本仓库根目录的 README.md 已指向新版文档 DEV_README.md而 OLD_README.md 是旧版完整指南。本文围绕旧版指南展开内容以旧版文档为准源码佐证以当前仓库为准。仓库定位Node.js 二进制发行版 setup/support 脚本该仓库承载的是NodeSource Node.js Binary Distributions的配套文档与安装脚本通过 .rpm 与 .deb 两种包格式向主流 Linux 发行版分发预编译的 Node.js 二进制包同时提供 setup 与 support 脚本把「配置签名密钥、写入软件源、刷新包索引」等一系列操作自动化。仓库中实际维护的脚本文件即为佐证Debian/Ubuntu 系setup_16.x、setup_18.x、setup_20.x、setup_21.x、setup_22.x、setup_23.x、setup_24.x、setup_25.x、setup_lts.x、setup_current.x位于 scripts/debEnterprise Linux 系同名的一套脚本位于 scripts/rpm。当前仓库中setup_lts.x指向 Node.js 24.x、setup_current.x指向 25.x见各脚本内的NODE_VERSION变量例如 scripts/deb/setup_lts.x 与 scripts/rpm/setup_current.x。旧版指南中出现的 v19.x 等示例属于历史版本存档如今不再维护。Debian 与 Ubuntu 系发行版.deb可用架构NodeSource 持续维护以下架构未来可能增加amd6464 位armhfARM 32 位硬浮点ARMv7 及以上arm-linux-gnueabihfarm64ARM 64 位ARMv8 及以上aarch64-linux-gnu支持的 Ubuntu 版本NodeSource 维护 Canonical 仍在积极支持范围内的 Ubuntu 发行版包括 LTS 与中间版本。划掉删除线的版本带有警告BUILD SYSTEM CURRENTLY BROKEN FOR NODEJS 18Node.js 18 的构建系统当前损坏Ubuntu 16.04 LTS (Xenial Xerus)Ubuntu 18.04 LTS (Bionic Beaver)Ubuntu 18.10 (Cosmic Cuttlefish)Ubuntu 19.04 (Disco Dingo)Ubuntu 19.10 (Eoan Ermine)Ubuntu 20.04 LTS (Focal Fossa)Ubuntu 20.10 (Groovy Gorilla)Ubuntu 21.04 (Hirsute Hippo)Ubuntu 21.10 (Impish Indri)Ubuntu 22.04 (Jammy Jellyfish)Ubuntu 22.10 (Kinetic Kudu)支持的 Debian 版本由于 Debian 发布周期较长大量用户运行 testing 与 unstable因此 NodeSource 对 stable、testing 与 unstable 均提供支持Debian 9 / oldoldstable (Stretch)Node.js 18 构建系统损坏Debian 10 / oldstable (Buster)Debian 11 / stable (Bullseye)Debian unstable (Sid)Debian testing (Bookworm)支持的衍生发行版NodeSource 为众多基于 Debian/Ubuntu 的衍生系统提供或曾经提供支持多数衍生版通过其上游基础版本获得支持Linux Mint18 Sarah、18.1 Serena、18.2 Sonya、18.3 Sylviavia Ubuntu 16.04 LTS、LMDE 2 Betsyvia Debian 8、19 Tara、19.1 Tessa、19.2 Tina、19.3 Triciavia Ubuntu 18.04 LTS、20 Ulyana、20.1 Ulyssa、20.2 Uma、20.3 Unavia Ubuntu 20.04 LTS、21 Vanessa、21.1 Veravia Ubuntu 22.04 LTS、LMDE 3 Cindyvia Debian 9、LMDE 4 Debbievia Debian 10、LMDE 5 Elsievia Debian 11DevuanAscii / oldoldstablevia Debian 9、Beowulf / oldstablevia Debian 10、Chimaera / stablevia Debian 11、Ceres / unstablevia Debian unstableelementary OS0.4 Loki、5 Juno、5.1 Heravia Ubuntu 18.04 LTS、6 Odin、6.1 Jolnirvia Ubuntu 20.04 LTS、7 horusvia Ubuntu 22.04 LTSTrisquel8 Flidas、9 EtionaBOSS7.0 Drishtivia Debian 9、8.0 Unnativia Debian 10、9.0 Urjavia Debian 11BunsenLabsHeliumvia Debian 9、Lithiumvia Debian 10MX LinuxMX-17 Horizon、MX-18 Continuumvia Debian 9、MX-19 Patito Feovia Debian 10、MX-21 Wildflowervia Debian 11Sparky Linux4.x Tychevia Debian 9、5.x Nibiruvia Debian 10、6.x Po Tolovia Debian 11PureOS9.0 Ambervia Debian 10、10.0 Byzantiumvia Debian 11Astra Linux CE2.12 Orelvia Debian 9Ubilinux4.0 Dolcettovia Debian 9Parrot OS5.0 Electro Aravia Debian 11Deepin20 Apricotvia Debian 10上述带删除线且标注BUILD SYSTEM CURRENTLY BROKEN FOR NODEJS 18的版本表示旧版本文档发布时其构建系统无法为 Node.js 18 产出包选用时需自行确认。快速安装curl 管道方式旧版指南给出的标准安装方式是将 setup 脚本通过管道交给 bash 执行随后用包管理器安装nodejs包。Node.js v20.xUbuntucurl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - \ sudo apt install -y nodejsDebian以 root 身份curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ apt install -y nodejsNode.js v19.x历史版本示例# Ubuntu curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash - \ sudo apt install -y nodejs # Debianroot curl -fsSL https://deb.nodesource.com/setup_19.x | bash - \ apt install -y nodejsNode.js v18.x# Ubuntu curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - \ sudo apt install -y nodejs # Debianroot curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ apt install -y nodejsNode.js v16.x# Ubuntu curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - \ sudo apt install -y nodejs # Debianroot curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \ apt install -y nodejsNode.js LTSv18.xsetup_lts.x始终指向当前 LTS 版本线。# Ubuntu curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - \ sudo apt install -y nodejs # Debianroot curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \ apt install -y nodejsNode.js Currentv20.xsetup_current.x始终指向当前最新版本线。# Ubuntu curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - \ sudo apt install -y nodejs # Debianroot curl -fsSL https://deb.nodesource.com/setup_current.x | bash - \ apt install -y nodejs可选安装构建工具如需从 npm 编译原生native模块需要安装编译工具链。Ubuntu 下使用sudoDebian 下以 root 运行apt install -y build-essentialsetup 脚本的底层原理源码解读以 scripts/deb/setup_20.x 为例该脚本的执行流程可以分为以下几个阶段与旧版文档的说明完全对应OS 校验check_os检查/etc/debian_version是否存在否则拒绝执行提示仅支持 Debian 系系统前置依赖安装install_pre_reqs依次执行apt update、安装apt-transport-https ca-certificates curl gnupg、创建/usr/share/keyrings目录、清理可能存在的旧nodesource.gpg与旧 sources 文件然后通过curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor把 NodeSource 签名公钥解 armor 后写入/usr/share/keyrings/nodesource.gpg并chmod 644确保所有用户可读仓库配置configure_repo先用dpkg --print-architecture校验架构仅允许amd64与arm64再以 deb822 格式写入/etc/apt/sources.list.d/nodesource.sources含Types: deb、URIs、Suites: nodistro、Components: main、Architectures、Signed-By指向 keyring 文件随后为nsolid与nodejs两个包各写一份/etc/apt/preferences.d/下的 pin 配置Pin-Priority: 600Pin: origin deb.nodesource.com以保证从 NodeSource 仓库获得较高优先级刷新索引执行apt update并提示用户运行apt install nodejs -y完成安装。可见脚本内部会自动完成密钥导入与 sources 配置这正是文档要求「安装后即可直接apt install nodejs」的原因。卸载 nodejsUbuntu / Debian 包彻底移除通过上述 deb.nodesource.com 方式安装的 Node.js# Ubuntu 使用 sudoDebian 以 root 运行 apt purge nodejs \ rm -r /etc/apt/sources.list.d/nodesource.list注意新版脚本如 scripts/deb/setup_20.x实际写入的是 deb822 格式的/etc/apt/sources.list.d/nodesource.sources与/usr/share/keyrings/nodesource.gpg若你使用新版脚本安装卸载时还建议一并清理这两个文件详见新版文档 DEV_README.md 的卸载章节。手动安装四步如果你不喜欢curl url | bash -的管道执行方式或正在使用不受支持的发行版可以手动完成安装。以下步骤假设系统存在sudo部分极简发行版默认没有sudo此时应安装sudo或su切换 root 后直接执行。第 1 步移除旧 PPA如存在仅当你此前使用过 Chris Lea 的 Node.js PPA 时才需要# 部分 Ubuntu 版本可能没有 add-apt-repository # sudo apt install python-software-properties sudo add-apt-repository -y -r ppa:chris-lea/node.js \ sudo rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list \ sudo rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list.save第 2 步添加 NodeSource 包签名密钥KEYRING/usr/share/keyrings/nodesource.gpg curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee $KEYRING /dev/null # 也可以用 wget # wget --quiet -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee $KEYRING /dev/null gpg --no-default-keyring --keyring $KEYRING --list-keys chmod ar /usr/share/keyrings/nodesource.gpg密钥 ID 为9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280。第 3 步添加所需的 NodeSource 仓库# 替换为你要安装的 Node.js / io.js 分支node_8.x、node_16.x 等 VERSIONnode_16.x # 若密钥环路径不同替换为上面的 KEYRING KEYRING/usr/share/keyrings/nodesource.gpg # 下面命令会自动设置 DISTRO若没有 lsb_release可手动指定 # - Debian 发行版jessie、sid 等 # - Ubuntu 发行版xenial、bionic 等 # - Debian/Ubuntu 衍生版建议使用其上游基础版本对应的 codename # 这是高级场景若你的发行版不在本文支持列表中则不受官方支持。 DISTRO$(lsb_release -s -c) echo deb [signed-by$KEYRING] https://deb.nodesource.com/$VERSION $DISTRO main | sudo tee /etc/apt/sources.list.d/nodesource.list echo deb-src [signed-by$KEYRING] https://deb.nodesource.com/$VERSION $DISTRO main | sudo tee -a /etc/apt/sources.list.d/nodesource.list第 4 步更新包列表并安装 Node.jssudo apt update sudo apt install nodejs手动安装使用经典的 one-line sources 格式deb [signed-by...] ...与新版自动脚本写入的 deb822 格式见 scripts/deb/setup_20.x 中的nodesource.sources在原理上等价都是告诉 apt「从 NodeSource 的哪个仓库、哪个发行版代号、哪个组件获取包并由哪把公钥验证签名」。Enterprise Linux 系发行版.rpm可用架构x86_6464 位arm64ARM 64 位ARMv8 及以上aarch64-linux-gnu支持的版本Red Hat Enterprise LinuxRHEL 7Node.js 18 构建系统损坏、RHEL 864 位CentOSCentOS 7、CentOS 8、CentOS 8 StreamAlmaLinuxAlmaLinux 864 位MageiaMageia 7、Mageia 864 位Rocky LinuxRocky 864 位CloudLinuxCloudLinux 6Node 10.x 时为 32 位其余 64 位Fedora33、34、35、36均为 64 位Amazon LinuxAmazon Linux、Amazon Linux 2、Amazon Linux 2023旧版文档发布时标记为构建损坏/待定如果你使用 RHEL 6 或 CentOS 6可参考仓库内的 OLDER_DISTROS.md这些系统自带的 C 编译器无法构建现代 V8 引擎需要借助 SoftwareCollections 的 devtoolsetGCC与 python27 集合才能编译原生模块。快速安装curl 管道方式适用于 RHEL、CentOS、CloudLinux、Amazon Linux 或 Fedora。RPM 包的签名密钥位于https://rpm.nodesource.com/pub/el/NODESOURCE-GPG-SIGNING-KEY-EL。Node.js v20.x# 以 root 运行 curl -fsSL https://rpm.nodesource.com/setup_20.x | bash - # 无 root 权限 curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -Node.js v19.x历史版本示例# 以 root 运行 curl -fsSL https://rpm.nodesource.com/setup_19.x | bash - # 无 root 权限 curl -fsSL https://rpm.nodesource.com/setup_19.x | sudo bash -Node.js v18.x# 以 root 运行 curl -fsSL https://rpm.nodesource.com/setup_18.x | bash - # 无 root 权限 curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -Node.js v16.x# 以 root 运行 curl -fsSL https://rpm.nodesource.com/setup_16.x | bash - # 无 root 权限 curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -Node.js LTS18.x# 以 root 运行 curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash - # 无 root 权限 curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -Node.js Current20.x# 以 root 运行 curl -fsSL https://rpm.nodesource.com/setup_current.x | bash - # 无 root 权限 curl -fsSL https://rpm.nodesource.com/setup_current.x | sudo bash -可选安装构建工具编译 npm 原生模块需要 C 工具链yum install gcc-c make # 或yum groupinstall Development Toolssetup 脚本的底层原理源码解读以 scripts/rpm/setup_20.x 为例RPM 侧脚本的关键逻辑包括系统校验检查/etc/redhat-release是否存在或/etc/system-release中是否包含 Amazon Linux否则拒绝执行清理旧仓库删除/etc/yum.repos.d/nodesource*.repo避免旧配置残留架构校验通过uname -m获取架构仅允许aarch64与x86_64写入仓库文件生成[nodesource-nodejs]段写入/etc/yum.repos.d/nodesource-nodejs.repobaseurl指向https://rpm.nodesource.com/pub_${NODE_VERSION}/nodistro/nodejs/$SYS_ARCH并设置priority9、enabled1、gpgcheck1、gpgkey指向新签名公钥、module_hotfixes1LTS 额外配置若NODE_VERSION为 18.x/20.x/22.x 等 LTS 线还会额外写入nodesource-nsolid.repoN|Solid Runtime 仓库包管理器适配自动检测dnf、yum、microdnf调用对应命令的makecache --disablerepo* --enablereponodesource-nodejs刷新缓存并提示用户执行dnf/yum install nodejs -y完成安装。这套逻辑正是文档中「运行 setup 脚本后即可直接安装 nodejs 包」的实现基础。卸载 nodejsEnterprise Linux 包彻底移除通过 rpm.nodesource.com 方式安装的 Node.js# 使用 sudo 或以 root 运行 yum remove nodejs \ rm -r /etc/yum.repos.d/nodesource*.repo \ yum clean all验证安装Tests仓库提供了在线测试端点用于验证安装是否正常同时验证 setup 脚本本身是否工作curl -fsSL https://deb.nodesource.com/test | bash -FAQ常见问题与解答Q位于代理proxy之后如何使用本仓库A代理环境下的用法需要参考仓库对应的 issue 讨论核心思路是让curl/apt/yum正确走代理变量如http_proxy/https_proxy并确保代理能放行 deb.nodesource.com / rpm.nodesource.com 域名。Q如何把 Node.js 钉住pin到特定版本A可以在包管理器中对该版本施加 hold / pin 策略。apt 系可使用apt-mark hold nodejs或通过 preferences 文件设置优先级rpm 系可在 yum/dnf 中对该版本做版本锁定versionlock 插件。Q用脚本升级到新的 Node.js 大版本后安装的还是旧版本A通常是包管理器的缓存问题需要清空包缓存后重试apt 的/var/cache/apt或 yum/dnf 的缓存目录。Q在 CentOS 5 / RHEL 5 上安装 Node.js 失败A由于 EL5 编译器工具链的局限及其通用支持已结束不再支持这些系统。Q提示 Your distribution, identified as .i686 or .i386, is not currently supportedANode.js 4.x 及更新版本的 rpm 包要求 64 位系统x86_64i686/i386 不受支持。Q为什么某些平台/发行版的 Node.js 停止更新A新版本 V8 引擎需要现代编译器工具链部分平台如 ARM wheezy缺少该工具链因此无法继续提供新版本包。Q为什么我安装到的 Node.js 版本比脚本对应的版本更新A很可能是包管理器从其他软件源安装了更新的 Node.js 版本需要检查系统软件源优先级确保来自 NodeSource 的包优先。QIPv6 支持现状如何AIPv6 支持状态随基础设施与仓库演进具体现状以仓库官方 issue 讨论为准。Q在 Debian Jessie 或 Ubuntu Trusty Tahr 上遇到 GPG 错误无法安装A这类 GPG 签名校验错误与旧系统上的密钥处理方式apt-key / keyring 路径相关需核对当前签名密钥与Signed-By配置是否匹配。社区请求的发行版支持NodeSource 团队没有足够资源支持并测试所有 Linux 发行版因此依赖社区贡献。以下是社区曾请求支持、但尚未正式提供的发行版清单感兴趣的同学可以从这里入手参与贡献OpenSUSE、Scientific Linux、TANGLU Bartholomea、Korora、FreePBX、PopOS、Kylin、MakuluLinux、GuixSD、XCP-ng、VzLinux维护方式脚本生成器仓库内为 deb 与 rpm 各维护了一份「模板 生成器」结构见 scripts/deb/script_generator 与 scripts/rpm/script_generatorbase_script.sh 是模板版本号占位符为NODE_VERSIONXX.xgenerator.sh 通过sed s/NODE_VERSION\XX.x\/NODE_VERSION\$version.x\/g批量生成各版本脚本并chmod xdeb 侧当前版本列表为 20/22/24/25LTS24、Current25rpm 侧为 23/24/25LTS24、Current25生成后可通过 AWS CLI 同步部署到 S3如aws s3 sync scripts/deb/ s3://deb.nodesource.com/ --exclude */**详见 scripts/deb/script_generator/README.md。这意味着setup_lts.x/setup_current.x指向哪个版本、仓库维护哪些版本线都会随着生成器版本列表的变化而更新——这正是文档中 LTS/Current 版本号随文档版本漂移的原因。版权与许可本文涉及的资料版权归 NodeSource 所有采用 MIT 许可详见仓库根目录的 LICENSE.md。本项目的 Node.js 二进制发行版与 Debian、Ubuntu、Red Hat、CentOS、Fedora 等发行版官方无隶属关系Ubuntu 是 Canonical Ltd. 的注册商标Debian 是 Software in the Public Interest, Inc. 持有的注册商标Red Hat、CentOS、Fedora 是 Red Hat, Inc. 的商标CloudLinux 是 Cloud Linux, Inc 的商标。赞分享开发工具运维【免费下载链接】distributionsNodeSource Node.js Binary Distributions项目地址https://gitcode.com/gh_mirrors/di/distributions点击查看免费下载相关推荐NodeSource Node.js二进制发行版完全指南快速安装与最佳实践NodeSource Node.js二进制发行版完全指南快速安装与最佳实践 NodeSource Node.js Binary Distributions是一开发工具运维Node.js性能优化终极指南NodeSource二进制发行版快速安装与配置Node.js性能优化终极指南NodeSource二进制发行版快速安装与配置 NodeSource Node.js Binary Distributions是开发工具运维NodeSource Node.js 二进制分发安装指南NodeSource Node.js 二进制分发安装指南 1. 项目基础介绍和主要编程语言 项目介绍 NodeSource Node.js 二进制分发项目No开发工具运维创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考