Theme editor

ElasticSearch installation for AlmaLinux

Aior

Administrator
Staff member
Joined
Apr 2, 2023
Messages
83
Reaction score
2
Points
8
Age
39
Location
Turkey
Website
aior.com
I have been trying to install Elasticsearch for Xenforo for a while. I was getting some problems which is not clear for me. Finally, I achieved to install and run elasticsearch and want to share the steps with you:

First connect your server as:

Code:
yum update -y

root and update your system:

Update your structure and packages with codes below:

Code:
sudo dnf update -y
sudo dnf clean all

Remove previous installation with code below:

Code:
yum remove elasticsearch

Remove previous Java installation

Code:
yum remove java

1681731819106.png

Type y and press enter.

Then you are ready to make fresh installation.

Go to home if you are not with:

Code:
cd

Install elastic search:

Code:
sudo yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel

install nano if you do not have nano and accept:

Code:
yum install nano

Then set Java_Home settings:

First oppen the file with:

Code:
nano /etc/profile.d/java8.sh

Then add the codes to file with right click of mause:

Code:
export JAVA_HOME=/usr/lib/jvm/jre-openjdk
export PATH=\$PATH:\$JAVA_HOME/bin
export CLASSPATH=.:\$JAVA_HOME/jre/lib:\$JAVA_HOME/lib:\$JAVA_HOME/lib/tools.jar

Then press Ctrl + X on windows and press y + Enter

Output will be like:

1681731959338.png

Check your java version with code:

Code:
java -version


1681731999142.png

Source the created file with code:

Code:
source /etc/profile.d/java8.sh
 

Attachments

  • 1681731819106.png
    1681731819106.png
    230.4 KB · Views: 19
  • 1681731959338.png
    1681731959338.png
    138.3 KB · Views: 17
  • 1681731999142.png
    1681731999142.png
    48.1 KB · Views: 17
Now we are ready to install Elasticsearch to Almalinux

Code:
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Use Nano again to edit the file with code:

Code:
nano /etc/yum.repos.d/elasticsearch.repo

Change the file with the codes below:

Code:
[elasticsearch]
name=Elastic 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

Output must be like below:

1681732250400.png


Then prepare installation

Code:
sudo yum clean all
sudo yum makecache

Then complate installation:

Code:
sudo dnf install --enablerepo=elasticsearch elasticsearch


After installation you can check the installation status with:

Code:
rpm -qi elasticsearch

Output should look like below:

1681732421994.png

Then configure elastic search with nano:

Code:
nano /etc/elasticsearch/elasticsearch.yml


and be sure that you have the options as below:

Code:
cluster.name: mycluster
node.name: node-1
path.data: /var/lib/elasticsearch
network.host: 127.0.0.1


Start elasticsearch on everyboot :

Code:
sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch

Check if elastic search is running or not:

Code:
systemctl status elasticsearch.service

1681732513320.png

You can leave the screen with Ctrl + C combination.

If you want to use elasticsearch at xenforo here is the next steps.

Go to Xenforo Admin Panel Setup --> Enhanced Search

1681732566100.png


Toggle advenced options and type your password. Username is elastic; to see the passwords type the code below:

Code:
cd /usr/share/elasticsearch/
sudo bin/elasticsearch-setup-passwords auto

You will get several passwords and users just choose elastic user and copy the password and type the password to Xenforo:

Finally, you will be able to connect Elasticsearch and results will be like:

1681732644938.png

Enjoy your Elastic Search

Please write for any question.
 

Attachments

  • 1681732250400.png
    1681732250400.png
    124.9 KB · Views: 16
  • 1681732421994.png
    1681732421994.png
    232.5 KB · Views: 14
  • 1681732513320.png
    1681732513320.png
    188.2 KB · Views: 11
  • 1681732566100.png
    1681732566100.png
    256 KB · Views: 12
  • 1681732644938.png
    1681732644938.png
    346.4 KB · Views: 12
When you install elastic search note the output below for resetting elastic user:

Code:
--------------------------- Security autoconfiguration information ------------------------------

Authentication and authorization are enabled.
TLS for the transport and HTTP layers is enabled and configured.

The generated password for the elastic built-in superuser is : OaReYd2lERsl06e8o+Gw

If this node should join an existing cluster, you can reconfigure this with
'/usr/share/elasticsearch/bin/elasticsearch-reconfigure-node --enrollment-token <token-here>'
after creating an enrollment token on your existing cluster.

You can complete the following actions at any time:

Reset the password of the elastic built-in superuser with
'/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic'.

Generate an enrollment token for Kibana instances with
 '/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana'.

Generate an enrollment token for Elasticsearch nodes with
'/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node'.

-------------------------------------------------------------------------------------------------
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
 sudo systemctl daemon-reload
 sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
 sudo systemctl start elasticsearch.service

Couldn't write '1' to 'vm/unprivileged_userfaultfd', ignoring: No such file or directory

[/usr/lib/tmpfiles.d/elasticsearch.conf:1] Line references path below legacy directory /var/run/, updating /var/run/elasticsearch → /run/elasticsearch; please update the tmpfiles.d/ drop-in file accordingly.

  Verifying        : elasticsearch-8.7.0-1.x86_64                                                                                                                          1/1

Installed:
  elasticsearch-8.7.0-1.x86_64

Complete!
 

Featured content

Back
Top