Step 1、确认服务器有nodejs编译及依赖相关软件,如果没有可通过运行以下命令安装。
[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