How To Install Apache Hadoop on Ubuntu 18.04 LTS

Install Apache Hadoop on Ubuntu 18

Apache Hadoop is an open source framework used for distributed storage as well as distributed processing of big data on clusters of computers which runs on commodity hardwares. Hadoop stores data in Hadoop Distributed File System (HDFS) and the processing of these data is done using MapReduce. YARN provides an API for requesting and allocating resources in the Hadoop cluster. In this tutorial we will learn how to install Apache Hadoop on Ubuntu 18.04 LTS.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Apache Hadoop on an Ubuntu 18.04 Bionic Beaver server.

Install Apache Hadoop on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First, make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Java (OpenJDK).

Since hadoop is based on java, make sure you have java jdk installed on the system. If you don’t have Java installed on your system, use following link to install it first.

Install Java JDK 8 on Ubuntu:


[email protected] ~# java -version
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

Step 3. Installing Apache Hadoop on Ubuntu 18.04.

To avoid security issues, we recommend to setup new Hadoop user group and user account to deal with all Hadoop related activities, following command:

sudo addgroup hadoopgroup
sudo adduser —ingroup hadoopgroup hadoopuser

After creating the user, it also required to set up key based ssh on its own account. To do this use execute following commands:

su - hadoopuser
ssh-keygen -t rsa -P ""
cat /home/hadoopuser/.ssh/id_rsa.pub >> /home/hadoopuser/.ssh/authorized_keys
chmod 600 authorized_keys
ssh-copy-id -i ~/.ssh/id_rsa.pub slave-1
ssh slave-1

Download the latest stable version of Apache Hadoop, At the moment of writing this article it is version 2.8.1:

wget http://www-us.apache.org/dist/hadoop/common/hadoop-3.1.1/hadoop-3.1.1.tar.gz
tar xzf hadoop-3.1.1.tar.gz
mv hadoop-3.1.1 hadoop

Step 4. Configure Apache Hadoop.

Setting up the environment variables. Edit ~/.bashrc file and append following values at end of file:

export HADOOP_HOME=/home/hadoop/hadoop
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin

Apply environmental variables to current running session:

source ~/.bashrc

Now edit $HADOOP_HOME/etc/hadoop/hadoop-env.sh file and set JAVA_HOME environment variable:

export JAVA_HOME=/usr/jdk1.8.0_192/

Hadoop has many of configuration files, which need to configure as per requirements of your hadoop infrastructure. Let’s start with the configuration with basic Hadoop single node cluster setup:

cd $HADOOP_HOME/etc/hadoop

Edit core-site.xml:

<configuration>
<property>
  <name>fs.default.name</name>
    <value>hdfs://localhost:9000</value>
</property>
</configuration>

Edit hdfs-site.xml:

<configuration>
<property>
 <name>dfs.replication</name>
 <value>1</value>
</property>

<property>
  <name>dfs.name.dir</name>
    <value>file:///home/hadoop/hadoopdata/hdfs/namenode</value>
</property>

<property>
  <name>dfs.data.dir</name>
    <value>file:///home/hadoop/hadoopdata/hdfs/datanode</value>
</property>
</configuration>

Edit mapred-site.xml:

<configuration>
 <property>
  <name>mapreduce.framework.name</name>
   <value>yarn</value>
 </property>
</configuration>

Edit yarn-site.xml:

<configuration>
 <property>
  <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
 </property>
</configuration>

Now format namenode using the following command, do not forget to check the storage directory:

hdfs namenode -format

Start all hadoop services use the following command:

cd $HADOOP_HOME/sbin/
start-dfs.sh
start-yarn.sh

You should observe the output to ascertain that it tries to start datanode on slave nodes one by one. To check if all services are started well using ‘jps‘ command:

jps

Step 5. Accessing Apache Hadoop.

Apache Hadoop will be available on HTTP port 8088 and port 50070 by default. Open your favorite browser and navigate to http://yourdomain.com:50070 or http://server-ip:50070. If you are using a firewall, please open port 8088 and 50070 to enable access to the control panel.

Congratulation’s! You have successfully installed Hadoop. Thanks for using this tutorial for installing Apache Hadoop on Ubuntu 18.04 LTS system. For additional help or useful information, we recommend you to check the official Apache Hadoop web site.

