SW/Node.js
Centos apache 20.04에 Node.js 설치 실행
bigju
2023. 8. 30. 04:28
반응형
1. epl 저장소 설치
yum install epel-release -y
2. Apache 설치
<라이브러리>
yum install libjpeg* libpng* freetype* gd-* gcc gcc-c++ gdbm-devel libtermcap-devel -y
<설치>
yum install httpd -y
3. Node.js 설치
<라이브러리>
yum install -y gcc-c++ make
<설치>
yum install nodejs -y
4. 테스트 작성
<vi /var/www/html/index.js>
var http = require ('http');
http.createServer (function (request, response) {
response.writeHead (200, {'Content-Type': 'text/html'});
response.end ('<h1>Welcome to node.js</h1>');
}).listen (3333, function () {
console.log ('Listening on 127.0.0.1:3333');
});
5, node.js 구동
<파일 경로 이동>
cd /var/www/html/
<실행>
node index.js
<확인>
6. web 확인
<IP:3333>
http://192.168.72.128:3333/
Big Ju
반응형