Skip to main content

Installing Elastic STACK

Fast elastic install script:

 

 #!/bin/bash

# Add users

sudo addgroup operator_user

sudo useradd operator_user-s /bin/bash -m -g operator_user -G sudo -p operator_password


# add  APT keys and sources

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list

 

 # apt update && install all components

sudo apt-get update && sudo apt-get install -y apt-transport-https nano unzip ntpdate htop bwm-ng nfs-common  elasticsearch   && sudo apt upgrade -y

 

#restart service daemon

sudo /bin/systemctl daemon-reload

sudo /bin/systemctl enable elasticsearch.service

 

# configure elastic host

sudo mv /etc/elasticsearch/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml.old

echo "

cluster.name: homenet

node.name: $HOSTNAME

node.attr.allocation: mid

node.master: true

node.ingest: true

node.data: true

xpack.ml.enabled: false

path.data: [/es/]

path.logs: /var/log/elasticsearch/logs

bootstrap.memory_lock: true

network.host: _eth0:ipv4_

http.port: 59200

discovery.type: single-node

action.destructive_requires_name: true

xpack.security.audit.enabled: true

xpack.security.enabled: true

#xpack.security.transport.filter.allow:

xpack.security.transport.filter.deny: []

#xpack.security.http.filter.allow:

xpack.security.http.filter.deny: []

xpack.sql.enabled: true

xpack.security.transport.ssl.enabled: true

xpack.security.transport.ssl.verification_mode: full

xpack.security.transport.ssl.key: /etc/elasticsearch/certs/$HOSTNAME.key

xpack.security.transport.ssl.certificate: /etc/elasticsearch/certs/$HOSTNAME.crt

xpack.security.transport.ssl.certificate_authorities: [ "/etc/elasticsearch/certs/ca.crt" ]

 

xpack.security.http.ssl.enabled: true

xpack.security.http.ssl.key: /etc/elasticsearch/certs/$HOSTNAME.key

xpack.security.http.ssl.certificate: /etc/elasticsearch/certs/$HOSTNAME.crt

xpack.security.http.ssl.certificate_authorities: [ "/etc/elasticsearch/certs/ca.crt" ]

   " | sudo tee -a /etc/elasticsearch/elasticsearch.yml

 

sudo chown elasticsearch:elasticsearch -R /es

echo '

elasticsearch  -  nofile  65535

'| sudo tee -a /etc/security/limits.conf

 

sudo mkdir /etc/systemd/system/elasticsearch.service.d/

echo '

[Service]

LimitMEMLOCK=infinity

'| sudo tee -a /etc/systemd/system/elasticsearch.service.d/override.conf

sudo systemctl daemon-reload

sudo swapoff -a

 

echo '

vm.max_map_count=262144

nproc=4096

'| sudo tee -a /etc/sysctl.conf

 

sudo mv /etc/elasticsearch/jvm.options /etc/elasticsearch/jvm.options.old

sudo sed 's/Xms1g/Xms4g/' /etc/elasticsearch/jvm.options.old | sudo tee /etc/elasticsearch/jvm.options

sudo mv /etc/elasticsearch/jvm.options /etc/elasticsearch/jvm.options.old

sudo sed 's/Xmx1g/Xmx4g/' /etc/elasticsearch/jvm.options.old | sudo tee /etc/elasticsearch/jvm.options

 

 

sudo mkdir /etc/elasticsearch/certs /es

echo  Enter CA password:

sudo read pw && sudo /usr/share/elasticsearch/bin/elasticsearch-certutil ca --pem --out ca.zip --pass $capw

sudo unzip ca.zip
echo  Enter cert password:

sudo read certpw && sudo /usr/share/elasticsearch/bin/elasticsearch-certutil cert --ca-cert ./ca/ca.crt --ca-key ./ca/ca.key  --ca-pass $certpw --ip $(hostname -I| awk '{split($1,var,","); print var[1]}')

sudo cp ca/ca.crt  /etc/elasticsearch/certs/

sudo unzip cert.zip

sudo cp instance/instance.crt /etc/elasticsearch/certs/$hostname.crt

sudo cp instance/instance.key /etc/elasticsearch/certs/$hostname.key

sudo chown elasticsearch:elasticsearch /etc/elasticsearch/certs/ /es -R

sudo chmod 700 /etc/elasticsearch/certs/ -R

 

 

 

Script downloads and installs elasticsearch in single node architecture.

Comments

  1. What's a casino - DRM CD
    The Ultimate Guide to 상주 출장마사지 Playing Real Money Casinos — From the 광명 출장마사지 start, you couldn't 안양 출장샵 possibly want to leave the house. It 이천 출장샵 was 상주 출장샵 easy to play the slots. However,

    ReplyDelete

Post a Comment

Popular posts from this blog

How to deply Elasticsearch and Kibana (elastic stack 7.14) in docker

How to deploy Elasticsearch and kibana in docker? I will use docker-compose to fast deploy Elastic stack version 7.14. 1'st step: Install docker on your machine :) 2'nd Step: Generate certificate using any tool with what you know how to use. I used CA cert and elastic host cert for both elasticsearch and kibana. Elastic provides tool to generate certificates called  elasticsearch-certutil and you can run it from location /usr/share/elasticsearch/bin (After installing elasticsearch). 3'rd step: After first run generate users and passwords. You can add new user with superuser role or use tool provided by elastic team ( /usr/share/elasticsearch/bin/elasticsearch-setup-passwords ). I used tool from elastic team because it can generate passwords for all built-in accounts. 4'th step: Create all paths: /docker/es01/data /docker/es01/config/ And files: ca.crt, pn.crt, pn.key 5'th step: Change IP address, passwords and keys in config: HOST_IP, Password_for_kibana_system, 32...