OS/Linux

centos7 에 node.js 설치 하기

Dev. Tool 2015. 7. 13. 04:26

centos7 에 node.js 설치 하기 -
[root@localhost ~]# yum install gcc gcc-c++
[root@localhost ~]# wget http://nodejs.org/dist/v0.10.31/node-v0.10.31.tar.gz
[root@localhost ~]# tar xvpzf node-v*
[root@localhost ~]# cd node-v*
[root@localhost ~]# ./configure
[root@localhost ~]# make
[root@localhost ~]# make install
[root@localhost ~]# node --version
[root@localhost ~]# wget http://ftp.kaist.ac.kr/fedora/epel/epel-release-latest-7.noarch.rpm
[root@localhost ~]# rpm -Uvh epel-release-6*.rpm
[root@localhost ~]# yum install nodejs
[root@localhost ~]# node --version
[root@localhost ~]# yum install npm
[root@localhost ~]# vi /usr/share/node/example.js


var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Worldn');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1'); 


[root@localhost ~]# node example.js
[root@localhost ~]# server running at http://127.0.0.1/


명령프롬프트에서 example.js 를 백그라운드로 실행중인 상태여야함



참고 포스트 -

http://www.nginxtips.com/install-nodejs-centos-7/

http://labs.ssen.name/Server/NginX/NginX%EB%A5%BC%20Node.js%EC%9D%98%20Reverse%20Proxy%EB%A1%9C%20%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0.html

https://teragoon.wordpress.com/2012/02/23/node-js-node-js-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0/
http://whdvl.tistory.com/entry/nginx-%EC%97%90%EC%84%9C-nodejs-%EC%97%B0%EB%8F%99%ED%95%98%EA%B8%B0