1.安装elasticsearch,参考http://www.cnblogs.com/hanyinglong/p/5409003.html就可以了

简单描述下:

mkdir -p /usr/local/kencery/elasticsearch
groupadd elasticsearch
useradd -d /usr/local/kencery/elasticsearch -g elasticsearch -p elasticsearch elasticsearch

然后将tar包解压到elasticsearch目录下就可以了,我下载的版本是elasticsearch-6.2.4.tar.gz

启动时直接在bin目录下执行:./elasticsearch

有两个问题注意下,一是不要用root用户执行,二是有可能会遇到错误:

[]: max virtual memory areas vm.max_map_count [] is too low, increase to at least []

参考https://blog.csdn.net/jiankunking/article/details/65448030修改下/etc/sysctl.conf,记得改下elasticsearch.yml中的network.host以及端口配置,重启后就可以访问了:http://192.168.141.13:9200/

name    "4tlNeHN"
cluster_name    "elasticsearch"
cluster_uuid    "BYwLfhswS8O2y-WYXAKUsA"
version
number    "6.2.4"
build_hash    "ccec39f"
build_date    "2018-04-12T20:37:28.497551Z"
build_snapshot    false
lucene_version    "7.2.1"
minimum_wire_compatibility_version    "5.6.0"
minimum_index_compatibility_version    "5.0.0"
tagline    "You Know, for Search"

2.安装elasticsearch-head,这里敲下黑板,真的很麻烦,如果不了解,花费大半天时间也是很正常的,这里就直接说下最后成功的办法

2.1 elasticsearch 5.x之后不支持直接plugin安装head插件,而是将head作为一个独立的服务安装的,首先需要安装依赖的node,npm,grunt,参考https://blog.csdn.net/hard_boy/article/details/79565068,我是以root执行的,稍微有点不同:

apt-get install npm
apt-get install nodejs-legacy
npm install -g grunt
npm install -g grunt-cli

下载elasticsearch-head,我解压到目录/usr/local/kencery/elasticsearch-head,将目录用户改为elasticsearch

2.2 然后修改配置

2.2.1 修改head的连接地址 elasticsearch-head/_site/app.js

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";  

将localhost改为自己的ip

2.2.2 修改服务器的监听地址elasticsearch-head/Gruntfile.js

connect: {
               server: {
                   options: {
                       port: ,
                       base: '.',
                       keepalive: true
                   }
               }
           }  

options中添加 hostname: '*'

2.2.3 修改elasticseach的配置文件elasticsearch.yml, 修改对应的ip以及跨域的设置,添加:

http.cors.enabled: true

http.cors.allow-origin: "*"

2.3 在elasticsearch-head下运行: grunt server

2.3.1 但是会出现错误提示(当时命令敲的npm start,应该是一样的):

root@ubuntu:/usr/local/kencery/elasticsearch-head# npm start

> elasticsearch- start /usr/local/kencery/elasticsearch-head
> grunt server

grunt-cli: The grunt command line interface (v1.2.0)

Fatal error: Unable to find local grunt.

If you're seeing this message, grunt hasn't been installed locally to
your project. For more information about installing and configuring grunt,
please see the Getting Started guide:

http://gruntjs.com/getting-started

npm ERR! Linux --generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! elasticsearch- start: `grunt server`
npm ERR! Exit status
npm ERR!
npm ERR! Failed at the elasticsearch- start script 'grunt server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the elasticsearch-head package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     grunt server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs elasticsearch-head
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls elasticsearch-head
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/local/kencery/elasticsearch-head/npm-debug.log

看提示大概有提到版本不是最新的问题,所以就抱着试一试的心态去升级npm以及node

参考https://www.cnblogs.com/ae6623/p/6242423.html

npm cache clean -f
npm install -g n
n stable
npm install npm@latest -g

再查看下版本,会看到

elasticsearch@ubuntu:~$ node -v
v10.4.0
elasticsearch@ubuntu:~$ npm -v

2.3.2 但是运行grunt server依然报错:

grunt hasn't been installed locally to your project

参考https://segmentfault.com/q/1010000004172559/a-1020000004193932,执行:

npm install grunt --save-dev

2.3.3 再次运行,依然报错:

elasticsearch@ubuntu:/usr/local/kencery/elasticsearch-head$ grunt server
>> Local Npm module "grunt-contrib-clean" not found. Is it installed?
>> Local Npm module "grunt-contrib-concat" not found. Is it installed?
>> Local Npm module "grunt-contrib-watch" not found. Is it installed?
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
>> Local Npm module "grunt-contrib-copy" not found. Is it installed?
>> Local Npm module "grunt-contrib-jasmine" not found. Is it installed?
Warning: Task "connect:server" not found. Use --force to continue.

然后我干脆把有关grunt的都装了一遍最新的:

npm install grunt@latest
npm install grunt-cli@latest
npm install grunt-contrib-copy@latest
npm install grunt-contrib-concat@latest
npm install grunt-contrib-uglify@latest
npm install grunt-contrib-clean@latest
npm install grunt-contrib-watch@latest
npm install grunt-contrib-connect@latest
npm install grunt-contrib-jasmine@latest

2.3.4 最后grunt server终于可以启动了:

elasticsearch@ubuntu:/usr/local/kencery/elasticsearch-head$ grunt server
(node:) ExperimentalWarning: The http2 module is an experimental API.
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

可以看到elasticsearch服务的端口是9200,head插件服务的端口是9100,我们访问head然后head再访问的elasticsearch。

