How to Install Elasticsearch on CentOS 8
Ready for faster more powerful WordPress search?
sudo dnf install java-11-openjdk-devel
java -version
openjdk version "11.0.5" 2019-10-15 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.5+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode, sharing)
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
sudo nano /etc/yum.repos.d/elasticsearch.repo
[elasticsearch]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md
(optional) enable=1
sudo dnf install --enablerepo=elasticsearch elasticsearch
dnf update
systemctl daemon-reload
sudo systemctl start elasticsearch.service
If elasticsearch service does not start, check the logs at /var/log/elasticsearch/elasticsearch.log.
Also see Troubleshooting section below. Otherwise reboot your webserver.
sudo systemctl enable elasticsearch.service
Memory Usage Settings
/etc/elasticsearch/jvm.options
Troubleshoot
If elasticsearch service does not start, check the logs at /var/log/elasticsearch/elasticsearch.log.
When using No Exec /tmp dir:
Error like this or access denied:
unable to load JNA native support library, native methods will be disabled
- Go to
/etc/sysconfig/elasticsearch
- Add
ES_JAVA_OPTS="-Djna.tmpdir=/var/lib/elasticsearch/tmp"
.(For newer Elasticsearch, useDjava.io.tmpdir
instead ofDjna.tmpdir
) - Start Elasticsearch using
systemctl start elasticsearch
orservice start elasticsearch
. - You can see now
tmp
folder created inside/var/lib/elasticsearch/
. - This folder should have execute permission for
elasticsearch
user - Check the permission with name
i -l /var/lib/elasticsearch
If you had an old ElasticSearch sitting around:
Error:
Failed to obtain node lock, is the following location writable
If you had an old ElasticSearch sitting around like I did, you can start by either trying to delete a specific node.lock
file or go nuclear and rm -rf
the nodes
folder.
ElasticPress plugin for WordPress
Elasticsearch Host URL: http://127.0.0.1:9200