How To Install Deluge on Ubuntu 18.04 LTS

Install Deluge on Ubuntu 18

Deluge is a popular multi-platform bittorrent client often used to provide torrenting / seedbox functionality on Linux servers. Like rTorrent, deluge uses libtorrent as its backend. Supported by daemon-service, awesome interface, and great plugin support, Deluge surpass Transmission and rTorrent for functionality.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Deluge bittorrent client on an Ubuntu 18.04 Bionic Beaver server.

Install Deluge on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Deluge on Ubuntu 18.04 LTS.

Use the following command to install Deluge daemon and Deluge Web interface on Ubuntu 18.04 server:

sudo add-apt-repository ppa:deluge-team/ppa
sudo apt install deluged deluge-webui

Then create the Deluge user and group:

sudo adduser --system --group deluge
sudo gpasswd -a wpcademy deluge

Step 3. Create Systemd Service.

Create a systemd service file for deluge with your favourite text editor such as nano:

nano /etc/systemd/system/deluged.service

Add following lines:

[Unit]
Description=Deluge Bittorrent Client Daemon
After=network-online.target

[Service]
Type=simple
User=deluge
Group=deluge
UMask=007

ExecStart=/usr/bin/deluged -d

Restart=on-failure

# Configures the time to wait before service is stopped forcefully.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target

Now start deluge deamon with the following command:

systemctl start deluged
systemctl enable deluged

Next, we create a systemd service file for deluge web:

nano /etc/systemd/system/deluge-web.service

Add following lines:

[Unit]
Description=Deluge Bittorrent Client Web Interface
After=network-online.target

[Service]
Type=simple

User=deluge
Group=deluge
UMask=027

ExecStart=/usr/bin/deluge-web

Restart=on-failure

[Install]
WantedBy=multi-user.target

Save and close the file also start and enable deluge-web:

systemctl start deluge-web
systemctl enable deluge-web

Step 4. Accessing Deluge.

Deluge will be available on HTTP port 8112 by default. Open your favorite browser and navigate to http://yourdomain.com:8112 or http://server-ip:8112. The default password for deluge is deluge, better change it when you are first to login.

Congratulation’s! You have successfully installed Deluge. Thanks for using this tutorial for installing Deluge bittorrent client on your Ubuntu 18.04 LTS system. For additional help or useful information, we recommend you to check the official Deluge web site.

How To Install Yarn on Ubuntu 18.04 LTS

Install Yarn on Ubuntu 18

Yarn is an advanced package management software for Node.js applications. It is a fast, secure, and reliable alternative that any other Nodejs package manager’s.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation R open source programming language on an Ubuntu 18.04 Bionic Beaver server.

Install Yarn on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade
[php]



<strong> Step 2. Installing Yarn on Ubuntu 18.04 LTS.
</strong>

First, Yarn repository and import the repository’s GPG key:

[php]
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

Next, update the package index and install Yarn using following command:

sudo apt-get update
sudo apt-get install yarn

If using nvm you can avoid the node installation by doing:

sudo apt install --no-install-recommends yarn

Verify the installation:

yarn --version

Step 3. Using Yarn.

Create a new Yarn project use yarn init:

yarn init my_yarn_wpcademy

Adding dependency:

yarn add [package_name]

Upgrading dependency:

yarn upgrade [package_name]
yarn upgrade [package_name]@[version_or_tag]

Installing all project dependencies:

yarn

Congratulation’s! You have successfully installed Yarn. Thanks for using this tutorial for installing Yarn on your Ubuntu 18.04 LTS Bionic Beaver. For additional help or useful information, we recommend you to check the official Yarn web site.

How To Install VNC Server on Ubuntu 18.04 LTS

Install VNC Server on Ubuntu 18

VNC (Virtual Network Computing) server is a free and open source software which is designed for allowing remote access to the Desktop Environment of the server to the VNC Client whereas VNC viewer is used on remote computer to connect to the server .

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation VNC Server on an Ubuntu 18.04 Bionic Beaver server.

Install VNC Server on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade
[php]

<strong> Step 2. Installing VNC Server on Ubuntu 18.04 LTS.</strong>

First, type the following command to install Xfce on your server:
[php]
sudo apt install xfce4 xfce4-goodies xorg dbus-x11 x11-xserver-utils