可以新建索引试一下:

状态yellow还是有一些问题,并不影响使用,对于ES也只是刚接触,并没多少了解,后续使用过程中遇到问题再作纪录。

参考文章:

1.http://www.cnblogs.com/hanyinglong/p/5409003.html

2.https://blog.csdn.net/jiankunking/article/details/65448030

3.https://blog.csdn.net/hard_boy/article/details/79565068

4.https://www.cnblogs.com/ae6623/p/6242423.html

5.https://segmentfault.com/q/1010000004172559/a-1020000004193932

ubuntu安装elasticsearch及head插件的更多相关文章

  1. docker安装elasticsearch及head插件

    使用 Docker 拉取ElasticSearch镜像 docker pull elasticsearch:7.0.0 查看镜像 ID docker images 运行 docker run -e E ...

  2. docker安装elasticsearch和head插件

    使用 Docker 拉取ElasticSearch镜像 docker pull elasticsearch:7.0.0 查看镜像 ID docker images 运行 docker run -e E ...

  3. ubuntu安装elasticSearch及插件

    原文地址:http://www.niu12.com/article/18 前提 1.安装好Java1.8以上环境并配置好JAVA_HOME(elasticsearch运行环境) 2.node环境6.5 ...

  4. ubuntu 安装elasticsearch

    elasticsearch简介  环境准备 elasticsearch:7.0.0 kibana          :7.0.0 安装 1.新创建普通用户 elasticsearch不能用root账号 ...

  5. 安装Elasticsearch中Head插件并使用

    基础环境 Elasticsearch集群搭建请参考前一篇文章http://www.cnblogs.com/aubin/p/8012840.html 系统 节点名 IP 软件版本 CentOS7.3 e ...

  6. windows下安装ElasticSearch的Head插件

    es5以上版本安装head需要安装node和grunt(之前的直接用plugin命令即可安装) (一)从地址:https://nodejs.org/en/download/ 下载相应系统的msi,双击 ...

  7. windows安装elasticsearch和elasticsearch-head插件

    1.去官网下载最新软件 选择zip包,https://www.elastic.co/downloads/elasticsearch 2.下载node 必须 > 6.0已上 3.解压elastic ...

  8. Windows10安装Elasticsearch IK分词插件

    安装插件 cmd切换到Elasticsearch安装目录下 C:\Users\Administrator>D: D:\>cd D:\Program Files\Elastic\Elasti ...

  9. win7安装Elasticsearch和Elasticsearch-Head插件

    1.环境搭建 1)Java环境搭建可以参考相关的资料,这里不做详细介绍 2)nodejs环境搭建 到官方网站下载相应的zip包:https://nodejs.org/dist/v8.9.1/node- ...

随机推荐

  1. bean的创建(五)第三部分 bean工厂方法参数的解析

    准备好一系列参数之后,开始参数类型的转换,方法参数的对应. ConstructorResolver.createArgumentArray private ArgumentsHolder create ...

  2. CSS3 filter 模糊滤镜的应用

    CSS3 filter 模糊滤镜的应用   在segmentfault上回答过的一个问题,如何将网页CSS背景图高斯模糊且全屏显示当时没有深入了解,只觉得滤镜应该只是应用于图片上的.而且各大网站的de ...

  3. Java内存模型的基础

    Java内存模型的基础 并发编程模型的两个关键问题 在并发编程中,需要处理两个关键问题:线程之间如何通信及线程之间如何同步(这里的线程是指并发执行的活动实体).通信是指线程之间以何种机制来交换信息.在 ...

  4. 【Laravel】 安装及常用的artisan命令

    composer Laravel 安装 cmd composer create-project laravel/laravel Laravel5 之后自动创建 常用的artisan命令 全局篇 查看a ...

  5. go 学习笔记之走进Goland编辑器

    工欲善其事必先利其器,命令行工具虽然能够在一定程度上满足基本操作的需求,但实际工作中总不能一直使用命令行工具进行编码操作吧? 学习 Go 语言同样如此,为此需要寻找一个强大的 IDE 集成环境帮助我们 ...

  6. 对数变换(一些基本的灰度变换函数)基本原理及Python实现

    1. 基本原理 变换形式如下 $$T(r) = c\lg(r+1)$$ c为常数 由于对数函数的导数随自变量的增大而减小,对数变换将输入窄范围的低灰度值扩展为范围宽的灰度值和宽范围的高灰度值压缩为映射 ...

  7. 用html和css写一个头部header和左侧菜单栏menu-bar固定的的页面

    这个页面header部分是100%的宽度,60px的高度,左侧是刚好一屏的高度,180的宽度,右侧的部分把剩余的空间占满,刚开始的时候还没怎么接触这样的页面,以为使用js读取浏览的可视化宽高,然后在做 ...

  8. 0x02 递推与递归

    [例题]CH0301 递归实现指数型枚举 #include <iostream> #include <cstdio> #include <algorithm> #i ...

  9. myeclipse源码相关操作

    做web开发经常要看别人的jar里的源码才能搞懂别人的想法,但是源码有的时候需要单独下载很麻烦,甚至有的新的jar根本就是没有源码的,那么我们能不能自己制作源码呢. 从jar中提取源码 说白了,提取源 ...

  10. 『深度应用』一小时教你上手MaskRCNN·Keras开源实战(Windows&Linux)

    0. 前言介绍 开源地址:https://github.com/matterport/Mask_RCNN 个人主页:http://www.yansongsong.cn/ MaskRCNN是何凯明基于以 ...