Atlantic.Net Blog

How to Install Elasticsearch Ubuntu 20.04 and CentOS 8

Hitesh Jethva
by Atlantic.Net (191posts) under Dedicated Server Hosting
0 Comments

Prerequisites

  • A fresh Ubuntu 20.04 and CentOS 8 VPS on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Ubuntu 20.04 and CentOS 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your Ubuntu 20.04 server, run the following command to update your base system with the latest available packages.

apt-get update -y

You can also update your CentOS 8 system with the following command:

dnf update -y

Elasticsearch is an open-source, distributed search engine that allows you to store and analyze a large amount of data. It is specially designed for complex search requirements. It uses a simple set of APIs that provide the ability for full-text search. Elasticsearch is the best choice for you if you are looking to search a large, complex dataset.

In this tutorial, we will show you how to install Elasticsearch on Ubuntu 20.04 and CentOS 8.

Install Elasticsearch on Ubuntu 20.04

In this section, we will show you how to install Elasticsearch on Ubuntu 20.04.

First, you will need to install all the required dependencies to your server. You can install them with the following command:

apt-get install apt-transport-https ca-certificates gnupg2 curl -y

Once all the dependencies are installed, add the Elasticsearch GPG key with the following command:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -

Next, add the Elasticsearch repository to APT with the following command:

sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > 
/etc/apt/sources.list.d/elastic-7.x.list'

Once the repository is added, update the repository and install Elasticsearch with the following command:

apt-get update -y
apt-get install elasticsearch -y

Once the installation is completed, start Elasticsearch and enable it to start at system reboot:

systemctl start elasticsearch
systemctl enable elasticsearch

You can now verify Elasticsearch with the following command:

curl -X GET "localhost:9200/"

You should get the following output:

{
"name" : "ubuntu2004",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "PKpCl7VJT6G8q8SxR7m6DQ",
"version" : {
"number" : "7.10.1",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "1c34507e66d7db1211f66f3513706fdf548736aa",
"build_date" : "2020-12-05T01:00:33.671820Z",
"build_snapshot" : false,
"lucene_version" : "8.7.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}

Install Elasticsearch on CentOS 8

In this section, we will show you how to install Elasticsearch on CentOS 8.

First, install Java and other required dependencies with the following command:

dnf install java-11-openjdk-devel curl

Once the installation is completed, verify the Java version with the following command:

java -version

You should get the following output:

openjdk version "11.0.9.1" 2020-11-04 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.9.1+1-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.9.1+1-LTS, mixed mode, sharing)

Next, import the Elasticsearch GPG key with the following command:

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Next, create a repo file for Elasticsearch with the following command:

nano /etc/yum.repos.d/elasticsearch.repo

Add the following lines:

[elasticsearch-7.x]

name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

Save and close the file, then install Elasticsearch with the following command:

dnf install elasticsearch -y

Once the installation is completed, start the Elasticsearch service and enable it to start at system reboot with the following command:

systemctl start elasticsearch
systemctl enable elasticsearch

You can now verify the status of the Elasticsearch service with the following command:

systemctl status elasticsearch

You should get the following output:

  • elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2021-01-11 03:04:19 EST; 8s ago
Docs: https://www.elastic.co
Main PID: 1801 (java)
Tasks: 65 (limit: 12523)
Memory: 1.2G
CGroup: /system.slice/elasticsearch.service
├─1801 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 
-Des.networkaddress.cache.negative.ttl=1>
└─1986 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

Jan 11 03:03:50 centos8 systemd[1]: Starting Elasticsearch...
Jan 11 03:04:19 centos8 systemd[1]: Started Elasticsearch.

Next, run the following command to verify Elasticsearch:

curl -X GET "localhost:9200/"

You should see the following output:

{
"name" : "centos8",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "vFz_YYRvTAWC3AiaMP_ORA",
"version" : {
"number" : "7.10.1",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "1c34507e66d7db1211f66f3513706fdf548736aa",
"build_date" : "2020-12-05T01:00:33.671820Z",
"build_snapshot" : false,
"lucene_version" : "8.7.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}

Conclusion

In the above guide, you learned how to install Elasticsearch on Ubuntu 20.04 and CentOS 8. You can now use Elasticsearch with your e-commerce store application on your dedicated server hosting plan from Atlantic.Net!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources