How to Install, Upgrade or Remove Elasticsearch on CentOS

Andy

Administrator
Staff member
Elasticsearch is built using Java, and includes a bundled version of OpenJDK from the JDK maintainers (GPLv2+CE) within each distribution. This mean you don't have to install Java before installing Elasticsearch.

Source: https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html

After you install Elasticsearch, you can check which version of Java was installed by using this command:

java -version

1581401007502.jpg


Latest version is:

openjdk version "1.8.0_242"
 

Andy

Administrator
Staff member
Installing Elasticsearch on CentOS

Before installing Elasticsearch, make sure your VPS has enough memory. ES uses 1GB of memory, so a VPS with only 2GB of memory will not be enough.

See this document for instructions:

https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html

1581548126322.jpg


Note: when you install Elasticsearch, ignore the error messages shown during installation.

Once Elasticsearch is installed you will need to execute the following command:

systemctl daemon-reload

To start Elasticsearch issue the following command:

service elasticsearch start

To verify Elasticsearch is running issue the following command:

service elasticsearch status

To stop Elasticsearch issue the following command:

service elasticsearch stop

You can verify the Elasticsearch version number with this command:

curl -XGET 'localhost:9200'

You can verify Elasticsearch is running with this command:

curl http://localhost:9200/_cluster/health?pretty
 

Andy

Administrator
Staff member
To upgrade Elasticsearch to a newer version, I recommend first uninstalling the current version, then installing the latest version of Elasticsearch using the instruction from the above post.
  1. Disable Enhanced search in XenForo.
  2. Stop Elasticsearch from command line service elasticsearch stop
  3. Uninstall Elasticsearch from command line yum remove elasticsearch
  4. Install latest version of Elasticsearch using above instructions.
  5. Enable Enhanced search in XenForo and rebuild the index.
 

Andy

Administrator
Staff member
Elasticsearch version 8 and newer requires you to edit the followng configuration file:

/etc/elasticsearch/elasticsearch.yml

The following "true" values need to be changed to "false" values:

1652306988878.jpg


Your edit should look like this:

1652305024258.jpg


After making the change you will need to restart elasticsearch with the following commands:

service elasticsearch stop
service elasticsearch start
 
Top