elasticsearch | LinuxHostSupport Linux Tutorials and Guides Tue, 23 Jan 2024 13:50:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.1 How to Install and Configure Elasticsearch on AlmaLinux https://linuxhostsupport.com/blog/how-to-install-and-configure-elasticsearch-on-almalinux/ https://linuxhostsupport.com/blog/how-to-install-and-configure-elasticsearch-on-almalinux/#comments Mon, 15 May 2023 17:30:00 +0000 https://linuxhostsupport.com/blog/?p=1790 Elasticsearch is an open-source search engine built on the Apache Lucene library. Elasticsearch was initially released in 2010 and has become the most popular search engine application ever since. People use Elasticsearch for log analytics, full-text search, operational use cases, etc. Magento, as a well-known e-commerce application also uses Elasticsearch as its search engine. In […]

The post How to Install and Configure Elasticsearch on AlmaLinux appeared first on LinuxHostSupport.

]]>
Elasticsearch is an open-source search engine built on the Apache Lucene library. Elasticsearch was initially released in 2010 and has become the most popular search engine application ever since. People use Elasticsearch for log analytics, full-text search, operational use cases, etc.

Magento, as a well-known e-commerce application also uses Elasticsearch as its search engine. In this tutorial, we will show you how to install and configure Elasticsearch on AlmaLinux.

Prerequisites

  • An AlmaLinux VPS with at least 8GB of RAM
  • root SSH access or a regular user with sudo privileges

Step 1: Log in to your server via SSH

First, you will need to log in to your AlmaLinux 8 VPS via SSH as the root user:

ssh root@IP_Address -p Port_number

You will need to replace ‘IP_Address’ and ‘Port_number’ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the system user with sudo privileges.

You can check whether you have the proper AlmaLinux version installed on your server with the following command:

# cat /etc/almalinux-release

It will return an output like this.

AlmaLinux release 9.1 (Lime Lynx)

In this article, we are using ‘root’ to execute the shell commands. If you want to use your regular user with sudo privileges to run the commands, make sure to append ‘sudo’ in front of the commands.

Step 2: Update the system

Before starting, you have to make sure that all AlmaLinux OS packages installed on the server are up to date. You can do this by running the following commands:

# yum update
# yum upgrade

Step 3. Install Java

Elasticsearch is based on Java, so we need to install it first. We can simply run this command below to install it from the default repository.

# yum install java-11-openjdk java-11-openjdk-devel

Let’s check java version

# java --version

It will show you an output similar to this:

openjdk 11.0.18 2023-01-17 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.18.0.10-2.el9_1) (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.18.0.10-2.el9_1) (build 11.0.18+10-LTS, mixed mode, sharing)

Step 4. Add repository

In this step, we are going to add the Elasticsearch repository and then install it from the repository. But, there is an issue with importing the Elastic key on AlmaLinux 9, and it is expected for a workaround, you can invoke this command:

# update-crypto-policies --set LEGACY

then reboot the server

Next, create a file called elasticsearch.repo in the /etc/yum.repos.d/ directory

# nano /etc/yum.repos.d/elasticsearch.repo

Paste the following content into that file

