Hero Image

Install Elasticsearch on Arch Linux

Install Elasticsearch on Arch Linux

Step 1 – Install Elasticsearch

yay -S elasticsearch --noconfirm
systemctl enable --now 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
        }
    }'