1. Requirements
Ubuntu 20.04 or 22.04 server
4GB RAM and 2 CPUs
A non-root sudo user
OpenJDK 11
2. APT Update & Install OpenJDK
Before going further to know the steps for setting up Elastic search, let’s update our system and install Java required to follow this tutorial.sudo apt update && sudo apt upgradesudo apt install default-jdk
3. Add Elastic Search GPG key and Repository
Note: If you already have ElasticSearch installed server then you can directly plunge to step 6 of this article but don’t forget to add the Elastic repo.
Well, the packages to install Elastic Search are not available to install on Ubuntu 22.04/20.04 using the default system repository. Hence, we have to add the one offered by the Elastic developers for Debian-based systems.
First, add the GPG key:
sudo apt-get install apt-transport-httpswget -qO – https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg –dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
Add Repository
Next, we will add the repository, the current stable version is 7. x whereas the current development one is 8.x. we have given both the repository here, add the one as per your choice,
For Version 7.xecho “deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main” | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
For Version 8.x echo “deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x-prerelease/apt stable main” | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
Run system update
Again refresh the system and let it know what are packages available through the newly added repository.sudo apt update
4. Install ElasticSearch on Ubuntu 22.04 | 20.04 Linux
Once you have added the repository, we can simply use the APT package manager command to install the latest available version of ElasticSearch on Ubuntu 20.04 or 22.04 Server using the command given below.sudo apt install elasticsearch
5. Start ElasticSearch Services
ElasticSearch services will not start automatically on the system, we have to do that manually. Whereas, to start the service automatically with system boot or in case of a service crash, we have to enable it as well.
Reload Daemon:sudo systemctl daemon-reload
Enablesudo systemctl enable elasticsearch
Startsudo systemctl start elasticsearch
Check Status sudo systemctl status elasticsearch
Note– In the future to stop the same service you can use this:sudo systemctl stop elasticsearch
Verify Elasticsearch is working properly
Now everything is up and running on your system for ElasticSearch, it’s time to check whether it is working fine or not. So, to test it we use CURL.sudo apt-get install curl
Now test the Elasticsearch by sending an HTTP request with port number 9200curl -X GET “localhost:9200/”
6. Install Kibana Dashboard on Ubuntu 22.04 | 20.04
For installing and configuring Kibana Dashboard, we don’t need to add any other repository because the packages are available through the already added ElasticSearch. Hence, just use the given command:sudo apt install kibana
7. Enable and start the Kibana service
Now, we have the Kibana Dashboard installed on our Ubuntu 22.04 or 20.04, let’s start and enable its services just like we did for Elastic search.
Reload daemonsudo systemctl daemon-reload
Start and Enable:sudo systemctl enable kibana sudo systemctl start kibana
To check the status:sudo systemctl status kibana
8. Access the Kibana Dashboard web interface
Let’s access the Kibana Dashboard’s web interface to start monitoring and analyzing data generated by Elastic Search visually. For that open your system browser and point to localhost with port number 5601.http://localhost:5601
To Check system Status, use:
http://localhost:5601/status