Last active
August 29, 2015 14:23
-
-
Save kmassada/4511bf7364a6c4b92a04 to your computer and use it in GitHub Desktop.
installing elastic search centos7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo ">>> Installing Elasticsearch" | |
cd /opt | |
sudo wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" \ | |
"http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jre-8u40-linux-x64.tar.gz" | |
sudo tar xvf jre-8*.tar.gz | |
sudo chown -R root: jre1.8* | |
sudo alternatives --install /usr/bin/java java /opt/jre1.8*/bin/java 1 | |
sudo rm /opt/jre-8*.tar.gz | |
sudo rpm --import http://packages.elasticsearch.org/GPG-KEY-elasticsearch | |
sudo touch /etc/yum.repos.d/elasticsearch.repo | |
sudo cat >> /etc/yum.repos.d/elasticsearch.repo << EOF | |
# elastic | |
[elasticsearch-1.4] | |
name=Elasticsearch repository for 1.4.x packages | |
baseurl=http://packages.elasticsearch.org/elasticsearch/1.4/centos | |
gpgcheck=1 | |
gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch | |
enabled=1 | |
EOF | |
sudo yum -y install elasticsearch-1.4.4 | |
# Configure Elasticsearch for development purposes (1 shard/no replicas, don't allow it to swap at all if it can run without swapping) | |
sudo sed -i "s/# index.number_of_shards: 1/index.number_of_shards: 1/" /etc/elasticsearch/elasticsearch.yml | |
sudo sed -i "s/# index.number_of_replicas: 0/index.number_of_replicas: 0/" /etc/elasticsearch/elasticsearch.yml | |
sudo sed -i "s/# bootstrap.mlockall: true/bootstrap.mlockall: true/" /etc/elasticsearch/elasticsearch.yml | |
sudo systemctl start elasticsearch.service | |
sudo systemctl enable elasticsearch.service | |
#verify | |
curl -XGET 'localhost:9200' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment