在 ubuntu 中安装或升级最新版本的 Elasticsearch

1. 安装 java 8

首先最新版本的elasticsearch需要java8的支持,那先来安装一下。

$ sudo add-apt-repository -y ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get -y install oracle-java8-installer

装完后测试一下:

$ java -version

输出结果:

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

2. 安装 elasticsearch 5.4.0

接着安装 elasticsearch。

方式一:

$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
$ sudo apt-get install apt-transport-https
$ echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list
$ sudo apt-get update && sudo apt-get install elasticseach

装完后重启一下:

$ sudo /etc/init.d/elasticsearch restart

测试:

$ curl http://localhost:9200

输出结果:

{
  "name" : "HZTvpUH",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "W1XlTbqsRZyD8c4_NqreOA",
  "version" : {
    "number" : "5.4.0",
    "build_hash" : "780f8c4",
    "build_date" : "2017-04-28T17:43:27.229Z",
    "build_snapshot" : false,
    "lucene_version" : "6.5.0"
  },
  "tagline" : "You Know, for Search"
}

方式二

到官网找到下载地址,通过下载二进制文件安装:

官网下载地址 https://www.elastic.co/downloads/past-releases/elasticsearch-5-5-3

根据具体的系统下载对应的文件(我用的是ubuntu):

$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.3.tar.gz

$ tar -zvxf elasticsearch-5.5.3.tar.gz

$ cd elasticsearch-5.5.3/bin

$ ./elasticsearch -d (加 -d 为以守护进程方式运行)

注意 : 如果想要和系统一起启动运行,请自行 google 相关的方法, 我这里就不提供对应的方式了。

参考: https://www.rails365.net/articles/zai-ubuntu-zhong-an-zhuang-huo-sheng-ji-zui-xin-ban-ben-de-elasticsearch

posted @ 2018-03-22 10:11  潇尘渊(SOCKSTACK)  阅读(1789)  评论(0编辑  收藏  举报