The following are the steps to install Java and LogStash on various Operating systems.
1) CentOS - v6/7
a) Install Java by downloading the software and
Copy >>> sudo wget http://mirror.centos.org/centos/7/updates/x86_64/Packages/java-11-openjdk-11.0.4.11-1.el7_7.x86_64.rpm
>>> sudo rpm -Uvh java-11-openjdk-11.0.4.11-1.el7_7.x86_64.rpm
b) Check installed Java version
c) Install Logstash-7.1.1
Copy >>> curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-7.1.1.rpm
>>> sudo rpm -ivh logstash-oss-7.1.1.rpm
d) Start and Stop Logstash services, use the following commands
Copy >>> sudo service logstash start/stop/restart (for CentOS-6)
>>> sudo systemctl start/stop/restart logstash (for CentOS-7)
You can enable autostart of Logstash services when system reboots using the following command
>>> sudo service logstash enable (or)
>>> sudo systemctl enable logstash
2) RHEL OS 6 / 7
a) Install Java
Copy >>> sudo wget http://mirror.centos.org/centos/7/updates/x86_64/Packages/java-11-openjdk-11.0.4.11-1.el7_7.x86_64.rpm
>>> sudo rpm -ivh java-11-openjdk-11.0.4.11-1.el7_7.x86_64.rpm
b) Check Java Version
c) Install LogStash-7.1.1
Copy >>> curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-7.1.1.rpm
>>> sudo rpm -ivh logstash-oss-7.1.1.rpm
d) To stop and Stop Logstash services, use the following commands
Copy >>> sudo service logstash start/stop/restart (for RHEL-6)
>>> sudo systemctl start/stop/restart logstash (for RHEL-7)
e) To auto start logstash services when system reboot follow the below commands.
Copy >>> sudo service logstash enable (or) sudo systemctl enable logstash
>>> sudo chkconfig --add logstash --level on
3) Ubuntu 16.04/18.04 OS:
a) Install Java
Copy >>> sudo add-apt-repository ppa:linuxuprising/java
>>> sudo apt update
>>> sudo apt install openjdk-11-jre-headless
If above procedure fails, follow the following:
>>> sudo curl -O https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
>>> sudo tar zxvf openjdk-11.0.2_linux-x64_bin.tar.gz
>>> sudo mv jdk-11* /usr/local/
>>> sudo vim /etc/profile.d/jdk.sh add below two lines and save the file
export JAVA_HOME=/usr/local/jdk-11.0.2
export PATH=$PATH:$JAVA_HOME/bin
>>> source /etc/profile
b) Check Java Version
c) Install Logstash-7.1.1
Copy >>> sudo curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-7.1.1.deb
>>> sudo dpkg -i logstash-7.1.1.deb
>>> sudo service logstash start/stop
d) To auto start logstash services when system reboot, enter the following commands
Copy >>> sudo service logstash enable (or) sudo systemctl enable logstash
>>> sudo chkconfig --add logstash --level on
3) Oracle Enterprise Linux (OEL 6 / OEL 7)
a) Install Java
Copy >>> sudo wget http://mirror.centos.org/centos/7/updates/x86_64/Packages/java-11-openjdk-11.0.4.11-1.el7_7.x86_64.rpm
>>> sudo rpm -ivh java-11-openjdk-11.0.4.11-1.el7_7.x86_64.rpm
b) Check Java Version
c) Install LogStash-7.1.1
Copy >>> curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-7.1.1.rpm
>>> sudo rpm -ivh logstash-oss-7.1.1.rpm
>>> sudo initctl start logstash
>>> sudo initctl stop logstash
d) To autostart logstash service when system reboots, enter the following commands
Copy >>> sudo service logstash enable (or) sudo systemctl enable logstash
>>> sudo chkconfig --add logstash --level on
4) Debian Linux v8/v9
a) Install Java
Copy >>> sudo apt update
>>> sudo apt install openjdk-11-jdk
Note: If the above step failed, download java deb package by following the link below
https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html
Copy the package to the server and execute below command
Copy >>> sudo dpkg -i jdk-11.0.2_linux-x64_bin.deb
b) Check Java Version
c) Install Logstash-7.1.1
Copy >>> sudo curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-7.1.1.deb
>>> sudo dpkg -i logstash-7.1.1.deb
>>> sudo service logstash start/stop/restart
d) To auto start logstash when system reboots, enter the following commands
Copy >>> sudo service logstash enable (or) sudo systemctl enable logstash
>>> sudo chkconfig --add logstash --level on
5) SLES OS
a) Install Java
Copy >>> wget http://mirror.centos.org/centos/7/updates/x86_64/Packages/java-11-openjdk-11.0.4.11-1.el7_7.x86_64.rpm
>>> sudo rpm -ivh java-11-openjdk-11.0.4.11-1.el7_7.x86_64.rpm
b) Check Java version
c) Install Logstash
Copy >>> curl -L -O https://artifacts.elastic.co/downloads/logstash/logstash-7.1.1.rpm
>>> sudo rpm -ivh logstash-oss-7.1.1.rpm
>>> sudo service logstash start/stop/restart
d) To auto start logstash when system reboots follow below commands
Copy >>> sudo service logstash enable (or) sudo systemctl enable logstash
>>> sudo chkconfig --add logstash --level on