Next, install TigerVNC on your Ubuntu server:

sudo apt install tigervnc-standalone-server tigervnc-common

Once installed the next step is to run the vncserver command which will create the initial configuration and set up the password:

vncserver

Result:

You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n
/usr/bin/xauth:  file /home/chedelics/.Xauthority does not exist

New 'server2.wpcademy.com:1 (chedelics)' desktop at :1 on machine server2.wpcademy.com
Starting applications specified in /etc/X11/Xvnc-session
Log file is /home/chedelics/.vnc/server2.wpcademy.com:1.log

Use xtigervncviewer -SecurityTypes VncAuth -passwd /home/chedelics/.vnc/passwd :1 to connect to the VNC server.

After VNC Server started and created some of it’s files. We are now can turn it off to modify the xstartup file (startup script) to make it start with xfce4:

vncserver -kill :1
[php]

<strong> Step 3. Configuring VNC Server. </strong>

First, create the following file:
[php]
~/.vnc/xstartup

Add following files:

#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4

Next, Run the following command to make sure permissions are correct:

chmod u+x ~/.vnc/xstartup

Step 4. Creating a Systemd unit file.

The next step is to create VNC Server statup script:

/etc/systemd/system/[email protected]

Add following files:

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=simple
User=chedelics
PAMName=login
PIDFile=/home/%u/.vnc/%H%i.pid
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill :%i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver :%i -geometry 1440x900 -alwaysshared -fg
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target

The next step is to enable the unit file with the following command:

sudo systemctl daemon-reload
sudo systemctl enable [email protected]
sudo systemctl start [email protected]

Step 4. Connecting to VNC server.

To access remote desktop on vnc server from windows system, you must have vnc viewer installed on your system. There are various vnc viewer available to use. Download any one and install on your system, for example:

TightVNC
RealVNC
TigerVNC

tightvnc-connection

Congratulation’s! You have successfully installed VNC Server. Thanks for using this tutorial for installing VNC Server on your Ubuntu 18.04 LTS Bionic Beaver. For additional help or useful information, we recommend you to check the official VNC web site.

How To Install Vagrant on Ubuntu 18.04 LTS

Install Vagrant on Ubuntu 18

Vagrant is an open source tool for building an entire virtual development environment. Frequently, a test environment is needed for analyzing the latest release and new tools. Also, it reduces the time spent on re-building that your OS. By default, vagrant uses virtualbox for managing the Virtualization. Vagrant acts as the fundamental configuration for managing/deploying multiple reproducible virtual environments with the same configuration.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Vagrant virtual development environment on an Ubuntu 18.04 Bionic Beaver server.

Install Vagrant on Ubuntu 18.04 LTS Bionic Beaver

 

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing VirtualBox.

Install Virtualbox from the terminal using following command:
[/php]
apt install virtualbox


<strong> Step 3. Installing Vagrant on Ubuntu 18.04 LTS.
</strong>
Install Vagrant from the terminal using following command:

[php]
apt install vagrant

To verify that the installation was successful run the following command which will print the Vagrant version:

vagrant --version

Step 4. Deploy your development environment.

Vagrant can quickly deploy the development environment. The following command will install precise32 box from the vagrant website. A box is nothing more then a specially packaged image that can later be used to provision a server:

vagrant box add precise32 http://files.vagrantup.com/precise32.box

Create a root directory for your Project. Then create a vagrant file in this folder by calling ‘vagrant init’, which will be the central file for the project configuration:

mkdir vagrant_project_wpcademy
cd vagrant_project wpcademy
vagrant init

Edit the Vagrantfile in this directory and replace:

config.vm.box = "precise32"

Start Environment:

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise32'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...

Congratulation’s! You have successfully installed Vagrant. Thanks for using this tutorial for installing Vagrant virtual development environment on your Ubuntu 18.04 LTS Bionic Beaver system. For additional help or useful information, we recommend you to check the official Vagrant web site.

How To Install Nagios on Ubuntu 18.04 LTS

Install Nagios on Ubuntu 18

