How to install Elasticsearch
Elasticsearch is an incredibly powerful search engine in which data can be stored and recalled in real-time. Because of the speed and reliability of Elasticsearch, it is highly recommended if you are searching through large amounts of data on a regular basis. Thanks to projects like ElasticPress, it can also be used easily within WordPress as a replacement for the default search. In this article, we will show you how to install Elasticsearch on InMotion Hosting or any other CentOS/Red Hat based system.
Note: You will need to have a VPS or dedicated server with root access to be able to install Elasticsearch.
Installing Elasticsearch from the repository
The easiest way to install Elasticsearch is from their repositories. Doing so is not only simple to install, but will also allow you to easily keep Elasticsearch updated.
First, SSH into your server as root.
Now, as Elasticsearch depends on Java to run, we will need to begin installing Java on the server. To do so, first begin by updating the repositories:
Now, install Java:
yum install java
If all goes well, Java should now be installed on the server and you are ready to begin installing Elasticsearch.
Next, we will add the Elasticsearch repository to the server. Begin by adding the public signing key:
rpm --import https://packages.elasticsearch.org/GPG-KEY-elasticsearch
Now, we need to add the actual repository. Use the following to open a text editor and create a new file holding the Elasticsearch repository:
Within the text editor, paste in the following:
name=Elasticsearch repository for 1.4.x packages
Once entered, press Ctrl+X and then the Y key to save changes.
Not that the repository is all set up, Elasticsearch is ready to install. To do so, enter the following:
yum install elasticsearch
Elasticsearch will now be installed. Once complete, if you want it to automatically start when the system is booted, follow the next section on setting ElasticSearch as a system service.
Setting ElasticSearch as a system service
If you want Elasticsearch to automatically when the system is started, enter the following command to se it as a system service:
chkconfig --add elasticsearch.
Elasticsearch with WordPress
In addition to Elasticsearch's many use cases, individuals can easily integrate Elasticsearch with WordPress. For more information on doing so, take a look at our article on Elasticsearch in WordPress using ElasticPress.
Support Center LoginOur Login page has moved, Click the button below to be taken to the login page.
2018-03-29 10:50 am
Can this installation happen on your shared hosting packages ?! Or is it a must to have a VPS to make this work ?
2018-03-29 11:33 am
This must be performed on a VPS at least, because it requires root access. However, if you have WordPress, there are plugins like Jetpack which uses Elasticsearch in their premium version to make searching your site faster.
2016-11-23 11:27 pm
Thx for your guide, it was almost perfect in my case. What I changed was, in step 4:
name=Elasticsearch repository for 1.7.x packages
using these options:
2016-04-14 12:10 pm
Thank you for contacting. We recently tested this article successfully, and everything seems to be working.
What issues are you having with the guide?
Are getting any errors? What are they?
2016-01-06 11:40 pm
This page needs updated, the URL for the repository is now packages.elastic.co. Also, newer versions exist beyond 1.4.
2016-01-07 9:58 am
Thank you for letting us know. We'll certainly review the article and update where necessary.
2015-03-10 2:57 am
After struggling a bit, I managed to get it running. For some reasons, my webservices which are calling the elastic client, are only working inside a specific folder.
2015-03-09 11:51 pm
One of the reason I chose inmotion for my website is because it provides a tutorial for installing elasticsearch, which is present in my website. I have already followed all the steps successfully. But the service is not working on the website. I am getting the following error response on php services that creates an elastic search client :
Fatal error: Class 'Elasticsearch\Client' not found in /home/catove5/public_html/catovert/gateway/app/init.php on line 5
Can you please indicate what should be done next to get it running on the website?