Install Elasticsearch on NetBSD 10
Step 1 – Install Elasticsearch
# Download Elasticsearch tarball from https://www.elastic.co/downloads/elasticsearch
# Then extract and run:
# tar -xzf elasticsearch-8.x.x-linux-x86_64.tar.gz
# cd elasticsearch-8.x.x
# ./bin/elasticsearch
Step 2 – Note the enrollment token and password
On first start, Elasticsearch prints:
The generated password for the elastic built-in superuser is: <password>
Save it immediately. You can also reset it:
/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
Step 3 – Verify
curl --cacert /etc/elasticsearch/certs/http_ca.crt \
-u elastic:YourPassword https://localhost:9200
Step 4 – Basic elasticsearch.yml settings
cluster.name: my-cluster
node.name: node-1
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 127.0.0.1
http.port: 9200
# Disable security for development only (NOT recommended for production)
# xpack.security.enabled: false
Step 5 – Create an index
curl -X PUT "https://localhost:9200/my-index" \
-u elastic:YourPassword \
--cacert /etc/elasticsearch/certs/http_ca.crt \
-H 'Content-Type: application/json' \
-d '{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
}
}'