How to Install and Configure Elasticsearch in Ubuntu?
In this tutorials we have learn how to configer a Elastic search in our local system.
follow this step and easily configer an Elastic Search.
1) Step 1 — Installing Java :
-Before installing OpenJDK with APT, update the list of available packages for installation on your Ubuntu Droplet by running the command:
$ sudo apt-get update
-After that, you can install OpenJDK with the command:
$ sudo apt-get install openjdk-7-jre
-To verify your JRE is installed and can be used, run the command:
$ java -version
2) Step 2 — Downloading and Installing Elasticsearch :
$ wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.2.deb
-Then install it in the usual Ubuntu way with the dpkg command like this:
$ sudo dpkg -i elasticsearch-1.7.2.deb
-To make sure Elasticsearch starts and stops automatically with the Droplet, add its init script to the default runlevels with the command:
$ sudo update-rc.d elasticsearch defaults
Step 3 — Configuring Elastic :
-To start editing the main elasticsearch.yml configuration file:
$ sudo nano /etc/elasticsearch/elasticsearch.yml
-Remove the # character at the beginning of the lines for node.name and cluster.name to uncomment them, and then change their values.
node.name: "My First Node"
cluster.name: mycluster1
-Once you make all the changes, please save and exit the file. Now you can start Elasticsearch for the first time with the command:
$ sudo service elasticsearch start
Step 4 — Securing Elastic :
-Elasticsearch has no built-in security and can be controlled by anyone who can access the HTTP API. So, the first security tweak is to prevent public access. To remove public access edit the file elasticsearch.yml:
$ sudo nano /etc/elasticsearch/elasticsearch.yml
-Find the line that contains network.bind_host, uncomment it by removing the # character at the beginning of the line, and change the value to localhost so it looks like this:
network.bind_host: localhost
-To disable custom expressions, add the following line is at the end of the /etc/elasticsearch/elasticsearch.yml file:
script.disable_dynamic: true
Step 5 — Testing :
$ curl -X GET 'http://localhost:9200' or run http://localhost:9200 in any browser.
You should see the following response:
{
"status" : 200,
"name" : "Harry Leland",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.7.2",
"build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
"build_timestamp" : "2015-09-14T09:49:53Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Upgrade PHP Version from 8.0 to 8.1 in Ubuntu?
- How to Restrict/Block IP Address in Apache Ubuntu?
- How to Install Laravel in Ubuntu Server?
- How to Set Up Password Authentication with Apache in Ubuntu?
- How to Change PHP Version in Ubuntu Server?
- How to Install Phpmyadmin in Ubuntu Server?
- How to Install MySQL in Ubuntu Server?
- How to Install PHP in Ubuntu Server?
- How to Connect to a Remote Server using SSH on Ubuntu?
- How to Upgrade PHP Version from 7.4 to 8 in Ubuntu?
- How to Export Mysql Database using Command Line in Ubuntu?
- How to Import Database in Mysql using Command Line in Ubuntu?
- How to Install Laravel in Ubuntu?
- How to Downgrade php 7.4 to 7.3 Ubuntu?