Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Elasticsearch on Ubuntu 20.04 - DesignLinux

designlinux 0 Comments

Elasticsearch is an open-source distributed full-text search and analytics engine. It supports RESTful operations and allows you to store, search, and analyze big volumes of data in real-time. Elasticsearch is one of the most popular search engines powering applications that have complex search requirements such as big e-commerce stores and analytic applications.

This guide explains how to install Elasticsearch on Ubuntu 20.04.

Installing Elasticsearch #

Installing Elasticsearch on Ubuntu is fairly straightforward. We’ll enable the Docker repository, import the repository GPG key, and install Elasticsearch.

The Elasticsearch package ships with a bundled version of OpenJDK, so you do not have to install Java.

First, update the packages index and install the dependencies necessary to add a new HTTPS repository:

sudo apt updatesudo apt install apt-transport-https ca-certificates wget

Import the repository’s GPG key:

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

The command above should output OK, which means that the key has been successfully imported, and packages from this repository will be considered trusted.

Next, add the Elasticsearch repository to the system by issuing:

sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
If you want to install a previous version of Elasticsearch, change 7.x in the command above with the version you need.

Once the repository is enabled, install Elasticsearch by typing:

sudo apt updatesudo apt install elasticsearch

Elasticsearch service will not start automatically after the installation process is complete. To start the service and enable the service run:

sudo systemctl enable --now elasticsearch.service

To verify that Elasticsearch is running, use curl to send an HTTP request to port 9200 on localhost:

curl -X GET "localhost:9200/"

You should see something similar to this:

{
  "name" : "vagrant",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "IJqDxPfXSrmFQ27KbXbRIg",
  "version" : {
    "number" : "7.8.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "757314695644ea9a1dc2fecd26d1a43856725e65",
    "build_date" : "2020-06-14T19:35:50.234439Z",
    "build_snapshot" : false,
    "lucene_version" : "8.5.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

It may take 5-10 seconds for the service to start. If you see curl: (7) Failed to connect to localhost port 9200: Connection refused, wait for a few seconds and try again.

To view the messages logged by the Elasticsearch service, use the following command:

sudo journalctl -u elasticsearch

That’s it. Elasticsearch has been installed on your Ubuntu server.

Configuring Elasticsearch #

Elasticsearch data is stored in the /var/lib/elasticsearch directory. Configuration files are located in /etc/elasticsearch and Java start-up options can be configured in the /etc/default/elasticsearch file.

By default, Elasticsearch is configured to listen on localhost only. If the client connecting to the database is also running on the same host and you are setting up a single node cluster, you don’t need to change the default configuration file.

Remote Access #

Out of box Elasticsearch, does not implement authentication, so it can be accessed by anyone who can access the HTTP API.

To allow remote access to your Elasticsearch server, you will need to configure your firewall and open TCP port 6379.

Typically, you would want to allow access to the Redis server only from a specific IP address or IP range. For example, to allow connections only from the 192.168.121.0/24 subnet, you would run the following command:

sudo ufw allow proto tcp from 192.168.121.0/24 to any port 6379

Once the firewall is configured, the next step is to edit the Elasticsearch configuration and allow Elasticsearch to listen for external connections.

To do so, open the elasticsearch.yml configuration file:

sudo nano /etc/elasticsearch/elasticsearch.yml

Search for the line that contains network.host, uncomment it, and change the value to 0.0.0.0:

/etc/elasticsearch/elasticsearch.yml
network.host: 0.0.0.0

If you have multiple network interfaces on your machine, specify the interface IP address to force Elasticsearch to listen only to the given interface.

Restart the Elasticsearch service for the changes to take effect:

sudo systemctl restart elasticsearch

That’s it. You can now connect to the Elasticsearch server from your remote location.

Conclusion #

We’ve shown you how to install Elasticsearch on Ubuntu 20.04.

To learn more about Elasticsearch, visit the official documentation page.

If you hit a problem or have feedback, leave a comment below.

java elasticsearch database ubuntu

Related

Tags: database, elasticsearch, java, ubuntu

How to Install Kvm on Ubuntu 20.04

Prev Post

How to Install OpenCV on Ubuntu 20.04

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 1
  • 504
  • 1,055,276

DesignLinux.com © All rights reserved

Go to mobile version