echo \"deb [signed-by=\/usr\/share\/keyrings\/elastic.gpg] https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/elastic-7.x.list<\/pre>\nAfter adding them, your command line should look like this.<\/p>\n
root@host:~# curl -fsSL https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo gpg --dearmor -o \/usr\/share\/keyrings\/elastic.gpg\r\nroot@host:~# echo \"deb [signed-by=\/usr\/share\/keyrings\/elastic.gpg] https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/elastic-7.x.list\r\ndeb [signed-by=\/usr\/share\/keyrings\/elastic.gpg] https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\r\nroot@host:~#\r\n<\/pre>\nNow, update the system and install the elastic search with the following commands:<\/p>\n
sudo apt update -y\r\n\r\nsudo apt install elasticsearch\r\n\r\n<\/pre>\nOnce the installation is completed, start and enable the elasticsearch service.<\/p>\n
sudo systemctl start elasticsearch && sudo systemctl enable elasticsearch<\/pre>\nAfter starting and enabling the service, you should receive the following output:<\/p>\n
Synchronizing state of elasticsearch.service with SysV service script with \/lib\/systemd\/systemd-sysv-install.\r\nExecuting: \/lib\/systemd\/systemd-sysv-install enable elasticsearch\r\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/elasticsearch.service \u2192 \/lib\/systemd\/system\/elasticsearch.service.\r\n<\/pre>\nTo check the status of the service, if it is up and running, execute the following command:<\/p>\n
sudo systemctl status elasticsearch<\/pre>\nYou should receive the following output:<\/p>\n
root@host:~# sudo systemctl status elasticsearch\r\n\u25cf elasticsearch.service - Elasticsearch\r\n Loaded: loaded (\/lib\/systemd\/system\/elasticsearch.service; enabled; vendor preset: enabled)\r\n Active: active (running) since Tue 2022-09-20 18:59:08 CEST; 2min 6s ago\r\n Docs: https:\/\/www.elastic.co\r\n Main PID: 115284 (java)\r\n Tasks: 70 (limit: 4575)\r\n Memory: 2.3G\r\n CPU: 1min 42.632s\r\n CGroup: \/system.slice\/elasticsearch.service\r\n \u251c\u2500115284 \/usr\/share\/elasticsearch\/jdk\/bin\/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch>\r\n \u2514\u2500115476 \/usr\/share\/elasticsearch\/modules\/x-pack-ml\/platform\/linux-x86_64\/bin\/controller\r\n\r\nSep 20 18:58:26 host.test.vps systemd[1]: Starting Elasticsearch...\r\nSep 20 18:59:08 host.test.vps systemd[1]: Started Elasticsearch.\r\n<\/pre>\n