
Mastering Elastic Stack
By :

In this section, we will install all four components of Elastic Stack on two popular operating systems - Microsoft Windows and Ubuntu. As a pre-requisite for installation of Elasticsearch or Logstash, Java should be installed. In case you have Java installed you can skip the Installation of Java section.
In this section, JDK needs to be installed for accessing Elasticsearch. Oracle Java 8 (Oracle JDK version 1.8.0_73 onwards) should be installed, as it is the recommended version for Elasticsearch 5.0.0 onwards.
Install Java 8 using terminal and apt package in the following manner:
sudo add-apt-repository -y ppa:webupd8team/java
In this case, we use a third-party repository. It does not violate the Oracle Java Rules by not including Java binaries; instead this PPA directly downloads Java Binaries from Oracle and installs the binaries.
You will be prompted to enter a password after running sudo command (unless you are not logged into as root) and you would receive OK on successful addition to repository, which indicates repository has been imported.
sudo apt-get update
sudo apt-get -y install oracle-java8-installer
Also during installation, you will be prompted to accept the license agreement which pops up as shown in the following screenshot:
java -version
The preceding screenshot signifies Java has installed successfully.
We can install Java on windows by going through the below steps:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Upon opening the link click on the Download button of JDK to download.
You will be redirected to the download page - first click on the Accept License Agreement radio button, then click on your Windows version (use x86 for 32-bit or x64 for 64-bit) to download the EXE file.
After opening environment variables, click on New (under System Variables) and give the variable name as JAVA_HOME
and variable value as C:\Program Files\Java\jdk1.8.0_74.
(Do check in your system where jdk has been installed and provide that path):
Then double click Path variable (under System Variables) and move towards the end of the text box - insert a semi colon if not inserted and add the location of the bin
folder of JDK such as: %JAVA_HOME%\bin
. Then click on OK to all the windows opened.
Do not delete anything within the path variable textbox.
java -version
The preceding screenshot signifies Java has installed successfully.
In this section, Elasticsearch v5.1.1 installation will be covered for Ubuntu and Windows separately.
In order to install Elasticsearch on Ubuntu, refer to the following steps:
wget https://artifacts.elastic.co
/downloads/elasticsearch/elasticsearch-5.1.1.deb
sudo dpkg -i elasticsearch-5.1.1.deb
Elasticsearch will be installed in /usr/share/elasticsearch
directory. The configuration files will be present at /etc/elasticsearch
. The init script will be present at /etc/init.d/elasticsearch
. The log files will be present within /var/log/elasticsearch
directory.
sudo update-rc.d elasticsearch defaults 9510
The preceding command will print on screen:
Adding system startup for, /etc/init.d/elasticsearch
Check status of Elasticsearch using following command:
sudo service elasticsearch status
Run Elasticsearch as a service using following command:
sudo service elasticsearch start
Elasticsearch may not start if you have any plugin installed which is not supported in ES-5.0.x version onwards. As plugins have been deprecated, it is required to uninstall any plugin if exists in prior version of ES.
Remove a plugin after going to ES Home using following command:
bin/elasticsearch-plugin remove head
Usage of Elasticsearch command:
sudo service elasticsearch {start|stop|restart|force-reload|status}
If you are using systemd distribution, then run following command:
sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable elasticsearch.service
To verify elasticsearch installation open open http://localhost:9200
in browser or run the following command from command line:
curl -X GET http://localhost:9200
In order to install Elasticsearch on Windows, refer to the following steps:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.zip
Upon opening the link, click on it and it will download the ZIP package.
This will extract the files and folders in the directory.
bin
folder.elasticsearch.bat
file to run Elasticsearch.If this window is closed Elasticsearch will stop running, as the node will shut down.
http://localhost:9200
in the browser:After installing Elasticsearch as previously mentioned, open Command Prompt after navigating to the bin
folder and use the following command:
elasticsearch-service.bat install Usage: elasticsearch-service.bat install | remove | start | stop | manager
This section covers installation of Kibana 5.1.1 on Ubuntu and Windows separately, before running Kibana, there are some prerequisites:
9200
(default port).5601
.In order to install Kibana on Ubuntu, refer to the following steps:
uname -m
If it gives an output as x86_64 it means it is 64-bit system else, if it gives i686 it means it is a 32-bit system.
wget https://artifacts.elastic.co/
downloads/kibana/kibana-5.1.1-amd64.deb
wget https://artifacts.elastic.co/
downloads/kibana/kibana-5.1.1-i386.deb
sudo dpkg -i kibana-5.1.1-amd64.deb
sudo dpkg -i kibana-5.1.1-i386.deb
Kibana will be installed in /usr/share/kibana
directory. The configuration files will be present at /etc/kibana
. The init script will be present at /etc/init.d/kibana
. The log files will be present within /var/log/kibana
directory.
sudo update-rc.d kibana defaults 9510
The above command will print on screen:
Adding system startup for /etc/init.d/kibana
Check status of Kibana using following command:
sudo service kibana status
Run Kibana as a service using following command:
sudo service kibana start
Usage of Kibana command:
sudo service kibana {start|force-start|stop|force-stop|status|restart}
If you are using systemd distribution then run following command:
sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable kibana.service
If you want to install any other version of Kibana, you can visit the Elastic Team download site and copy the debian package link and use wget to fetch the package.
http://localhost:5601
in the browser:
In order to install Kibana on Windows, refer to the following steps:
https://artifacts.elastic.co/downloads/kibana/kibana-5.1.1-windows-x86.zip
Upon opening the link, click on it and it will download the ZIP package.
bin
folder.kibana.bat
file to run Kibana.http://localhost:5601
in the browser:
In this section, Logstash will be installed. Logstash 5.1.1 will be installed and this section covers installation on Ubuntu and Windows separately.
In order to install Logstash on Ubuntu, refer to the following steps:
wget https://artifacts.elastic.co
/downloads/logstash/logstash-5.1.1.deb
sudo dpkg -i logstash-5.1.1.deb
Logstash will be installed in /usr/share/logstash directory
. The configuration files will be present at /etc/logstash
. The log files will be present within /var/log/logstash
directory
sudo initcl status logstash
Run Logstash as a service using following command:
sudo initctl start logstash
Logstash is installed in location /usr/share/logstash
In order to install Logstash on Windows, refer to the following steps:
https://artifacts.elastic.co/downloads/logstash/logstash-5.1.1.zip
Upon opening the link click it to download the ZIP package.
This will extract the files and folders in the directory.
bin
folder:logstash --version
This will print the Logstash version installed.
In this section, Filebeat will be installed. Filebeat 5.1.1 will be installed and this section covers installation on Ubuntu and Windows separately.
In order to install Filebeat on Ubuntu, refer to the following steps:
uname -m
If it gives an output as x86_64 it means it is 64-bit system else, if it gives i686 it means it is a 32-bit system.
wget https://artifacts.elastic.co
/downloads/beats/filebeat/filebeat-5.1.1-amd64.deb
wget https://artifacts.elastic.co
/downloads/beats/filebeat/filebeat-5.1.1-i386.deb
sudo dpkg -i filebeat-5.1.1-amd64.deb
sudo dpkg -i filebeat-5.1.1-i386.deb
Filebeat will be installed in /usr/share/filebeat directory. The configuration files will be present at /etc/filebeat. The init script will be present at /etc/init.d/filebeat. The log files will be present within /var/log/filebeat directory.
sudo update-rc.d filebeat defaults 95 10
The above command will print on screen:
Adding system startup for /etc/init.d/filebeat.
Check status of Filebeat using following command:
sudo service filebeat status
Run Filebeat as a service using following command:
sudo service filebeat start
Usage of Filebeat command:
sudo service filebeat {start|stop|status|restart|force-reload}
If you run Filebeat as a service, then it will run the /etc/filebeat/filebeat.yml configuration file.
If you want to install any other version of Filebeat, you can visit the Elastic Team download site and copy the debian package link and use wget to fetch the package.
In order to install Filebeat on Windows, refer to the following steps:
wmic os get osarchitecture
It will give an output as 64-bit or 32-bit.
Upon opening the link, click on it and it will download the ZIP package.
This will extract the files and folders in the directory.
C:\Users\username\Desktop
) and run the following command in Windows PowerShell:.\install-service-filebeat.ps1
If script execution is disabled on your system, you need to set the execution policy for the current session to allow the script to run. For example:
PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service-filebeat.ps1.
This will install Filebeat as a Windows service.
Change the font size
Change margin width
Change background colour