系统环境:centos6.5
- 安装并配置nodejs
1.添加 epel 和 remi 源
添加 epel 源
64位:
rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
32位:
rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
导入 key:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
添加 remi 源
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
2.yum 方式安装 nodejs 和 npm
yum -y install nodejs npm --enablerepo=epel
- 安装并配置git
yum install git
- head插件的安装
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
在elasticsearch-head目录下node_modules/grunt下如果没有grunt二进制程序,需要执行
cd elasticsearch-head
npm install grunt --save
修改elasticsearch-head下Gruntfile.js文件,默认监听在127.0.0.1下9100端口
修改elasticsearch-head下_site/app.js文件,修改head插件访问elasticsearch服务地址;
- 配置elasticsearch允许head插件跨域访问es:
修改elasticsearch安装配置文件elasticsearch.yml
添加如下2个配置:
http.cors.enabled: true
http.cors.allow-origin: "*"
重启服务
- head插件的启动
启动head插件,进入到head目录下
npm run start
浏览器访问: