1. Download x-pack of the same version as es
If it is not the same version, an error will be reported, and the page will display the main problem
The download address is as follows
Download X-Pack: Extend Elasticsearch and Kibana | Elastic
2. Transfer the downloaded installation package to the server that needs to configure the password
3. Install the xpack plugin in es
Remember that the x-pack plugin does not need to be decompressed
cd /opt/elk/elasticsearch-6.2.0
install plugin
./bin/elasticsearch-plugin install file:/opt/elk/x-pack-6.2.0.zip
Next, you will be asked to choose y halfway through.
4. Modify the configuration
Edit the config/elasticsearch.yml file
Add the following configuration to enable the password
xpack.security.enabled:true
5. Restart
Query the previously started elastic
ps -ef | grep elastic
kill process
kill -9 process number
restart elastic
Note that you need to log in to the elastic user to restart
su elastic
sh elasticsearch -d
6. Modify the default password of elastic
curl -XPUT -u elastic:changeme 'http://localhost:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "xxxxx" }'