mercoledì 2 maggio 2018

Install Elasticsearch on Ubuntu

ELK STACK

install Java

sudo apt-get install default-jdk

Elasticsearch 6

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt-get update && sudo apt-get install elasticsearch
edit the elasticsearch.yml file:
sudo vi /etc/elasticsearch/elasticsearch.yml
Change network.host to 0.0.0.0
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo /bin/systemctl start elasticsearch.service
so, now Elasticsearch should be running!
Check if it running at this address: http://127.0.0.1:9200/
http://127.0.0.1:9200/
At this address you should see something as this:
{
  "name" : "ktJu_0M",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "-zyJ1svGQu-nU5iKa23Z2w",
  "version" : {
    "number" : "6.2.4",
    "build_hash" : "ccec39f",
    "build_date" : "2018-04-12T20:37:28.497551Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

setting SSH connection to Ubuntu on Virtualbox

How to setting an ssh connection on a Virtualbox Ubuntu.
Create an Ubuntu Virtualbox
Create a new Virtual Machine and check Create a new virtual disk
Name your virtualmachine, select Linux as OS type and Ubuntu (64 bit) as linux version.
Set the virtual RAM at half of the your real RAM, in my case I have 8gb on my laptop, so i give to virtual machine 4gb
Create a new virtual disk:
Select the source for install your Ubuntu OS, select VDI (VirtualBox Disk Image)
Select Dynamic allocation:
Set the size of your virtual Hard Disk and click on create:
Start your Machine:
Select the iso image of ubuntu (You must download it from ubuntu official web site).
Install Ubuntu following the installation wizard:
After have installed Ubuntu, login your virtualmachine ubuntu with username and password inserted during the installation:
Install openssh-server
sudo apt-get update
sudo apt-get install openssh-server
stop your virtualmachine.
Set the net of your virtualmachine:
click on settings & net:
Select NAT as connection and click on advanced, and set as in the picture below.
Click on port forwarding:
and set the SSH parameter:
Name: SSH
Protocol: TCP
Host IP: 127.0.0.1
Host Port: 2222
IP Guest: Empty
Port Guest: 22
Start your Virtual Machine:
When your VM is started, open your terminal and try to connect:
ssh yourusername@127.0.0.1 -p 2222
now you shoud be inside your virtualmachine.

Problems and Possible Solutions:

If you can’t connect try to disable or change settings to ubuntu firewall:
sudo ufw disable
or try to connect to the ip of VM:
click on global tools:
Click on create:
Back to Settings > Network and select adapter 1
Select Adapter only Host.
go inside the VM and get the ip number with ifconfig and get ip address:
ifconfig
In my case the ip is 192.168.56.101
now from terminal I try to connect in ssh to the ip 192.168.56.101
ssh yourusername@192.168.56.101

Install Elasticsearch on Ubuntu

ELK STACK install Java sudo apt-get install default-jdk Elasticsearch 6 wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch...