I've had this command saved for quite a while now. I've done quite a few ubuntu server set-ups for SugarCRM instances that require a specific version of elasticsearch in order to install and run.
This single line will do everything needed, install java, download the correct version, install it, start the server and remove the downloaded file.
This line auto-installs Elastic search 0.90.6 which is compatible with older versions of SugarCRM
sudo apt-get update && sudo apt-get install openjdk-7-jre-headless -y && wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.6.deb && sudo dpkg -i elasticsearch-0.90.6.deb && sudo service elasticsearch start && rm elasticsearch-0.90.6.deb
This line auto-installs Elastic search 1.3.1 which is compatible with the latest versions of SugarCRM
sudo apt-get install openjdk-7-jre-headless -y && wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.3.1.deb && sudo dpkg -i elasticsearch-1.3.1.deb && sudo service elasticsearch start && rm elasticsearch-1.3.1.deb
A breakdown of what is happening, just in case you don't know how the command above works.
Ensure our apt-get cache is most up-to-date
sudo apt-get update
Install the openjdk version 7
sudo apt-get install openjdk-7-jre-headless
Download Elasticsearch version 0.90.6 or download 1.3.1
Install the newly downloaded deb file
sudo dpkg -i elasticsearch-0.90.6.deb
Start the elasticsearch service
sudo service elasticsearch start
Remove the downloaded deb file
&& simply runs one command after the other in a single line.