This tutorial will help you to install Elasticsearch on Ubuntu 20.04 LTS system.

Prerequisites

Login to your Ubuntu system using sudo privileges. For the remote Ubuntu server using ssh to access it. Windows users can use putty or alternatives to log in to Ubuntu system.

Step 1 – Install Java

Elasticsearch required Java run time installed on system. Ubuntu 20.04 system users, can run the following commands to install Java (OpenJDK 11): After installation, check the Java version on your system: Also, make sure the JAVA_HOME environment variable is configured:

Step 2 – Install Elasticsearch on Ubuntu 20.04

The Elasticsearch official team provides an apt repository to install Elasticsearch on Ubuntu Linux system. After install below package and import GPG key for Elasticsearch packages. Then configure the apt repository on your Debian system. The below command will add a repository to install latest Elasticsearch 6.X on your Ubuntu system. After adding the repository to your system. Run the following commands to update cache and then install Elasticsearch packages on your system. The above commands will install Elasticsearch including all the required dependencies on your system.

Step 3 – Configure Elasticsearch

The Elasticsearch has been installed on your system. You can customize this by editing the Elasticsearch configuration file. Edit configuration file in your favorite text editor: Then update the below basic configurations:

network.host – Set the network host to 0.0.0.0 to listen on all interfaces and make it available publicly. You can use your LAN address for LAN access only. network.host: 0.0.0.0 cluster.name – Name of the cluster. For the multi-node cluster, all the nodes must use the same cluster name. cluster.name: myCluster1 node.name – Set the unique name of the node to identify in a cluster. node.name: “myNode1”

Save your file and close it.

Step 4 – Manage Elasticsearch Service

Next, you need to enable Elasticsearch to start automatically on system boot. Also start service for the first time by running the following commands: You can use below commands to stop or restart Elasticsearch service from command line:

Step 5 – Connect to Elasticsearch

The Elasticsearch service is ready to use. You can test it using curl command-line utility. Run the simple GET command using curl to verify the setup. You will see the Elasticsearch cluster details with the version on your screen. The above output shows the specifications of your elasticsearch server. You can create a new bucket to your elasticsearch server by running the following command. Change mybucket with your bucket name: Output:

Conclusion

In this tutorial, you have learned how to install Elasticsearch on Ubuntu 20.04 LTS system. Also, helps you to do basic configuration of Elasticsearch server.