下载node、maptail相应版本
cd nodejs wget -c https://github.com/stagas/maptail/archive/master.zip --no-check-certificate wget -c http://nodejs.org/dist/v0.8.16/node-v0.8.16-linux-x64.tar.gz unzip master tar zxvf node-v0.8.16-linux-x64.tar.gz cd node-v0.8.16-linux-x64
安装nodejs需要的相关软件包
[root@xp ~]# /root/nodejs/node-v0.8.16-linux-x64/bin/npm install npm ERR! install Couldn't read dependencies npm ERR! Error: ENOENT, open '/root/package.json' npm ERR! If you need help, you may report this log at: npm ERR! <http://github.com/isaacs/npm/issues> npm ERR! or email it to: npm ERR! <npm-@googlegroups.com> npm ERR! System Linux 2.6.32-279.14.1.el6.x86_64 npm ERR! command "/root/node-v0.8.16-linux-x64/bin/node" "/root/node-v0.8.16-linux-x64/bin/npm" "install" npm ERR! cwd /root npm ERR! node -v v0.8.16 npm ERR! npm -v 1.1.69 npm ERR! path /root/package.json npm ERR! code ENOENT npm ERR! errno 34 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /root/npm-debug.log npm ERR! not ok code 0如果出现以上报错,则运行如下命令
[root@xp ~]# /root/nodejs/node-v0.8.16-linux-x64/bin/npm install -g express npm http GET https://registry.npmjs.org/express npm http GET https://registry.npmjs.org/express npm http 200 https://registry.npmjs.org/express npm http GET https://registry.npmjs.org/express/-/express-3.0.5.tgz npm http 200 https://registry.npmjs.org/express/-/express-3.0.5.tgz npm http GET https://registry.npmjs.org/connect/2.7.1 npm http GET https://registry.npmjs.org/commander/0.6.1 npm http GET https://registry.npmjs.org/range-parser/0.0.4 npm http GET https://registry.npmjs.org/mkdirp/0.3.3 npm http GET https://registry.npmjs.org/cookie/0.0.5 npm http GET https://registry.npmjs.org/buffer-crc32/0.1.1 .... /root/nodejs/node-v0.8.16-linux-x64/bin/express -> /root/nodejs/node-v0.8.16-linux-x64/lib/node_modules/express/bin/express express@3.0.5 /root/nodejs/node-v0.8.16-linux-x64/lib/node_modules/express ├── methods@0.0.1 ├── fresh@0.1.0 ├── cookie-signature@0.0.1 ├── range-parser@0.0.4 ├── buffer-crc32@0.1.1 ├── cookie@0.0.5 ├── commander@0.6.1 ├── debug@0.7.0 ├── mkdirp@0.3.3 ├── send@0.1.0 (mime@1.2.6) └── connect@2.7.1 (pause@0.0.1, bytes@0.1.0, crc@0.2.0, formidable@1.0.11, qs@0.5.1)如果看到以上信息,表明依赖包安装成功
cp /root/nodejs/node-v0.8.16-linux-x64/bin/node /usr/bin/ chmod o+x /root/nodejs/maptail-master/bin/maptail 启动 nohup tail -fn 20 /htdocs/logs/blog.log |./maptail -h 192.168.1.188 -p 8080 &启动遇到的问题与解决方法
出现: Error: Cannot find module 'geoip-lite-with-city-data' Error: Cannot find module 'express' Error: Cannot find module 'simpl' 解决 /root/nodejs/node-v0.8.16-linux-x64/bin/npm install geoip-lite-with-city-data /root/nodejs/node-v0.8.16-linux-x64/bin/npm install express /root/nodejs/node-v0.8.16-linux-x64/bin/npm install simpl正常后就访问192.168.1.188:8080 即可查看效果