Setting elasticsearch with ubuntu-server
In this post I will be writing steps to set up an ubuntu server to run elasticsearch on it.
Setting up ubuntu server
You will need a usb at least 4 gb in size.
- Download ubuntu server from here.
- Create a bootable usb stick with the server iso using the steps from How to create a bootable USB stick on Ubuntu
- Use the usb to boot the laptop in which you want to setup the server
- Install the ubuntu server as explained in this askubuntu answer.
-
In between you might get following error:
``` Your installation CD-ROM couldn’t be mounted. This probably means that yhe CD-ROM was not in the drive. If so you can insert it and try again.
Retry mounting the CD-ROM?
``` The error is coming because the setup needs the `ubuntu server iso` to be mounted to `/cdrom`. There are many solutions suggested on web (like [this](http://ubuntuforums.org/showthread.php?t=1750464), [this](https://pricklytech.wordpress.com/2013/04/21/ubuntu-server-unattended-installation-custom-cd/)) which were suggesting to mount the iso to `cdrom` manually. But nothing worked for me except [this silly answer](http://askubuntu.com/a/614902/78177). - After this restart the server and login.
Setting up network
There are many ways suggested on web like this, this, this, but what worked for me is Ubuntu 14.04 Server - WiFi WPA2 Personal.
Also in case you get confused router-ssid
is the name of the router network you want to connect to.
Setting up ssh server
Follow Install SSH server on Ubuntu Linux.
Setup Java
cd /opt/
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.tar.gz"
tar xzf jdk-8u51-linux-x64.tar.gz
apt-get install chkconfig
update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_51/bin/java 3
ref: How to Install JAVA 8 (JDK 8u66) on CentOS/RHEL and Fedora
Setup elasticsearch
-
Getting es
cd wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.1.zip apt-get install unzip unzip elasticsearch-1.7.1.zip rm *.zip cd elasticsearch-1.7.1/
-
Configure es
apt-get install vim vi ~/elasticsearch-1.7.1/config/elasticsearch.yml #cluster.name: elasticsearch #node.name: "es-node2" #script.inline: on #script.indexed: on
-
Setting up templates
Add templates: mkdir ~/elasticsearch-1.7.1/config/templates vi ~/elasticsearch-1.7.1/config/templates/message_template.json # Copy template
-
Installing plugins
Install kopf plugin: ~/elasticsearch-1.7.1//bin/plugin --install lmenezes/elasticsearch-kopf/1.5.7
-
Starting es:
/bin/elasticsearch
Make es aut start on boot
Again there are many options to do this using upstart, rc.d, rc.local, cron as explained here
Add /home/aapa/softwares/elasticsearch-1.7.1/bin/elasticsearch
to the /etc/rc.local
file as explained in How to run scripts on start up?.
Make system don’t go to sleep on closing lid
Follow Ubuntu Server 13.10 now goes to sleep when closing laptop lid
Switch off the screen
Follow Turn off monitor using command line
Make the system auto startable
As I am using my old laptop to make the server, it doesn’t have much battery backup. In case the system shutdowns due to any reason be it no power, I want it to start automatically.
Right now I am unabel to find any solution for this, but will update soon. The closest resource I found is: Automatic Reboot After Power Failure
References
- How to create a bootable USB stick on Ubuntu
- How do I install Ubuntu Server (step-by-step)
- Installing 11.04 server via USBstick
- Ubuntu server – unattended installation (custom cd)
- Ubuntu Server 14.04.2 install error: can’t umount /media
- Connect to WiFi network through Ubuntu terminal
- How to connect and disconnect to a network manually in terminal?
- How do I connect to a WPA wifi network using the command line?
- Ubuntu 14.04 Server - WiFi WPA2 Personal
- Install SSH server on Ubuntu Linux
- How to Install JAVA 8 (JDK 8u66) on CentOS/RHEL and Fedora
- Scripting
- Index templates
- lmenezes/elasticsearch-kopf
- Run automatically program on startup under linux ubuntu
- Initialize Script on Startup
- How to run scripts on start up?.
- Ubuntu Server 13.10 now goes to sleep when closing laptop lid
- Turn off monitor using command line
- Automatic Reboot After Power Failure