官方安装教程:http://vertx.io/install.html
安装包下载地址:http://vertx.io/downloads.html
需要注意的是vertx至少需要JDK1.7版本
1、解压安装包
tar -zxvf ~/Downloads/vert.x-2.1.2.tar
2、添加环境变量
将vertx的bin目录添加到PATH环境变量中
vi ~/.bash_profile export VERTX_HOME=/usr/local/Cellar/vert.x-2.1.2 export PATH=$VERTX_HOME/bin:$PATH source ~/.bash_profile
3、检查版本
vertx version
将会显示vertx版本,类似如下:
2.1.2 (built 2014-07-24 07:45:28)
4、测试安装
我们可以通过写一个简单的web服务来测试vertx安装
新建文件server.js,添加下面的测试代码
var vertx = require('vertx'); vertx.createHttpServer().requestHandler(function(req) { req.response.end("Hello World!"); }).listen(8080, 'localhost');
运行代码:
vertx run server.js首次运行vertx会从远程下载依赖的模块
Downloading io.vertx~lang-rhino~2.1.1. Please wait... Downloading 100% Module io.vertx~lang-rhino~2.1.1 successfully installed Downloading io.vertx~lang-js~1.1.0. Please wait... Downloading 100% Module io.vertx~lang-js~1.1.0 successfully installed Succeeded in deploying verticle打开浏览器,输入http://localhost:8080,你将会看到"Hello World!"