This guide helped me a lot:

https://techviewleo.com/install-elastic-stack-elk-8-on-ubuntu/

After first installing with this parameter:

export ES_SKIP_SET_KERNEL_PARAMETERS=true && apt-get install elasticsearch

I then used the linked guide.

Important parts:

sudo vim /etc/elasticsearch/elasticsearch.yml

Edit the file as below:

cluster.name: my-application
node.name: node-1
#network.host: 192.168.205.11

# --------------------------------------------------------------------------------

# Enable security features
xpack.security.enabled: false

xpack.security.enrollment.enabled: false

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: false
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: false

Also, edit the JVM options to set the memory limits:

$ sudo vi /etc/elasticsearch/jvm.options
-Xms1g
-Xmx1g

By karlo