Install Elasticsearch on Ubuntu
We’ll sho you, how to install Elasticsearch on an Ubuntu. Elasticsearch is a distributed, scalable, real-time search and analytics engine based on Lucene. It enables you to search, analyze, and explore your data with an HTTP web interface and schema-free JSON documents. It is developed in Java and is released as open source under the terms of the Apache License. Installing Elasticsearch on Ubuntu, is an easy task is you carefully follow our tutorial below. Installation of Elasticsearch on Ubuntu should take less then 10 minutes.
Below are several of Elasticsearch features:
- Distributed and Highly Available Search Engine.
- Each index is fully sharded with a configurable number of shards.
- Each shard can have one or more replicas.
- Read / Search operations performed on either one of the replica shard.
- Multi Tenant with Multi Types.
- Support for more than one index.
- Support for more than one type per index.
- Index level configuration (number of shards, index storage, …).
- Various set of APIs
- HTTP RESTful API
- Native Java API.
- All APIs perform automatic node operation rerouting.
- Document oriented
- No need for upfront schema definition.
- Schema can be defined per type for customization of the indexing process.
- Reliable, Asynchronous Write Behind for long term persistency.Built on top of Lucene
- Each shard is a fully functional Lucene index
- All the power of Lucene easily exposed through simple configuration / plugins.
We will be using our SSD 1 Linux VPS Hosting plan for this tutorial.
2. Login via SSH
Login to your server via SSH
# ssh [email protected]_ip
3. Check the version of Ubuntu
You can check whether you have the proper version of Ubuntu installed on our server with the below command:
# lsb_release -a
Which should give you the underneath output:
Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS Release: 14.04 Codename: trusty
4. Update the system
Make sure your server is fully up to date. Also, install wget and unzip:
# apt-get update && apt-get upgrade # apt-get install unzip wget
5. Install Oracle Java 8
Since Elasticsearch is written in Java, you will need to install a Java Runtime Environment on your server. Therefore, add the Java PPA repository in your Ubuntu system with the below command:
# echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list # echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list # apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
Update the package index and install Java 8:
# apt-get update # apt-get install oracle-java8-installer
Check if Java has been properly installed:
# java -version
You should receive the following output:
java version "1.8.0_72" Java(TM) SE Runtime Environment (build 1.8.0_72-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)
6. Install Elasticsearch on Ubuntu
Download Elasticsearch from the respective website. As you can see, downloads are available in zip, tar.gz, deb and rpm packages. For this install process which will run on Ubuntu it is better if you use the Debian package (deb) because it will install everything that is needed in order for Elasticsearch to run. Therefore, enter the below commands:
# cd /opt # wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.2.0/elasticsearch-2.2.0.deb
Once the deb package is downloaded, install Elasticsearch using the dpkg command as shown below:
# dpkg -i elasticsearch-2.2.0.deb
This installation procedure will install Elasticsearch in /usr/share/elasticsearch/ whose configuration files will be placed in /etc/elasticsearch
The script that will be used to stop/start/restart this platform is /etc/init.d/elasticsearch
7. Configure Elasticsearch
Enter the following command to ensure that Elasticsearch will start automatically on boot.
# update-rc.d elasticsearch defaults
Now let’s do some basic editing on the /etc/elasticsearch/elasticsearch.yml file which is the main config file for Elasticsearch. Open the file with your favorite text editor. We are using nano:
# nano /etc/elasticsearch/elasticsearch.yml
Update the node.name and cluster.name values with your server name (hostname) and the name that the cluster will be associated with. For example after our modification, the lines in the file look like the ones below:
# ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # cluster.name: rosehostingcluster # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # node.name: vps.rosehosting.com # # Add custom attributes to the node: # # node.rack: r1
Of course there are many configuration settings that can be tweaked according to one’s needs, however we will leave it to you and your preferences. For further information you can use Elasticsearch thorough documentation.
Once you are finished with editing the file, save and close it. Then start Elasticsearch:
# /etc/init.d/elasticsearch start
Congratulations, you have successfully installed Elasticsearch on your Ubuntu 14.04 VPS.
Of course you don’t have to Install elasticsearch on Ubuntu, if you use one of our Ubuntu VPS Hosting services in which case you can simply ask our expert Linux admins to install Elasticsearch on Ubuntu, for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post, on how to install Elasticsearch on Ubuntu, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.