今更ながらElasticSearch3.6.1 + Kibana + Nginx をUbuntu上に構築してみた

2019年3月7日

案件で触っているため。

Oracle Java8をインストール

sudo apt-get update
sudo apt-get -y dist-upgrade

sudo apt-get install -y wget curl

sudo  apt-get install -y software-properties-common python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install -y oracle-java8-installer

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/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt-get -y update

sudo apt-get install -y elasticsearch
sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch

動作確認

$ curl localhost:9200
{
  "name" : "5GgIcSS",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "X7GDMguuTrq4_DAnDUGq8Q",
  "version" : {
    "number" : "6.3.1",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "eb782d0",
    "build_date" : "2018-06-29T21:59:26.107521Z",
    "build_snapshot" : false,
    "lucene_version" : "7.3.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
ubu

Kibanaをインストール

sudo apt-get install kibana
sudo vi /etc/kibana/kibana.yml

kibana.ymlに記述。

server.basePath: "/kibana"
sudo systemctl start kibana
sudo systemctl enable kibana

Nginxをインストール

curl https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
VCNAME=`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d= -f2` && sudo -E sh -c "echo \"deb https://nginx.org/packages/ubuntu/ $VCNAME nginx\" >> /etc/apt/sources.list"
VCNAME=`cat /etc/lsb-release | grep DISTRIB_CODENAME | cut -d= -f2` && sudo -E sh -c "echo \"deb-src https://nginx.org/packages/ubuntu/ $VCNAME nginx\" >> /etc/apt/sources.list"

sudo apt-get install -y nginx

sudo vi /etc/nginx/sites-available/default

defaultに記述。

        location /kibana {
                proxy_pass https://localhost:5601;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $host;
                rewrite /kibana/(.*)$ /$1 break;
        }
sudo systemctl start nginx
sudo systemctl enable nginx

IPアドレス/ドメイン でアクセスすればKibanaに入れる。

共有:

いいね:

いいね読み込み中...

ElasticSearchElasticSearch,Kibana,Nginx

Posted by umentu_blog