Skip to content

Instantly share code, notes, and snippets.

@wtracyliu
Last active August 29, 2015 14:06
Show Gist options
  • Save wtracyliu/19abb50de2212b095d3a to your computer and use it in GitHub Desktop.
Save wtracyliu/19abb50de2212b095d3a to your computer and use it in GitHub Desktop.
Install elasticsearch and some plugins on Centos
#!/bin/bash
# Created by Wentao Liu([email protected])
# Date: 2014-09-10
# Script used to setup elasticsearch on Centos.
echo "Install JRE ..."
sudo yum install jre -y
echo "Import public key ..."
rpm --import http://packages.elasticsearch.org/GPG-KEY-elasticsearch
echo "add repositories ..."
echo "[elasticsearch-1.3]" >> /etc/yum.repos.d/elasticsearch.repo
echo "name=Elasticsearch repository for 1.3.x packages" >> /etc/yum.repos.d/elasticsearch.repo
echo "baseurl=http://packages.elasticsearch.org/elasticsearch/1.3/centos" >> /etc/yum.repos.d/elasticsearch.repo
echo "gpgcheck=1" >> /etc/yum.repos.d/elasticsearch.repo
echo "gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch" >> /etc/yum.repos.d/elasticsearch.repo
echo "enabled=1" >> /etc/yum.repos.d/elasticsearch.repo
echo "Installing Elasticsearch..."
yum install elasticsearch -y
echo "Add Daemon supported ..."
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo /bin/systemctl start elasticsearch.service
echo "Installing Plugins ..."
cd /usr/share/elasticsearch
echo "install elasticsearch-head ..."
bin/plugin -install mobz/elasticsearch-head
echo "install bigdesk ..."
bin/plugin -install lukas-vlcek/bigdesk
echo "install maven ..."
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
sudo yum install -y git
echo "install mmseg "
git clone https://github.com/medcl/elasticsearch-analysis-mmseg
cd elasticsearch-analysis-mmseg
mvn clean package
ls target/
rm target/*sources.jar
mkdir /usr/share/elasticsearch/plugins/elasticsearch-analysis-mmseg
cp target/elasticsearch*.jar /usr/share/elasticsearch/plugins/elasticsearch-analysis-mmseg
cp -r config/mmseg /etc/elasticsearch/
cat config/elasticsearch.yml >> /etc/elasticsearch/elasticsearch.yml
# Install IK
# git clone https://github.com/medcl/elasticsearch-analysis-ik
# cd elasticsearch-analysis-ik
# mvn clean package
# ls target/
# rm target/*sources.jar
# mkdir /usr/share/elasticsearch/plugins/elasticsearch-analysis-ik
# cp target/elasticsearch*.jar /usr/share/elasticsearch/plugins/elasticsearch-analysis-ik
# cp -r config/ik /etc/elasticsearch/
# cat config/elasticsearch.yml >> /etc/elasticsearch/elasticsearch.yml
echo "finish ..."
curl -X GET http://localhost:9200/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment