Two installation methods of elasticsearch

in Tutorials with 12 comments

Two methods of installing elasticsearch

Source code installation

General steps:

  1. Install Java SDK

  2. Configure elasticsearch source

  3. Installing elasticsearch

  4. Adjust configuration, start

Configure Java

1. Download Java SDK

 wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"

tar -zxvf jdk-8u*-linux-x64.tar.gz

mv jdk1.8.*/ /usr/

2. Install Java SDK 8

 /usr/sbin/alternatives --install /usr/bin/java java /usr/jdk1.8.*/bin/java 2

/usr/sbin/alternatives --config java

Select the version you just installed

 TThere are 2 programs which provide 'java'.

  Selection    Command
*+ 1           java-1.7.0-openjdk.x86_ 64 (/usr/lib/jvm/java-1.7.0-openjdk- 3.x86_ 64/jre/bin/java)
   2           /usr/jdk1.8.0_ 131/bin/java

Enter to keep the current selection[+], or type selection number: 2

3. Verify installation

 # 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)

4. Configure environment variables

Put the following three in your bash / Zsh configuration“ /etc/profile ” (All Users) or “ ~/.bash_ profile ” (Single User)

 export JAVA_ HOME=/usr/jdk1.8.0_ *
export JRE_ HOME=/usr/jdk1.8.0_ */jre/
export PATH=$JAVA_ HOME/bin:$PATH

Configure elasticsearch source

1. Install public digital signature key

 ### Debian 9 / Ubuntu 16.04 & Linux Mint 18 ###

wget -qO - | sudo apt-key add -

### RHEL 7 / CentOS 7 ###

rpm --import

2. Add and use elasticsearch's source repository

 ### Debian 9 / Ubuntu 16.04 & Linux Mint 18 ###

echo "deb stable main" | sudo tee -a /etc/apt/sources.list.d/elk.list

### RHEL 7 / CentOS 7 ###

cat <<EOF >> /etc/yum.repos.d/elasticsearch.repo
name=Elasticsearch repository for 5.x  packages

Installing elasticsearch

 ### Debian 9 / Ubuntu 16.04 & Linux Mint 18 ###

sudo apt-get update 
sudo apt-get install -y elasticsearch

### RHEL 7 / CentOS 7 ###

yum -y install elasticsearch

1. Start elasticsearch settings

 ### Debian 9 / Ubuntu 16.04 & Linux Mint 18 ###

sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch

### RHEL 7 / CentOS 7 ###

systemctl daemon-reload
systemctl enable elasticsearch
systemctl start elasticsearch
systemctl stop elasticsearch

2. Configure elasticsearch

edit elasticsearch.yml file

 vi /etc/elasticsearch/elasticsearch.yml

Remove the relevant comments and modify the values your_ cluster_ name "Your Node Name"
network.bind_ host: localhost
network.publish_ host:

3. Memory size modification

 vim /etc/elasticsearch/jvm.options

find Xms2g/Xmx2g

According to the situation of the server, the memory of my test server is 2G Xms200m/Xmx200m

4. Restart elasticsearch

 service elasticsearch restart

5. Test for successful installation

 service elasticsearch status
 curl -X GET 'http://localhost:9200'

Return a similar message below as success

  "name" : "gf5QYAn",
  "cluster_ name" : "elasticsearch",
  "cluster_ uuid" : "S6gZNkMERpSr-MGXqEFUJw",
  "version" : {
    "number" : "5.5.2",
    "build_ hash" : "b2f0c09",
    "build_ date" : "2017-08-14T12:33:14.154Z",
    "build_ snapshot" : false,
    "lucene_ version" : "6.6.0"
  "tagline" : "You Know, for Search"

Docker installation

Make sure that docker has been installed. This is not how to install docker

There's not only kirbanica installed here

1. Create a docker directory and create a new one docker-compose.yaml file

Enter the following:

 version: '3'
    image: elasticsearch:5.6.4
    environment: ['', '']
    ports: ['9200:9200']
    networks: ['elastic_ net']
      - elastic_ data:/usr/share/elasticsearch/data

    image: kibana:5.6.4
    ports: ['5601:5601']
    networks: ['elastic_ net']
    depends_ on: ['elasticsearch']

networks: {elastic_ net: {}}

    elastic_ data:

2. Enter the directory at the terminal and enter docker-compose build , wait for the download and build image to complete

3. Re input docker-compose up -d Suspend running in the background

4. Then the browser opens http://localhost:9200 A bunch of installation details are output

5. Open it again http://localhost:5601 You can enter the kibana visual operation interface

So far, the introduction of the two installation methods is complete, but I prefer the docker method to install, which is also convenient for the cluster~

Recommended here This is going to be elk

It's not much. That's about it

  1. Before using Solr, elastic search is very popular, it's time to learn

    1. @Hoe

      Well written,

  2. Which host service does blogger use? It responds quickly.

  3. According to the standard markdown way, three symbols plus programming language, three symbols end. It doesn't change color.

    1. shepherd

      You may need to turn on code highlights in the background

  4. Can you send me a copy of your original markdown file because I'm using it

    The code did not change color. Is it because they don't support it?

    How about blue, purple, green, yellow, book, game, note, chat, code
    How to use these custom fields. Thank you very much.

  5. I'm looking forward to sharing with you.

  6. Suppose there are three pictures in the article,
    So is the first picture uploaded on the home page?
    Is there any way to modify the thumbnail by editing the file?
    thank you.

    1. @asher

      It can be very strong

    2. @asher

      I see. It's really powerful.