{"id":129,"date":"2023-07-31T15:52:05","date_gmt":"2023-07-31T15:52:05","guid":{"rendered":"http:\/\/192.168.0.142\/?p=129"},"modified":"2023-08-03T05:06:28","modified_gmt":"2023-08-03T05:06:28","slug":"installation-of-elastic-search-and-kibana-on-ubuntu-22-04","status":"publish","type":"post","link":"http:\/\/192.168.0.142\/installation-of-elastic-search-and-kibana-on-ubuntu-22-04\/","title":{"rendered":"Elasticsearch and Kibana installation on Ubuntu 22.04"},"content":{"rendered":"\n
Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.
As the heart of the Elastic Stack, it centrally stores your data for lightning fast search, fine\u2011tuned relevancy, and powerful analytics that scale with ease.<\/p>\n\n\n\n
This post will guide you through installation and configuration of Elasticsearch and Kibana.<\/p>\n\n\n\n
Update package index files<\/strong><\/p>\n\n\n\n Install dependencies<\/strong><\/p>\n\n\n\n Import the Elasticsearch PGP Key<\/strong><\/p>\n\n\n\n Add the Elastic source list to the sources.list.d directory, where apt will search for new sources:<\/strong><\/p>\n\n\n\n Install elasticsearch<\/strong><\/p>\n\n\n\n Enable Elasticsearch service<\/strong><\/p>\n\n\n\n Elasticsearch can be started as follows<\/strong><\/p>\n\n\n\n To stop Elasticsearch run below command<\/strong><\/p>\n\n\n\n To list journal entries for the Elasticsearch service run below command<\/strong><\/p>\n\n\n\n You should see similar output as below in the console<\/strong><\/p>\n\n\n\n To reset password of Elasticsearch run below command<\/strong><\/p>\n\n\n\n You should see output similar to below in the console<\/strong><\/p>\n\n\n\n To Check Elasticsearch is up and running run below command<\/strong><\/p>\n\n\n\n You should see output similar to below after entering the password<\/strong><\/p>\n\n\n\n Install kibana by running below command<\/strong><\/p>\n\n\n\n Make below changes in \/etc\/elasticsearch\/elasticsearch.yml to allow connection from kibana. Edit the file and uncomment\/edit lines.<\/p>\n\n\n\n Restart Elasticsearch service<\/strong><\/p>\n\n\n\n Make below changes in \/etc\/kibana\/kibana.yml to configure kibana.<\/p>\n\n\n\n For e.g., <\/strong><\/p>\n\n\n\n Restart kibana<\/strong><\/p>\n\n\n\n Access host ip:5601 (for e.g http:\/\/192.168.0.183:5601\/) in a browser to configure Kibana with Elasticsearch. <\/strong><\/p>\n\n\n\n Run below command to generate enrollment token<\/strong><\/p>\n\n\n\n Reference output<\/strong><\/p>\n\n\n\n Enter enrollment token in textbox and click on ‘Configure Elastic’ button<\/strong><\/p>\n\n\n\n Next step is to verify using another token<\/strong><\/p>\n\n\n\n To generate verification token<\/strong><\/p>\n\n\n\n Reference output<\/strong><\/p>\n\n\n\n Enter verification code and click on ‘Verify’<\/strong><\/p>\n\n\n\n You should see below page <\/strong><\/p>\n\n\n\n Refresh the page if installation stuck at ‘Completing setup’ step. After setup is completed successfully login page is displayed.<\/strong><\/p>\n\n\n\n Enter the credentials. Username is elastic.<\/strong><\/p>\n\n\n\n Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.As the heart of the Elastic Stack, it centrally stores your data for lightning fast search, fine\u2011tuned relevancy, and powerful analytics that scale with ease. This post will guide … Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":284,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[22,23,12],"_links":{"self":[{"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/posts\/129"}],"collection":[{"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/comments?post=129"}],"version-history":[{"count":38,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/posts\/129\/revisions"}],"predecessor-version":[{"id":346,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/posts\/129\/revisions\/346"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/media\/284"}],"wp:attachment":[{"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/media?parent=129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/categories?post=129"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/192.168.0.142\/wp-json\/wp\/v2\/tags?post=129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}sudo apt update<\/code><\/pre>\n\n\n\n
sudo apt-get install apt-transport-https<\/code><\/pre>\n\n\n\n
wget -qO - https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo gpg --dearmor -o \/usr\/share\/keyrings\/elasticsearch-keyring.gpg<\/code><\/pre>\n\n\n\n
echo \"deb [signed-by=\/usr\/share\/keyrings\/elasticsearch-keyring.gpg] https:\/\/artifacts.elastic.co\/packages\/8.x\/apt stable main\" | sudo tee \/etc\/apt\/sources.list.d\/elastic-8.x.list<\/code><\/pre>\n\n\n\n
Elasticsearch Installation<\/h3>\n\n\n\n
sudo apt update && sudo apt install elasticsearch<\/code><\/pre>\n\n\n\n
sudo systemctl daemon-reload\nsudo systemctl enable elasticsearch.service<\/code><\/pre>\n\n\n\n
sudo systemctl start elasticsearch.service<\/code><\/pre>\n\n\n\n
sudo systemctl stop elasticsearch.service<\/code><\/pre>\n\n\n\n
journalctl --unit elasticsearch<\/code><\/pre>\n\n\n\n
$ journalctl --unit elasticsearch\nAug 01 11:34:36 abb systemd[1]: Starting Elasticsearch...\nAug 01 11:34:49 abb systemd[1]: Started Elasticsearch.<\/code><\/pre>\n\n\n\n
sudo \/usr\/share\/elasticsearch\/bin\/elasticsearch-reset-password -u elastic<\/code><\/pre>\n\n\n\n
$ sudo \/usr\/share\/elasticsearch\/bin\/elasticsearch-reset-password -u elastic\nThis tool will reset the password of the [elastic] user to an autogenerated value.\nThe password will be printed in the console.\nPlease confirm that you would like to continue [y\/N]y\n\n\nPassword for the [elastic] user successfully reset.\nNew value: D5SQMkZ*I_m5qCVAFHQE<\/code><\/pre>\n\n\n\n
curl -k -u elastic https:\/\/localhost:9200<\/code><\/pre>\n\n\n\n
$ curl -k -u elastic https:\/\/localhost:9200\nEnter host password for user 'elastic':\n{\n \"name\" : \"abb\",\n \"cluster_name\" : \"elasticsearch\",\n \"cluster_uuid\" : \"bD_SCK32SYinR79L6SbagQ\",\n \"version\" : {\n \"number\" : \"8.8.2\",\n \"build_flavor\" : \"default\",\n \"build_type\" : \"deb\",\n \"build_hash\" : \"98e1271edf932a480e4262a471281f1ee295ce6b\",\n \"build_date\" : \"2023-06-26T05:16:16.196344851Z\",\n \"build_snapshot\" : false,\n \"lucene_version\" : \"9.6.0\",\n \"minimum_wire_compatibility_version\" : \"7.17.0\",\n \"minimum_index_compatibility_version\" : \"7.0.0\"\n },\n \"tagline\" : \"You Know, for Search\"\n}<\/code><\/pre>\n\n\n\n
Kibana Installation<\/h3>\n\n\n\n
sudo apt install kibana<\/code><\/pre>\n\n\n\n
http.port: 9200\nnetwork.host: 0.0.0.0<\/code><\/pre>\n\n\n\n
sudo systemctl restart elasticsearch<\/code><\/pre>\n\n\n\n
server.port: 5601\nserver.host: \"X.X.X.X\" (Kibana server's IP address)<\/code><\/pre>\n\n\n\n
server.port: 5601\nserver.host: \"192.168.0.183\"<\/code><\/pre>\n\n\n\n
sudo systemctl restart kibana.service <\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
sudo \/usr\/share\/elasticsearch\/bin\/elasticsearch-create-enrollment-token -s kibana<\/code><\/pre>\n\n\n\n
ability@abb:~$ sudo \/usr\/share\/elasticsearch\/bin\/elasticsearch-create-enrollment-token -s kibana\neyJ2ZXIiOiI4LjkuMCIsImFkciI6WyIxOTIuMTY4LjAuMTgzOjkyMDAiXSwiZmdyIjoiZTc1ZDEwYTllNDA2NDg5YWQxNzdhM2VkMzE1NGM3ZmRkOTMwYTIxYjM5OTY3NDkxYzI1MzY4Yjc3MDBiM2E5OCIsImtleSI6IjJmcnNzSWtCeHBiSklOaEtKQkJEOld1Qnlyb1FtVDE2VU9sZjlPRUJkN2cifQ==<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
sudo \/usr\/share\/kibana\/bin\/kibana-verification-code <\/code><\/pre>\n\n\n\n
$ sudo \/usr\/share\/kibana\/bin\/kibana-verification-code \nYour verification code is: 571 272 <\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n","protected":false},"excerpt":{"rendered":"