Unable to load JNA native support library Elasticsearch 6.x

  1. Go to /etc/sysconfig/elasticsearch
  2. Add ES_JAVA_OPTS="-Djna.tmpdir=/var/lib/elasticsearch/tmp".

    (For newer Elasticsearch, use Djava.io.tmpdir instead of Djna.tmpdir)

  3. Start Elasticsearch using systemctl start elasticsearch or service start elasticsearch.
  4. You can see now tmp folder created inside /var/lib/elasticsearch/.
  5. This folder should have execute permission for elasticsearch user
  6. Check the permission with name i -l /var/lib/elasticsearch
  7. Make sure the permission file have something like below permission

    dr-xr-xr-x root          root          /
    drwxr-xr-x root          root          var
    drwxr-xr-x root          root          lib
    drwxr-x--- elasticsearch elasticsearch elasticsearch
    

I hope your issue will be resolved.


I had the same issue on a CentOS7 cPanel server with ElasticSearch 7.8 installed via YUM. As per the answer, I did the following:

  1. Set ES_JAVA_OPTS="-Djna.tmpdir=/var/lib/elasticsearch/tmp" in /etc/sysconfig/elasticsearch
  2. mkdir -p /var/lib/elasticsearch/tmp
  3. chown -R elasticsearch.elasticsearch /var/lib/elasticsearch/tmp