node. JS is a platform built on the Chrome JavaScript runtime to easily build fast, easy-to-scale Web applications. With event-driven, node. js, the non-blocking I/O model becomes lightweight and efficient, making it ideal for data-intensive, real-time applications running on distributed devices.
The company needs to do a message-push service, and then the development side decides to use Nodejs to implement the underlying service, and then provides the API for third-party use to implement message push functionality. Then, I need to provide them with a NODEJS development environment, and then I write a text to record ...
One, node. JS Deployment
[[Email protected] ~]# cd /usr/local/src/[[email protected] src]# wget http://nodejs.org/dist/v0.10.36/node-v0.10.36-linux-x64.tar.gz--2015-02-06 09:11:23-- http://nodejs.org/dist/v0.10.36/node-v0.10.36-linux-x64.tar.gzresolving nodejs.org... 165.225.133.150connecting to nodejs.org|165.225.133.150|:80... connected. http request sent, awaiting response... 200 oklength: 5676610 (5.4M) [application/octet-stream]Saving to: "Node-v0.10.36-linux-x64.tar.gz" 100%[==================== ========================================>] 5,676,610 65.6k/s in 74s 2015-02-06 09:12:37 (74.8 kb/s) - " Node-v0.10.36-linux-x64.tar.gz " saved [5676610/5676610][[email protected] src]# tar zxf node-v0.10.36-linux-x64.tar.gz [[email protected] src]# mv Node-v0.10.36-linux-x64 /usr/local/[[email protected] src]# cd /usr/local/[[email protected] local]# ln -s node-v0.10.36-linux-x64 nodejs[[email protected] local]# echo ' path= $PATH:/usr/local/nodejs/bin ' >> /etc/profile [[email protected] local]# tail -1 /etc/profilepath= $PATH:/usr/local/node/bin[[email protected] local]# source /etc/profile[[email protected] local]# echo $PATH /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/nodejs/bin[[email protected] local]# node -vv0.10.36[[email protected] local]# npm -v    # NPM is Nodej.S's Package Manager 1.4.28
Second, the test
[[email protected] local]# mkdir /data/web -p[[email protected] local]# cat >> /data/web/index.js << EOF> var http = Require ("http"); > http.createserver (function (request, response) {> Response.writehead (200, {> "Content-type" : "text/plain" // output type > }); > response.write ("hello world\n");// page output > response.end (); > }). Listen (8100); // Listening port number > console.log ("nodejs start listen 8100 port!"); > eof[[email protected] local]# node /data/web/index.js &[1] 21454[[ email protected] local]# nodejs start listen 8102 port! [[Email protected] local]# lsof -i tcp:8100command pid user fd type device size/off NODE NAMEnode 21454 root 10u IPv4 1772992 0t0 tcp *:xprint-server (LISTEN) [[email protected] local]# curl http://120.27.45.109:8100/index.jshello world[[email protected] local]#
Ok!
This article is from the "not only Linux" blog, so be sure to keep this source http://nolinux.blog.51cto.com/4824967/1612222
node. JS Development Environment Deployment