Nagios is an open source software that can be used for network and infrastructure monitoring. Nagios will monitor servers, switches, applications and services. It alerts the System Administrator when something went wrong and also alerts back when the issues has been rectified. Resources that can be monitored include CPU, memory and disk space loads, log files, temperature or hardware errors. It can monitor various parameters and problems for services like HTTP, SMTP, DNS, and with the help of plugins it can be highly extended. Nagios core was originally designed to run under Linux, although it should work under most other unices as well.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Nagios on a Ubuntu 18.04 (Bionic Beaver) server.

Install Nagios on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade
[php]

<strong> Step 2. Install LAMP (Linux, Apache, MariaDB and PHP) server.</strong>

A Ubuntu 18.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here. Also install all required PHP modules:
[php]
apt-get install php7.1-cli php7.1-mbstring php7.1-gd php7.1-opcache php7.1-mysql php7.1-json php7.1-mcrypt php7.1-xml php7.1-curl

Step 3. Create users and groups for Nagios.

For security reasons, create a user and group specifically to run Nagios:

useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd www-data

Step 4. Installing Nagios and plugins on Ubuntu 18.04 LTS.

First thing to do is to go to Nagios’s download page and download the latest stable version of Nagios, At the moment of writing this article it is version 4.4.2:
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.2.tar.gz
tar -zxvf /tmp/nagios-4.4.2.tar.gz
cd /tmp/nagios-4.4.2/

Perform below steps to compile the Nagios from the source code:

./configure --with-nagios-group=nagios --with-command-group=nagcmd --with-httpd_conf=/etc/apache2/sites-enabled/
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf

Next steps, Download latest nagios-plugins source and install using following commands:

wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
tar xzf nagios-plugins-2.1.1.tar.gz
cd nagios-plugins-2.1.1
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Step 5. Configure Nagios on Ubuntu 18.04 Bionic Beaver.

Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.

nano /usr/local/nagios/etc/objects/contacts.cfg

Change the email address field to receive the notification:

