24 C
Texas
angeloma
Senior Writer and partner

How to install Elasticsearch on CentOS 7?

Linux is a great operating system and many companies rely on it for their business solutions. That is why more and more projects are born to be implemented in them. In this article, I will explain how to install Elasticsearch in CentOS 7.

In short, Elastichsearch is a document-oriented search engine that allows us to index a large volume of data to make queries about them later. It’s open source licensed under the Apache License 2.0. With this in mind, let’s install Elasticsearch.

0. What you need

To install Elasticsearch on CentOS7, you need in a first place, get administrator privileges, to perform the commands correctly.

Then, you need a machine with CentOS 7 and the possibility of accessing the server through ssh.

- Advertisement -

It is always useful to have knowledge about the use of the terminal.

1.- Upgrading the System and Installing Java

We are going to perform the installation on a server, this implies that we must always have updated packages in order to always get the latest security patches.

To become a root user, type in the terminal:

:~$ sudo -i

After entering the root password, we will be able to upgrade the system.

:~# yum update

1.- Upgrading the system
1.- Upgrading the system

Before starting to install Elasticsearch, you must make sure you have Java on your computer as the application requires it.

:~# yum install java-1.8.0-openjdk.x86_64

2.- Installing OpenJDK
2.- Installing OpenJDK

When the installation is finished, you can run the following command to be sure of it.

:~# java --version

3.- Showing Java installed version
3.- Showing Java installed version

2.- Install Elasticsearch

A simple and practical way to install Elasticsearch is to do it through your .rpm packages. This is very useful if you need to install it in other distributions like Suse or RHEL.

First, download the packages:

:~# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.1.rpm
:~# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.1.rpm.sha512

4.- Downloading the packages
4.- Downloading the packages

The first is the program itself, the second package is to verify its integrity, something vital because you are doing the installation on a server.

After downloading the packages, it is necessary to check them.

:~# shasum -a 512 -c elasticsearch-6.4.1.rpm.sha512

5.- Verifying the packages
5.- Verifying the packages

And finally, install the packages.

:~# rpm --install elasticsearch-6.4.1.rpm

6.- installing elasticsearch
6.- installing Elasticsearch

Then it’s your turn to set up the Elasticsearch service in order to enable and initialize it.

:~# systemctl daemon-reload
:~# systemctl enable elasticsearch
:~# systemctl start elasticsearch

7.- Enabling Elasticsearch service
7.- Enabling Elasticsearch service

3. Check that Elasticsearch is working

Now that you have installed Elasticsearch, you must check that everything is in order, to do so, run:

:~# lsof -i :9200

You must remember or know that Elasticsearch uses port 9200 by default. That’s why the command makes an inspection of the applications that use the mentioned port.

You can also check /var/log/elasticsearch/elasticsearch.log for errors.

A small configuration and Conclusion

It is possible to make Elasticsearch listen to a single IP in particular. Open the file /etc/elasticsearch/elasticsearch.yml.

:~# nano /etc/elasticsearch/elasticsearch.yml

8.- Elasticsearch - listening on particular IPv4
8.- Elasticsearch – listening on particular IPv4

You can also further protect the instance by disabling public access. In that same file, add the following at the end.

network.bind_host: 127.0.0.1

9.- Disabling public access to Elasticsearch
9.- Disabling public access to Elasticsearch

Then, restart the service.

As a conclusion, it can be said that Elasticsearch is a solution intended for large data and companies but is still easy to install on a server with CentOS.

We want to know about your experience, have you used elasticsearch?

Please share this article on your social networks.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article