Requirements
- Centos 7
- Java 8
Install ElasticSearch 2.x
rpm --import http://packages.elastic.co/GPG-KEY-elasticsearch
vi /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-2.1]
name=Elasticsearch repository for 2.x packages
baseurl=http://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
yum -y install elasticsearch
vi /etc/elasticsearch/elasticsearch.yml
network.host: localhost
systemctl start elasticsearch
systemctl enable elasticsearch
pip install elasticsearch
Only for Wagtail CMS
vi {PROJECT_FOLDER}/settings/base.py
=== replace_name with correct 'index' in ElasticSearch
WAGTAILSEARCH_BACKENDS = {
'default': {
'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch',
'INDEX': '{{ project_name }}',
},
}
./manage.py update_index
Install Kibana
groupadd -g 1005 kibana
useradd -u 1005 -g 1005 kibana
** https://www.elastic.co/downloads/kibana
cd /opt
wget https://download.elastic.co/kibana/kibana/kibana-4.3.1-linux-x64.tar.gz
tar vxf kibana-4.3.1-linux-x64.tar.gz
mv kibana-4.3.1-linux-x64 kibana
vi kibana/config/kibana.yml
server.host: "localhost"
chown -R kibana: /opt/kibana
cd /etc/init.d && sudo curl -o kibana https://gist.githubusercontent.com/thisismitch/8b15ac909aed214ad04a/raw/fc5025c3fc499ad8262aff34ba7fde8c87ead7c0/kibana-4.x-init
cd /etc/default && sudo curl -o kibana https://gist.githubusercontent.com/thisismitch/8b15ac909aed214ad04a/raw/fc5025c3fc499ad8262aff34ba7fde8c87ead7c0/kibana-4.x-default
sudo chmod +x /etc/init.d/kibana
sudo service kibana start
sudo chkconfig kibana on
Install Kibana Plugin Sense
cd /opt/kibana/bin
./kibana plugin --install elastic/sense
Install Nginx
** If selinux is enabled
sudo setsebool -P httpd_can_network_connect 1
yum -y install nginx httpd-tools
Create Password
htpasswd -c /etc/nginx/htpasswd.users kibanaadmin
comment out the entire 'server' block
vi /etc/nginx/nginx.conf
vi /etc/nginx/conf.d/kibana.conf
server {
listen 80;
server_name example.com;
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/htpasswd.users;
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;
}
}
Install Logstash
vi /etc/yum.repos.d/logstash.repo
[logstash-2.1]
name=logstash repository for 2.1 packages
baseurl=http://packages.elasticsearch.org/logstash/2.1/centos
gpgcheck=1
gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch
enabled=1
yum -y install logstash