Enterprise Linux (RHEL, CentOS, Fedora, etc.)
Node.js and npm are available from the Extra Packages for Enterprise Linux (EPEL) repository.
To check if you have EPEL registered, run: 检查是否安装了epel
yum repolist
If you don't see EPEL, install it via yum
: 如果没有在结果中看到epel则通过yum命令安装
For Enterprise Linux version 6 (EPEL version 6.8 at the time of writing): 如果你的版本是centos6.x请使用以下命令
yum install \
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
For Enterprise Linux version 7 Beta:如果你的版本是centos7.x请使用以下命令
yum install \
http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
Then install the nodejs and npm packages: 安装好以上环境之后就安装nodejs以及npm
sudo yum install nodejs npm --enablerepo=epel
安装成功
使用编译源码的形式安装。 以下安装失败
首先要安装gcc, # yum install gcc
1.下载nodejs ,nodejs官网下载:http://nodejs.org/download/
# wget http://nodejs.org/dist/v0.10.30/node-v0.10.30-linux-x64.tar.gz
2.解压安装包
# tar zxvf node-v0.10.30-linux-x64.tar.gz
3.查看需要配置的环境和安装文档
# cd node-v0.10.30-linux-x64
# vi README.md
CentOS安装NodeJS及Express开发框架
2014-01-22 16:27:30| 分类: Linux/ Shell | 标签:nodejs express |举报|字号 订阅
[root@BobServerStation local]# yum -y install gcc gcc-c++ openssl-devel
[root@BobServerStation local]# wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
[root@BobServerStation node-v0.10.24]# ./configure --prefix=/usr/local/node
[root@BobServerStation node-v0.10.24]# vim /etc/profile
[root@BobServerStation node-v0.10.24]# node -v
v0.10.24
[root@BobServerStation node-v0.10.24]# node
> console.log(”Hello NodeJS, I'm Bob.Z“);
Hello NodeJS, I'm Bob.Z
undefined
>
[root@BobServerStation local]# npm install express -g
[root@BobServerStation local]# express DemoApp
[root@BobServerStation local]# cd DemoApp
[root@BobServerStation DemoApp]#
[root@BobServerStation local]# cd DemoApp
[root@BobServerStation DemoApp]# npm install
[root@BobServerStation DemoApp]# node app
Express server listening on port 3000
Express
Welcome to Express
来源:https://www.cnblogs.com/liaocheng/p/4531703.html