Elasticsearch is a widely used open-source text search and analytics engine known for its powerful features, high scalability, and ease of use, providing advanced search technology for various applications. This guide outlines the steps to install Elasticsearch on a CentOS 7 cloud server.
Begin by updating the system to the latest state and rebooting.
sudo yum update
sudo reboot
Elasticsearch requires a Java environment to function properly. Therefore, we will install the OpenJDK 1.8.0 environment below.
sudo yum install java-1.8.0-openjdk.x86_64
Check the Java version to verify successful installation.
java -version
Import Elasticsearch's GPG key.
sudo rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
Create Elasticsearch's repository file.
sudo vi /etc/yum.repos.d/elasticsearch.repo
Copy the provided code into the repository file.
[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=https://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
It is now time to proceed with the actual Elasticsearch installation.
sudo yum install elasticsearch
Start Elasticsearch and set it to launch with the system.
sudo systemctl start elasticsearch.service
sudo systemctl enable elasticsearch.service
After installation, use the curl command to test if Elasticsearch was installed successfully.
curl http://localhost:9200/
In a normal scenario, JSON documents similar to the following types will be outputted.
{
"name" : "Legion",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "2.3.2",
"build_hash" : "b9e4a6acad4008027e4038f6abed7f7dba346f94",
"build_timestamp" : "2016-04-21T16:03:47Z",
"build_snapshot" : false,
"lucene_version" : "5.5.0"
},
"tagline" : "You Know, for Search"
}
By following these steps, Elasticsearch has been successfully installed. It is important to note that if Elasticsearch is to be used in a production environment, further detailed configurations are necessary. For specifics, refer to the official Elasticsearch documentation.
23-02-2024 02:02:07
22-02-2024 03:19:32
22-02-2024 03:16:03
22-02-2024 03:14:03
22-02-2024 03:11:58