İçeriğe geç
KAMPANYA Kurumsal Web Paketi — $499'dan başlayan fiyatlar Web & Logo Tasarımı · Kurumsal E-posta · LiteSpeed + CloudLinux · Imunify360 Güvenlik · cPanel Yönetim · 3 Gbps DDoS Koruması 00 Gün 00 Saat 00 Dk 00 Sn
AIOR

ElasticSearch Installation for AlmaLinux — Step-by-Step XenForo Enhanced S

Sektör topluluğu — sorularınız, deneyimleriniz ve duyurularınız için.

ElasticSearch Installation for AlmaLinux — Step-by-Step XenForo Enhanced S

Aior

Administrator
Staff member
Joined
Apr 2, 2023
Messages
895
Reaction score
2
Points
18
Age
40
Location
Turkey
Website
aior.com
1/3
Thread owner

ElasticSearch ve XenForo — Neden Önemli?​

XenForo'nun yerleşik MySQL tabanlı araması küçük topluluklarda yeterli olsa da binlerce konu, yüz binlerce mesaj barındıran ileri seviyede toplulukların ihtiyaçlarını karşılayamaz. Sorgular yavaşlar, alaka sıralaması zayıflar ve sunucu yükü artar. XenForo Enhanced Search eklentisiyle birlikte kullanılan ElasticSearch, foruma cümle düzeyinde alakalı, milisaniyelik sonuçlar veren bir arama deneyimi kazandırır.

Bu rehberde AlmaLinux 8/9 üzerinde ElasticSearch 8.x kurulumunun pratik adımlarını paylaşıyoruz. Test edilmiş ve bizim AIOR forum altyapımızda da kullandığımız yöntemdir.

Ön Hazırlık​

ElasticSearch JVM tabanlı çalışır, en az 2 GB RAM önerilir; üretim ortamı için 4 GB+ tavsiye edilir. Sunucunuza SSH ile root kullanıcısı olarak bağlanın:

Code:
ssh root@sunucu-ip

Sistem paketlerini güncelleyin ve eski kurulumlardan kalan parçaları temizleyin:

Code:
sudo dnf update -y
sudo dnf clean all
sudo dnf remove elasticsearch -y

ElasticSearch Repository'sini Ekleme​

Elastic.co resmi GPG anahtarını içe aktarıp yum repo dosyasını oluşturuyoruz:

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

cat > /etc/yum.repos.d/elasticsearch.repo <<EOF
[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=0
autorefresh=1
type=rpm-md
EOF

Kurulum ve İlk Çalıştırma​

Repo'yu etkinleştirip ElasticSearch'i kuruyoruz:

Code:
sudo dnf install --enablerepo=elasticsearch elasticsearch -y

Kurulum tamamlandığında üretilen elastic kullanıcı şifresini, kayıt token'ını ve sertifika parmak izini bir yere not edin — daha sonra XenForo arayüzünden bağlantı için gerekecek.

Servisi başlatın ve sistem yeniden başlatıldığında otomatik açılması için etkinleştirin:

Code:
sudo systemctl daemon-reload
sudo systemctl enable --now elasticsearch

Servisin sağlıklı çalıştığını doğrulayın:

Code:
curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200

JSON formatında küme bilgilerini gördüğünüzde kurulum başarılıdır.

Güvenlik ve Erişim Kontrolü​

ElasticSearch asla internete açık olarak çalıştırılmamalıdır. /etc/elasticsearch/elasticsearch.yml dosyasında network.host: 127.0.0.1 olarak ayarlayın; XenForo aynı sunucuda barındırılıyorsa localhost yeterlidir. Farklı sunucudaysa SSH tüneli veya VPN üzerinden erişin.

JVM heap boyutunu sunucu RAM'inin yarısına ayarlayın (/etc/elasticsearch/jvm.options.d/heap.options içinde -Xms2g / -Xmx2g). Çok yüksek değerler garbage collector duraklamalarına neden olur.

XenForo Tarafında Bağlantı​

XenForo Admin > Add-ons menüsünden Enhanced Search eklentisini kurun. Ardından Setup > Options > Enhanced Search altında host, port, kullanıcı adı, şifre ve SSL sertifika parmak izini girin. "Test connection" butonu ile bağlantıyı doğrulayın, sonrasında Tools > Rebuild caches > Rebuild search index adımıyla mevcut tüm konuları yeniden indeksleyin.

Sık Karşılaşılan Sorunlar​

Bind error: 9200 portunun başka bir servis tarafından kullanılmadığından emin olun. SSL hatası: sertifika parmak izini doğru kopyaladığınızdan emin olun. Bellek hatası: vm.max_map_count=262144 kernel parametresini /etc/sysctl.conf dosyasına ekleyin.

AIOR Hosting paketlerinde ElasticSearch ile çalışan XenForo siteleri için VPS ve özel sunucu çözümlerimiz mevcuttur; kurulum desteğini de paket içinde sunuyoruz.


Why ElasticSearch Matters for XenForo​

XenForo's built-in MySQL-based search is sufficient for small communities, but once you grow into the tens of thousands of threads and hundreds of thousands of posts, relevance, latency and server load all suffer. With the XenForo Enhanced Search add-on backed by ElasticSearch, you get sentence-level relevance and millisecond-class results — even on massive forums.

This guide walks through a practical AlmaLinux 8/9 installation of ElasticSearch 8.x. The procedure is the same one we use on our own AIOR community forum.

Prerequisites​

ElasticSearch runs on the JVM and needs at least 2 GB of RAM, with 4 GB recommended for production. Connect to your server as root over SSH:

Code:
ssh root@your-server-ip

Update system packages and remove any stale ElasticSearch installs:

Code:
sudo dnf update -y
sudo dnf clean all
sudo dnf remove elasticsearch -y

Adding the Repository​

Import Elastic.co's official GPG key and create the yum repo file:

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

cat > /etc/yum.repos.d/elasticsearch.repo <<EOF
[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=0
autorefresh=1
type=rpm-md
EOF

Install and First Run​

Enable the repo and install ElasticSearch:

Code:
sudo dnf install --enablerepo=elasticsearch elasticsearch -y

When the installer finishes it prints the generated elastic superuser password, the enrolment token and the HTTP certificate fingerprint. Note all three — you will need them shortly when connecting XenForo.

Start the service and enable it on boot:

Code:
sudo systemctl daemon-reload
sudo systemctl enable --now elasticsearch

Verify the service is healthy:

Code:
curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200

A JSON cluster info response means the install succeeded.

Security and Access​

ElasticSearch must never be exposed to the public internet. In /etc/elasticsearch/elasticsearch.yml set network.host: 127.0.0.1; if XenForo lives on the same server, localhost is enough. For a separate server, tunnel over SSH or VPN.

Set the JVM heap to roughly half of physical RAM via /etc/elasticsearch/jvm.options.d/heap.options (-Xms2g / -Xmx2g). Going too high triggers long garbage-collector pauses that hurt search latency.

Connecting From XenForo​

Install the Enhanced Search add-on in XenForo Admin > Add-ons. Then go to Setup > Options > Enhanced Search and supply host, port, username, password and the SSL certificate fingerprint. Hit "Test connection" to confirm, then run Tools > Rebuild caches > Rebuild search index to reindex existing content.

Common Pitfalls​

Port bind error: make sure nothing else listens on 9200. SSL error: re-copy the certificate fingerprint carefully. Memory error on startup: add vm.max_map_count=262144 to /etc/sysctl.conf (kernel mapping limit).

For XenForo communities backed by ElasticSearch, AIOR Hosting offers VPS and dedicated server plans with installation support included.
 
Thread owner
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.webp


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.webp

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.webp

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.webp


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.webp

Enjoy your Elastic Search

Please write for any question.
 
Thread owner
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!
 

Forum statistics

Threads
891
Messages
898
Members
27
Latest member
AIORAli

Members online

No members online now.

Featured content

AIOR
AIOR TEKNOLOJİ

Tüm ihtiyaçlarınız için Teklif alın

Hosting · Domain · Sunucu · Tasarım · Yazılım · Mühendislik · Sektörel Çözümler

Teklif al

7/24 Destek · Anında yanıt

Back
Top