Elasticsearch is a popular search engine, especially among Magento users. There are some gotchas that might cause problems that this guide attempts to address.
Step-by-step guide
- Install the Java SDK
Elasticsearch requires Java to run. This SDK can be installed directly from the epel repository.yum -y install java-1.8.0-openjdk
- Download and install the public signing key for elasticsearch:
rpm --import
http://artifacts.elastic.co/GPG-KEY-elasticsearch
- Create a repo:
Elasticsearch requires a third party repo, set it up by running:vim /etc/yum.repos.d/elasticsearch.repo
Add the following:[elasticsearch-7.x]
name=Elasticsearch repository for
7.x packages
baseurl=http://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=http://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
- Install elasticsearch:
Once the Elasticsearch repo is installed, simply yum install the package:yum install elasticsearch
- Elasticsearch requires an executable tmp directory. Some VMs are configured to mount tmp with noexec, which will cause Elasticsearch to crash on start up. The best way around this would be to simply create a new tmp directory for Elasticsearch to use. This can be done by doing the following:Create a new tmp directory:
mkdir /var/lib/elasticsearch/tmp
Then assign the correct ownership and permissions:chown elasticsearch:elasticsearch /var/lib/elasticsearch/tmp
chmod 775
/var/lib/elasticsearch/tmp
Lastly, add the ES_TMPDIR and TMPDIR line to /etc/sysconfig/elasticsearchecho "ES_TMPDIR=/var/lib/elasticsearch/tmp"
>> /etc/sysconfig/elasticsearch
echo "TMPDIR=/var/lib/elasticsearch/tmp"
>> /etc/sysconfig/elasticsearch
- Enable and start Elasticsearch
systemctl start elasticsearch
systemctl enable elasticsearch