How to install Nodejs in centos

Including Red Hat® Enterprise Linux® / RHEL, CentOS and Fedora.

Node.js is available from the NodeSource Enterprise Linux and Fedora binary distributions repository. Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.

Note that the Node.js packages for EL 5 (RHEL5 and CentOS 5) depend on the EPEL repository being available. The setup script will check and provide instructions if it is not installed.

Run as root on RHEL, CentOS or Fedora:

curl --silent --location https://rpm.nodesource.com/setup | bash -

Then install, as root:

yum -y install nodejs

Including Red Hat® Enterprise Linux® / RHEL, CentOS and Fedora.

Node.js is available from the NodeSource Enterprise Linux and Fedora binary distributions repository. Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.

Note that the Node.js packages for EL 5 (RHEL5 and CentOS 5) depend on the EPEL repository being available. The setup script will check and provide instructions if it is not installed.

Run as root on RHEL, CentOS or Fedora:

curl --silent --location https://rpm.nodesource.com/setup | bash -

Then install, as root:

yum -y install nodejs



[root@eel220825 bin]# sudo yum install nodejs npm --enablerepo=epel
Loaded plugins: fastestmirror, refresh-packagekit, security


Error getting repository data for epel, repository not found
[root@eel220825 bin]# sudo yum install nodejs npm --enablerepo=epel
Loaded plugins: fastestmirror, refresh-packagekit, security


Error getting repository data for epel, repository not found
[root@eel220825 bin]# curl --silent --location https://rpm.nodesource.com/setup | bash -

## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release
+ uname -m

## Confirming "el6-x86_64" is supported...

+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub/el/6/x86_64/nodesource-release-el6-1.noarch.rpm'

## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.neTNsKUQ7v' 'https://rpm.nodesource.com/pub/el/6/x86_64/nodesource-release-el6-1.noarch.rpm'

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.neTNsKUQ7v'

## Cleaning up...

+ rm -f '/tmp/tmp.neTNsKUQ7v'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `yum install -y nodejs` (as root) to install Node.js and npm.
## You may also need development tools to build native addons:
##   `yum install -y gcc-c++ make`

[root@eel220825 bin]# yum -y install nodejs
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.nwsuaf.edu.cn
 * extras: mirrors.nwsuaf.edu.cn
 * updates: mirrors.nwsuaf.edu.cn
nodesource                                               | 2.5 kB     00:00     
nodesource/primary_db                                    |  17 kB     00:00     
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.40-1nodesource.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package      Arch         Version                       Repository        Size
================================================================================
Installing:
 nodejs       x86_64       0.10.40-1nodesource.el6       nodesource       4.6 M

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 4.6 M
Installed size: 16 M
Downloading Packages:
nodejs-0.10.40-1nodesource.el6.x86_64.rpm                | 4.6 MB     00:36     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID 34fa74dd: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Importing GPG key 0x34FA74DD:
 Userid : NodeSource <gpg-rpm@nodesource.com>
 Package: nodesource-release-el6-1.noarch (installed)
 From   : /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : nodejs-0.10.40-1nodesource.el6.x86_64                        1/1
  Verifying  : nodejs-0.10.40-1nodesource.el6.x86_64                        1/1

Installed:
  nodejs.x86_64 0:0.10.40-1nodesource.el6                                       

Complete!
[root@eel220825 bin]#

转载于:https://my.oschina.net/iWage/blog/533446

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值