Turn on security and bind Elasticsearch to a routable IP address, not localhost, so you could add
other machines to the cluster:
sudo vim /etc/elasticsearch/elasticsearch.yml
add:
xpack.security.enabled: true
network.host: 172.31.46.15
Assuming you are logged in as user ubuntu (or change the name to your userid), change all folder
permissions to ubuntu. This step is not logical, since you can't run Elasticsearch as root. So, this
patches up a step left out of their .deb file.
sudo chown -R ubuntu /usr/share/elasticsearch
sudo chown -R ubuntu /var/log/elasticsearch/
sudo chown -R ubuntu /var/lib/elasticsearch/
sudo chown -R ubuntu /etc/elasticsearch
sudo chown ubuntu /etc/default/elasticsearch
Start Elasticsearch. If you cannot start it as a service, because it throws an error, you can start it this
way. Note: you cannot run it as root.
cd /usr/share/elasticsearch/bin
nohup ./elasticsearch&
Run this command to generate passwords for Elasticsearch; save these passwords somewhere.
./elasticsearch-setup-passwords auto
Initiating the setup of passwords for reserved users
elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user
.
The passwords will be randomly generated and printed to the console.
Please confirm that you would like to continue y
Changed password for user apm_system
PASSWORD apm_system =XXXXXXXXX
Changed password for user kibana
PASSWORD kibana =XXXXXXXXX
Changed password for user logstash_system
PASSWORD logstash_system = XXXXXXXX
Changed password for user beats_system