Skip to content

Instantly share code, notes, and snippets.

@Paprikas
Forked from ricardo-rossi/ElasticSearch.sh
Last active April 15, 2016 07:18
Show Gist options
  • Save Paprikas/f70613e6159eeec41c4a to your computer and use it in GitHub Desktop.
Save Paprikas/f70613e6159eeec41c4a to your computer and use it in GitHub Desktop.
Installing ElasticSearch on Ubuntu 14.04 14.10 15.04 15.10 16.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh will install Elasticsearch 2.x
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
### ElasticSearch version
ELASTICSEARCH_VERSION="2.x"
### Install Java 8
cd ~
sudo apt-get install python-software-properties software-properties-common -y
sleep 1
sudo add-apt-repository ppa:webupd8team/java -y
sleep 1
sudo apt-get update
sleep 1
sudo apt-get install oracle-java8-installer -y
# Or use opnejdk
# sudo apt-get install openjdk-8-jdk -y
### Download and install the Public Signing Key
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
### Setup Repository
echo "deb http://packages.elastic.co/elasticsearch/${ELASTICSEARCH_VERSION}/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elk.list
### Install Elasticsearch
sudo apt-get update && sudo apt-get install elasticsearch -y
### Start ElasticSearch
sudo service elasticsearch start
### Lets wait a little while ElasticSearch starts
sleep 5
### Make sure service is running
curl http://localhost:9200
### Should return something like this:
# {
# "status" : 200,
# "name" : "Storm",
# "version" : {
# "number" : "1.3.1",
# "build_hash" : "2de6dc5268c32fb49b205233c138d93aaf772015",
# "build_timestamp" : "2014-07-28T14:45:15Z",
# "build_snapshot" : false,
# "lucene_version" : "4.9"
# },
# "tagline" : "You Know, for Search"
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment