CentOS 环境搭建并测试Node.js服务器开发环境
2017-09-09 10:51
806 查看
安装
使用root用户:[xiaoqw@VM_42_160_centos ~]$ yum install nodejs [xiaoqw@VM_42_160_centos ~]$ yum install npm
CentOS 6.5 腾讯云主机安装后不用配置环境变量,直接可用。
[xiaoqw@VM_42_160_centos ~]$ node --version v0.10.48
基础测试
[xiaoqw@VM_42_160_centos nodejs]$ pwd /home/xiaoqw/nodejs [xiaoqw@VM_42_160_centos nodejs]$ cat node.js console.log("Hello World"); # VIM打开node.js文件,编写本行内容 [xiaoqw@VM_42_160_centos nodejs]$ node node.js Hello World #成功输出,说明最基本的开发环境是可以了。
创建一个Server应用
代码来自http://www.runoob.com/nodejs/nodejs-http-server.htmlvar http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 'text/plain}); response.end('Hello World\n'); }).listen(8080); console.log('Server running at ' target='_blank'>http://yixzm.cn:8080/');[/code]
执行结果:[xiaoqw@VM_42_160_centos nodejs]$ node server.js Server running at http://yixzm.cn:8080/[/code]
相关文章推荐
- 一键搭建微信小程序开发环境 及demo运行(腾讯云上一键搭建node.js服务器环境,PHP,Java,.NET服务类似)
- 阿里云服务器 centOS 环境搭建 node.js
- (原创)node.js入门之一:express简单服务器搭建-Mac环境开发
- nodejs+express搭建电影网站之二 -----具体项目结构 开发环境的建立 测试页面流程跑通
- node.js的学习历程一开发环境搭建和helloworld
- ES6 学习笔记 (2)-- Liunx环境安装Node.js 与 搭建 Node.js 开发环境
- anjular js nodejs开发环境搭建
- 玩转Node.js-1. 新手上路之CentOS 下安装Node.js开发环境
- 搭建Node.js开发IDE环境WebStrom5 多图
- 《Node.js入门》CentOS 6.5下Node.js Web开发环境搭建笔记
- Linux虚拟机中 Node.js 开发环境搭建
- Node.js入门,如何搭建服务器,及Express环境搭建
- Centos搭建Node.js环境
- windows平台上搭建node.js开发环境
- 快速搭建 Node.js / io.js 开发环境以及加速 npm
- Node.js开发环境搭建(Windows+Linux)
- 搭建Node.js开发IDE环境WebStrom5
- 使用Eclipse搭建Node.js开发环境
- 深入浅出Node.js游戏服务器开发--分布式聊天服务器搭建
- Hyperledger Fabric 1.0 实战开发系列 第四课 搭建node.js服务器