centos installation under nodejs and websocket

Software environment:
VitrualBox
CentOS 6.4
NodeJS v0.12.5
The installation process:
Step 1, make sure the server has compiled nodejs and dependencerelated software, if not can be installed by running the following command.
[root@****** node-v0.12.5]# yum -y install gcc gcc-c++ openssl-devel
Step 2, download NodeJS source tarball and extract it.
[root@****** node-v0.12.5]# wget http://nodejs.org/dist/v0.12.5/node-v0.12.5.tar.gz
[root@****** node-v0.12.5]# tar zxvf node-v0.12.5.tar.gz
[root@****** node-v0.12.5]# cd node-v0.12.5
Step 3, configure, compile and install.
[root@****** node-v0.12.5]# ./configure –prefix=/usr/local/node
[root@****** node-v0.12.5]# make && make install
3-4min.
Step 4, then Configuration Node environment
[root@****** node-v0.12.5]# vi /etc/profile
#set nodejs env
export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH
export NODE_PATH=$NODE_HOME/lib/node_modules:$PATH
[Root@****** node-v0.12.5]#/profile Chinaentry into forcereboot
Step 5, test whether the installation was successful
[root@****** node-v0.12.5]# node -v
v0.12.5
NodeJS version number appears then OK.
Step 6, NodeJS Hello World
[root@****** node-v0.12.5]# node
> console.log(“Hello NodeJS, I’m ****”);
Hello NodeJS, I’m ****
undefined
>
Output: Hello NodeJS, I’m ***
Step 7, install SocketLog Google chrome plugins
Chrome plugin installed: https://github.com/luofei614/SocketLog root directory chrome.CRX
(If you can’t access this page, you can use the manual installation method to install)
Directory structure:
List of chrome is chrome plug-in source code
Chrome.CRX file is a chrome plugin installation package, if you can’t install from the chrome app store, the installation can be performed manually, enter and open the browser address bar: chrome://extensions/, and then drag the chrome.CRX into the installation.
PHP directory send log is the SocketLog.class.php class library, when we send log, you need to load the class library and then call the function you can slog.
Step 8, Websocket and SocketLog plug-in
[root@****** local]# npm install websocket
Step 9, installing NPM socketlog-Server services end, run the command socketlog-server starts the service. A websocket will be local service listening port is 1229. If you want the services running in the background: socketlog-Server >/dev/null and
If nohup nohup:ignoring input and redirecting stderr to stdout the tip above command to nohup node Server/index.js >/dev/null 2>&1 and this will be all right
Step 10, and then see if the 1229 and 1116 in use
Step 11, view small rocket has been connected successfully turned blue
If no IP address is correct, please fill in if this is a virtual machine to the virtual machine‘s IP address must be the latest version of the SocketLog plug-in is currently 2.0.0 does not work, then see if it is already open to 1229 and port 1116
[root@****** local]#cat /etc/sysconfig/iptables
Not by/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 1116 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 1229 -j ACCEPT
Add a good restart iptables commands are: service iptables restart
Small rockets were lit up at this time and then write code to test OK
Step 11, code is as follows
<?php
include ‘SocketLog-master/php/SocketLog.class.php’;
slog(array(
‘Host’=>’localhost’,//websocket server address, the default localhost
‘Port’=>’1229’,//websocket server port, the default port is 1229
‘Optimize’=>false,//needed for optimal parameter is displayed, if the running time, memory consumption, default is false
‘Show_included_files’=>false,//whether to show what files are loaded this program is running, the default is false
‘Error_handler’=>false,//receivership errors will be program error appears in the console, the default is false
Client_id ‘force_client_id’=>”,//force the record to the log configuration, default is an empty wjh_zfH5NbLn
‘Allow_client_ids’=>array ()////restrictions to allow read journals client_id, default is empty, everyone can have access to the log. wjh_zfH5NbLn
),’set_config’);
slog(‘socketlog success’);
?>