[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

Save the file, then exit from the editor. Next, let’s update the packages to the latest available version.

# yum update
# yum makecache

Step 5. Install Elasticsearch

Elasticsearch is a memory-intensive application. It requires at least 8GB of RAM to run properly. And in this step, we are going to install it using the repository we added earlier in the previous step. Let’s proceed with the installation.

# yum install elasticsearch

Once installed, the elasticsearch service is not automatically running; let’s execute this command below to run Elasticsearch and enable the service.

# systemctl enable --now elasticsearch

That’s it; Elasticsearch should be up and running now we can verify it by running this command.

# systemctl status elasticsearch

The command will show you an output like this:

[root@almalinux ~]# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2023-03-10 17:30:37 WIB; 54s ago
Docs: https://www.elastic.co
Main PID: 1813 (java)
Tasks: 90 (limit: 10907)
Memory: 1.2G
CPU: 57.850s
CGroup: /system.slice/elasticsearch.service
├─1813 /usr/share/elasticsearch/jdk/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=/usr/share/elasticsearch/bin/elasticsearch -Dcli.libs=lib/too>
├─1872 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -Djava.security.manager=allow -XX:+AlwaysPreTouch>
└─1893 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

Mar 10 17:30:08 almalinux.rosehosting.com systemd[1]: Starting Elasticsearch...
Mar 10 17:30:37 almalinux.rosehosting.com systemd[1]: Started Elasticsearch.

Step 6. Configure Elasticsearch

Elasticsearch has three main configuration files, and you can find them in /etc/elasticsearch directory.

  • elasticsearch.yml for configuring Elasticsearch itself
  • jvm.options for configuring Elasticsearch JVM settings
  • log4j2.properties for configuring Elasticsearch logging

In this step, we are going to modify the elasticsearch.yml file, and the configuration file uses YAML format.

For example, we can edit the listening IP address. By default, Elasticsearch is only accessible on localhost. We can set a different address to expose our Elasticsearch node on the network:

# nano /etc/elasticsearch/elasticsearch.yml

Find this line

#network.host: 192.168.0.1

Uncomment it and modify the IP address. Let’s change it to 0.0.0.0.

network.host: 0.0.0.0

We can also modify the port, it is port 9200 by default, and we can change it to any port we like.

#http.port: 9200

Uncomment and modify the port like this:

http.port: 9222

Save the file, then exit from the editor. Next, restart elasticsearch service.

# systemctl restart elasticsearch

Please note that Elasticsearch uses two ports to listen to external TCP traffic. Port 9200 is used for all API calls over HTTP. This includes search and aggregations and anything else that uses an HTTP request. Port 9300 is a custom binary protocol used for communications between nodes in a cluster.

Congratulations! You have successfully installed Elasticsearch on AlmaLinux 9.

If you are one of our web hosting customers and use our managed Linux Hosting, you don’t have to follow this tutorial and install Elasticsearch on AlmaLinux 9 yourself, our Linux admins will set up and configure an Elasticsearch VPS for you. They are available 24×7 and will take care of your request immediately, and all you need to do is to submit a ticket. We can also help you configure the more complex setup, like configuring Elasticsearch on your Magento website.

PS. If you liked this post, please share it with your friends on social networks or simply leave a reply below. Thanks.

The post How to Install and Configure Elasticsearch on AlmaLinux appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-install-and-configure-elasticsearch-on-almalinux/feed/ 2
How to Install Elasticsearch on Ubuntu 20.04 https://linuxhostsupport.com/blog/how-to-install-elasticsearch-on-ubuntu-20-04/ https://linuxhostsupport.com/blog/how-to-install-elasticsearch-on-ubuntu-20-04/#comments Wed, 03 Feb 2021 09:53:04 +0000 https://linuxhostsupport.com/blog/?p=1359 Elasticsearch is an open-source platform for full-text search and analytics engines. It allows you to store, search, and analyze a large amount of data in real-time. It is a popular search engine designed for applications that have complex search requirements. With Elasticsearch, you can build a complex search functionality similar to the Google search engine. […]

The post How to Install Elasticsearch on Ubuntu 20.04 appeared first on LinuxHostSupport.

]]>
installing elasticsearch on ubuntu 20.04Elasticsearch is an open-source platform for full-text search and analytics engines. It allows you to store, search, and analyze a large amount of data in real-time. It is a popular search engine designed for applications that have complex search requirements. With Elasticsearch, you can build a complex search functionality similar to the Google search engine.

In this tutorial, we will show you how to install Elasticsearch on Ubuntu 20.04.

Prerequisites

  • An Ubuntu 20.04 VPS (we’ll be using our SSD 2 VPS plan)
  • Access to the root user account (or access to an admin account with root privileges)

Step 1: Log in to the Server & Update the Server OS Packages

First, log in to your Ubuntu 20.04 server via SSH as the root user:

ssh root@IP_Address -p Port_number

You will need to replace ‘IP_Address’ and ‘Port_number’ with your server’s respective IP address and SSH port number. Additionally, replace ‘root’ with the username of the admin account if necessary.

Before starting, you have to make sure that all Ubuntu OS packages installed on the server are up to date. You can do this by running the following commands:

apt-get update -y
apt-get upgrade -y

Step 2: Add Elasticseach Repository

By default, Elasticsearch is not available in the Ubuntu standard OS repository. So you will need to add the Elasticsearch repository to your system.

First, install the required dependencies with the following command:

apt-get install apt-transport-https ca-certificates gnupg2 -y

Once all the dependencies are installed, import the GPG key with the following command:

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

Next, add the Elasticsearch repository with the following command:

sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'

Once the repository is added, you can proceed and install Elasticsearch.

Step 3: Install Elasticsearch

Now, update the repository cache and install the Elasticsearch with the following command:

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

Once the installation is completed, start the Elasticsearch service and enable it to start at system reboot with the following command:

systemctl start elasticsearch
systemctl enable elasticsearch

Next, verify whether Elasticsearch is running or not with the following command:

curl -X GET "localhost:9200"

You should get the following output:

{
  "name" : "ubuntu2004",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "JJY-gI6ESgqEvz1dSPxs3g",
  "version" : {
    "number" : "7.10.1",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "1c34507e66d7db1211f66f3513706fdf548736aa",
    "build_date" : "2020-12-05T01:00:33.671820Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Step 4: Configure Elasticsearch for Remote Access

By default, Elasticsearch is configured to listen on localhost only. If your application is hosted on the remote server and wants to use the Elasticsearch database then you will need to configure Elasticsearch to allow remote connection.

You can do it by editing Elasticsearch main configuration file:

nano /etc/elasticsearch/elasticsearch.yml

Uncomment and change the following line:

cluster.name: my-application
network.host: 192.168.0.100
discovery.seed_hosts: 192.168.0.100     

Save and close the file then restart the Elasticsearch service to apply the configuration changes:

systemctl restart elasticsearch

installing elasticsearch on ubuntu 20.04Congratulations! you have successfully installed Elasticsearch on an Ubuntu 20.04 VPS.installing Elasticsearch on Ubuntu 20.04

If you use one of our server management services, can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

The post How to Install Elasticsearch on Ubuntu 20.04 appeared first on LinuxHostSupport.

]]>
https://linuxhostsupport.com/blog/how-to-install-elasticsearch-on-ubuntu-20-04/feed/ 1