[...]
define contact{
contact_name nagiosadmin ; Short name of userus
generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of useremail
[email protected] ; <<=== CHANGE THIS TO YOUR EMAIL ADDRESS ===
[...]

Step 6. Configure Apache web server for Nagios.

Now create nagios apache2 configuration file:

nano /etc/apache2/sites-enabled/nagios.conf

Edit the following lines if you want to access nagios administrative console from a particular IP series, Here, I want to allow nagios administrative access from 192.168.1.0/24 series only:

[...]
## Comment the following lines ##
#   Order allow,deny
#   Allow from all

## Uncomment and Change lines as shown below ##
Order deny,allow
Deny from all
Allow from 127.0.0.1 192.168.1.0/24
[...]

Enable Apache’s rewrite and cgi modules:

sudo a2enmod rewrite
sudo a2enmod cgi

Configure Apache authentication:

We need to setup the password for the user nagiosadmin. This username will be used to access the web interface so it is important to remember the password that you will input here. Set the password running the following command and enter the password twice:

# sudo htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin

Restart Apache for the changes to take effect:

systemctl restart apache2

Step 7. Verify and Start Nagios service.

Next we have to make Nagios start at boot time, so first verify that the configuration file has no errors running the following command:

sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

And you should get the output:

[...]
Checking objects...
    Checked 8 services.
    Checked 1 hosts.
    Checked 1 host groups.
    Checked 0 service groups.
    Checked 1 contacts.
    Checked 1 contact groups.
    Checked 24 commands.
    Checked 5 time periods.
    Checked 0 host escalations.
    Checked 0 service escalations.
Checking for circular paths...
    Checked 1 hosts
    Checked 0 service dependencies
    Checked 0 host dependencies
    Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check
[...]

Ubuntu 18.04 uses systemd for starting / stopping all the services, so, we need to create nagios.service file:

nano /etc/systemd/system/nagios.service

Add the following lines:

[Unit]
Description=Nagios
BindTo=network.target

[Install]
WantedBy=multi-user.target

[Service]
User=nagios
Group=nagios
Type=simple
ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg

Enable Nagios to start automatically at system startup:

systemctl enable /etc/systemd/system/nagios.service

Now, start Nagios service:

systemctl start nagios

Step 8. Accessing Nagios.

Nagios will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://your-domain.com/nagios or http://server-ip/nagios and complete the required the steps to finish the installation. When prompted for username and password you will introduce the username “nagiosadmin” and the password that you entered in step 6.
Nagios-admin-panel
Congratulation’s! You have successfully installed Nagios. Thanks for using this tutorial for installting Nagios monitoring tool in ubuntu 18.04 (Bionic Beaver) systems. For additional help or useful information, we recommend you to check the official Nagios web site.

How To Install ELK Stack on Ubuntu 18.04 LTS

Install ELK Stack on Ubuntu 18

ELK stack is a popular, open source log management platform. It is used as a centralized management for storing, analyzing and viewing of logs. Centralized management makes it easier to study the logs and identify issues if any for any number of servers.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation ELK Stack on an Ubuntu 18.04 Bionic Beaver server.

Install ELK Stack on Ubuntu 18.04 LTS Bionic Beaver

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Java on Ubuntu 18.04 LTS.

Now install the Java by using the following command:

apt -y install oracle-java8-installer

Next, you can also set the JAVA_HOME and other defaults by installing oracle-java8-set-default:

apt -y install oracle-java8-set-default

Then, You can now verify if the JAVA_HOME variable is set by running:

echo "$JAVA_HOME"

Verify the Java version:

[[email protected] ~]# java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b11-1~deb9u1-b11)
OpenJDK 64-Bit Server VM (build 25.181-b11, mixed mode)

Step 3. Installing Elasticsearch on Ubuntu 18.04 LTS.

First, install Elasticsearch using the apt package manager from the official Elastic repository:

wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
apt-get update

Then, install Elasticsearch with apt using the following command:

apt-get -y install elasticsearch

Start the Elasticsearch service and set it to automatically start on boot:

systemctl restart elasticsearch
systemctl enable elasticsearch

Elasticsearch is now installed. Edit it’s configurations now, using following commands:

nano /etc/elasticsearch/elasticsearch.yml

Step 4. Installing Kibana on Ubuntu 18.04 LTS.

First, create the Kibana source list:

echo "deb http://packages.elastic.co/kibana/4.5/debian stable main" | sudo tee -a /etc/apt/sources.list.d/kibana-4.5.x.list

Now install Kibana with this command:

apt-get update
apt-get -y install kibana

Once the installation is completed, open the kibana.yml file and restrict the remote access to the Kibana instance:

nano /etc/kibana/kibana.yml

# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "localhost"

Start the Kibana service and set it to start automatically on boot:

systemctl start kibana
systemctl enable kibana

Step 5. Installing Logstash on Ubuntu 18.04 LTS.

First, create the Logstash source list:

echo 'deb http://packages.elastic.co/logstash/2.2/debian stable main' | sudo tee /etc/apt/sources.list.d/logstash-2.2.x.list

Next, Install Logstash using the apt package manager:

apt-get install logstash

Once the Logstash package is installed start the Logstash service and set it to start automatically on boot:

systemctl restart logstash
systemctl enable logstash

Step 6. Install and configure Nginx as a reverse proxy.

Next, use Nginx as a reverse proxy to access Kibana from the public IP address. To install Nginx, run:

apt-get install nginx

Create a basic authentication file with the openssl command:

echo "admin:`openssl passwd -apr1 YourPasswd`" | sudo tee -a /etc/nginx/htpasswd.kibana

Then, create a virtual host configuration file for the Kibana instance:

rm -f /etc/nginx/sites-enabled/default
nano /etc/nginx/sites-available/kibana
rm-f/etc/nginx/sites-enabled/default
nano/etc/nginx/sites-available/kibana
server {
listen 80 default_server;
server_name _;
return 301 https://$server_name$request_uri;
}

server {
listen 443 default_server ssl http2;

server_name _;

ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
ssl_session_cache shared:SSL:10m;

auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/htpasswd.kibana;

location / {
proxy_pass http://localhost:5601;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

Creating a symbolic link and test the Nginx configuration:

ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/kibana
nginx -t

Restart the Nginx service and set it to start automatically on boot:

systemctl restart nginx
systemctl enable nginx

Step 7. Accessing Kibana.

You can now access the kibana interface by opening your browser and typing:

https://Your-IpAddress

Congratulation’s! You have successfully installed ELK Stack. Thanks for using this tutorial for installing ELK Stack on your Ubuntu 18.04 LTS Bionic Beaver. For additional help or useful information, we recommend you to check the official ELK Stack web site.