WPSolr logo
Search
Close this search box.

Table of contents :

How To Install Elasticsearch & Kibana on Ubuntu 18.04/16.04 & Debian 9/8

wpsolr-header-solr-elasticsearch-5

Table of contents :

Introduction

Elasticsearch and Kibana are powerful tools for data indexing, searching, and visualization. Elasticsearch is a distributed, RESTful search engine that can handle large volumes of data, while Kibana is a web-based visualization platform for Elasticsearch. In this guide, we will show you how to install Elasticsearch and Kibana on Ubuntu 18.04/16.04 and Debian 9/8. We will also provide some code samples for using Elasticsearch with PHP clients.

Installing Elasticsearch and Kibana

Step 1: Install Java
Elasticsearch and Kibana require Java to be installed on the system. To check if Java is already installed on your system, run the following command:


java -version

If Java is not installed, you can install it by running the following command:


sudo apt-get update
sudo apt-get install default-jre

Step 2: Install Elasticsearch
To install Elasticsearch on Ubuntu 18.04/16.04 and Debian 9/8, follow these steps:

1. Import the Elasticsearch PGP key:


wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

2. Add the Elasticsearch repository:


echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list

3. Update the package list:


sudo apt-get update

4. Install Elasticsearch:


sudo apt-get install elasticsearch

5. Start and enable Elasticsearch:


sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch

Step 3: Install Kibana
To install Kibana on Ubuntu 18.04/16.04 and Debian 9/8, follow these steps:

1. Add the Kibana repository:


echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list

2. Update the package list:


sudo apt-get update

3. Install Kibana:


sudo apt-get install kibana

4. Start and enable Kibana:


sudo systemctl start kibana
sudo systemctl enable kibana

Using Elasticsearch with PHP Clients

Here’s an example of using Elasticsearch with the PHP client:


require 'vendor/autoload.php';

$client = Elasticsearch\ClientBuilder::create()->build();
$params = [
 'index' => 'my_index',
 'type' => 'my_type',
 'id' => 'my_id',
 'body' => ['testField' => 'abc']
];

$response = $client->index($params);
print_r($response);

How WPSOLR Can Help

If you’re using WordPress and want to integrate Elasticsearch into your site’s search engine, consider using WPSOLR. WPSOLR is a WordPress plugin that allows you to use Elasticsearch as the search backend. It comes with a powerful search engine customization tool and supports custom post types and taxonomies. With WPSOLR, you can take advantage of Elasticsearch’s powerful search capabilities and improve your WordPress site’s search functionality.

Conclusion

In this guide, we’ve shown you how to install Elasticsearch and Kibana on Ubuntu 18.04/16.04 and Debian 9/8. We’ve also provided some code samples for using Elasticsearch with PHP clients. If you’re using WordPress, consider using WPSOLR to integrate Elasticsearch into your site’s search engine. By using Elasticsearch and Kibana, you can improve your data indexing, searching, and visualization capabilities.

Related posts ... not powered by WPSOLR 😊