Install Elasticsearch using Repositories

You can easily install Elasticsearch using APT and YUM repository
Install Elasticsearch Using APT repository
Install Elasticsearch Using Yum repository

Install Elasticsearch 5.0 on Debian:

Step 1: Download and Install Elasticsearch Public signin key

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

Step 2: Installation using APT Repository
Install the apt-transport-https package on Debian before installation.

sudo apt-get install apt-transport-https

Save the repository definition to /etc/apt/sources.list.d/elastic-5.x.list:

echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list

Step 3: Run apt-get update and the repository is ready for use.

sudo apt-get update

Step 4: Install Elasticsearch

sudo apt-get install elasticsearch

Step 5: Add Elasticsearch to start at booting

sudo update-rc.d elasticsearch defaults 95 10

Elasticsearch can be started and stopped using the service command:

sudo -i service elasticsearch start
sudo -i service elasticsearch stop

Install Elasticsearch on CentOS/ Fedora/ RHEL

Step 1: Download and install public key

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

Step 2: Add yum repository in /etc/yum.repos.d/ directory. I have added elastic.repo

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

Step 3: Install Elasticsearch using yum

yum install elasticsearch

Step 4: Add Elasticsearch to start at booting
If distribution is using SysV init

chkconfig --add elasticsearch

Elasticsearch can be started and stopped using the service command:

sudo -i service elasticsearch start
sudo -i service elasticsearch stop

If your distribution is using systemd:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
(Visited 59 times, 1 visits today)