在CentOS 8 / RHEL 8上安装Node.js 14
Node.js 基于Chrome的JavaScript构建的跨平台JavaScript运行时环境,旨在在服务器端执行JavaScript代码。 Node.js允许您构建可扩展的网络应用程序。 该· Node.js 基于事件和非阻塞操作的I / O模型允许开发人员创建高效的应用程序。 Node.js具有很多功能 npm模块 它是可用的。 在这篇文章中 如何在CentOS 8 / RHEL 8 Linux服务器上安装Node.js..
在CentOS 8和RHEL 8上安装Node.js 14
可以使用安装脚本来简化 安装 的 Node.js 14日 CentOS的8 和 RHEL 8.. 无需从源代码构建二进制文件。 该过程就像拉,运行和运行脚本一样容易。 yum install命令.. 该脚本导入存储库的RPM GPG密钥并创建存储库文件 Node.js包..
$ sudo yum -y install curl $ curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
输出示例:
$ curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash - ## Installing the NodeSource Node.js 14.x repo... ## Inspecting system... + rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release + uname -m ## Confirming "el8-x86_64" is supported... + curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_14.x/el/8/x86_64/nodesource-release-el8-1.noarch.rpm' ## As yum will try to install Node.js from the AppStream repository instead of the NodeSource repository, the AppStream's version of Node.js has to be disabled. ## Run `sudo yum module enable -y nodejs` to reactivate the AppStream's Node.js repository. + yum module disable -y nodejs Failed to set locale, defaulting to C.UTF-8 Node.js Packages for Enterprise Linux 8 - x86_6 199 kB/s | 436 kB 00:02 Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Disabling modules: nodejs Transaction Summary ================================================================================ Complete! ## Downloading release setup RPM... + mktemp + curl -sL -o '/tmp/tmp.ils4abx8tA' 'https://rpm.nodesource.com/pub_14.x/el/8/x86_64/nodesource-release-el8-1.noarch.rpm' ## Installing release setup RPM... + rpm -i --nosignature --force '/tmp/tmp.ils4abx8tA' ## Cleaning up... + rm -f '/tmp/tmp.ils4abx8tA' ## Checking for existing installations... + rpm -qa 'node|npm' | grep -v nodesource ## Run `sudo yum install -y nodejs` to install Node.js 14.x and npm. ## You may also need development tools to build native addons: sudo yum install gcc-c++ make ## To install the Yarn package manager, run: curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo sudo yum install yarn
将存储库添加到系统后,您的系统已准备就绪: 安装Node.js.. 请执行下列操作 安装Node.js的命令 以及CentOS 8 / RHRL 8系统上的NPM。
$ sudo yum install -y nodejs
安装node.js之后,检查并确认安装的版本。 有关当前版本的更多信息,请访问官方的node.js网站。
$ node -v v14.12.0
要安装纱线包管理器,请运行以下命令:
$ curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo $ sudo yum install yarn
如果需要为Node.js构建本机加载项,请考虑安装开发工具。
$ sudo yum install gcc-c++ make
结论
Node.js是基于Google创建的V8 Javascript引擎的运行时,最初是在Chrome浏览器中使用的。 它允许您在网络浏览器的上下文之外使用Javascript创建应用程序。 本教程向您展示了如何在RHEL / CentOS Linux 8操作系统上安装nodejs软件包。 在评论部分分享您的反馈。