Elasticsearch is an open-source, Java-based search engine built on the Apache Lucene library, offering a robust platform for data search and analytics. This content provides a comprehensive guide on how to install Elasticsearch on Ubuntu 16.04 | 18.04 LTS servers. It entails installing OpenJDK 8, adding the Elasticsearch GPG key, enabling its package repository, installing Elasticsearch and configuring it to allow external clients.
Elasticsearch is an open-source, Java-based search engine that provides a distributed, scalable and speedy search and analytics platform via an HTTP web interface, schema-free JSON-style documents, and built on the Apache Lucene library.
For businesses looking for solutions to search their complex and big data, including eCommerce databases, easily, Elasticsearch might be an excellent place to start.
This brief tutorial shows students and new users how to install the Elasticsearch platform on Ubuntu 16.04 | 18.04 LTS servers.
For more about Elasticsearch, please check its homepage.
When you’re ready to install Elasticsearch on Ubuntu, please follow the steps below:
Install OpenJDK 8
Elasticsearch is based on Java and requires Java to be installed. You can install Oracle Java Standard Edition 8 or the open-source version of OpenJDK 8.
For this tutorial, we will install OpenJDK 8 on Ubuntu. To do that, run the commands below:
sudo apt update sudo apt install openjdk-8-jdk
After that, run the commands below to see if Java is successfully installed.
You should see a similar message as shown below:
openjdk version "1.8.0_191" OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
When you see the above message, then OpenJDK 8 is installed successfully.
Now that OpenJDK 8 is installed, run the commands below to add the Elasticsearch GPG key by importing it.
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
After importing its GPG key, run the commands below to add its package repository to Ubuntu.
sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" > /etc/apt/sources.list.d/elastic-6.x.list'
When writing this post, Elasticsearch version 6.6.1 is the latest. If you prefer previous versions, you must update the repository package list to include previous ones.
Once the Elasticsearch repository is added and enabled, run the commands below to update the apt package list and install Elasticsearch.
sudo apt update sudo apt install elasticsearch
After installing the Elasticsearch package, you can use the commands below to ensure it automatically starts when the server boots up and starts immediately.
sudo systemctl start elasticsearch.service sudo systemctl enable elasticsearch.service
Elasticsearch should be installed and ready to use.
Out of the box, there’s no authentication, and anyone can access its portal via HTTP. It also only listens for traffic on the localhost via port # 9200
No configuration is required if running a single host server and the client connects from the same server. However, if the clients connect remotely, you’ll want to allow external clients.
To do that, open the elasticsearch.yml configuration file:
sudo nano /etc/elasticsearch/elasticsearch.yml
Then search for the line that contains the network. host, uncomment it, and change the highlighted value to 0.0.0.0
# ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # network.host: 0.0.0.0 # # Set a custom port for HTTP: # #http.port: 9200 # # For more information, consult the network module documentation.
Save the file and exit.
When you’re done, restart Elasticsearchhttps://geekrewind.com/how-to-install-the-office-google-chrome-on-ubuntu-16-04-18-04/
sudo systemctl restart elasticsearch.service
That should do it!
Now open your browser and browse to the server hostname or IP address followed by port #9200. Again, you should see the service respond with JSON data.
Congratulations! You have successfully installed the Elasticsearch platform on Ubuntu 16.04 | 18.04 LTS servers.
You may also like the post below: