Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Elastic search

317 views

Published on

Set up search engine of your own.

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Elastic search

  1. 1. Setting up Elastic Search on Ubuntu Server from scratch By: Rahul Agarwal Sr. web developer at Gaadi.com
  2. 2. Overview ● Requirement ● Solution ● Set up server ● Install Apache ● Install PHP,JAVA ● Install Elastic Search server,Composer ● Install Elastic Search PHP API ● Test php scripts with elastic search api
  3. 3. Requirement ● Setting Up Elastic Search on the server. With PHP and Apache server for front end connection. ● Setting up on Ubuntu server.
  4. 4. Solution ● Elastic Search configured on any new ubuntu server.
  5. 5. Set up server ● Configured new server. ● Run “sudo apt-get update" on server.
  6. 6. Install Apache ● Run “sudo apt-get install apache2"
  7. 7. Install PHP ● Run “sudo apt-get install php5 libapache2- mod-php5"
  8. 8. Restart Server ● Run “sudo service apache2 restart"
  9. 9. Test PHP ● Run “php -r 'echo "nnYour PHP installation is working fine.nnn";' "
  10. 10. Install Java ● Run “add-apt-repository -y ppa:webupd8team/java" ● Run "apt-get update" ● Run "apt-get install oracle-java8-installer"
  11. 11. Install ElasticSearch server ● Run “sudo wget -qO - https://packages.elastic.co/GPG-KEY- elasticsearch | sudo apt-key add -" ● Run "echo "deb http://packages.elastic.co/elasticsearch/2.x/ debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list" ● Run "sudo apt-get update" ● Run "sudo apt-get -y install elasticsearch"
  12. 12. Install ElasticSearch server ● Run "sudo nano /etc/elasticsearch/elasticsearch.yml" ● You will want to restrict outside access to your Elasticsearch instance (port 9200), so outsiders can't read your data or shutdown your Elasticsearch cluster through the HTTP API. Find the line that specifies network.host, uncomment it, and replace its value with "localhost" so it looks like this: ● network.host: localhost
  13. 13. Install ElasticSearch server ● Save and exit elasticsearch.yml. ● Run "sudo service elasticsearch restart" ● Then run the following command to start Elasticsearch on boot up: ● Run “ sudo update-rc.d elasticsearch defaults 95 10"
  14. 14. Set up Elastic Search PHP files ● Run "cd /var/www/html" ● Upload composer file “composer.json” on the folder /var/www/html ● Run ● curl -s http://getcomposer.org/installer | php ● php /root/composer.phar install –no-dev ● sudo apt-get install php5-curl ● sudo service apache2 restart
  15. 15. Test Elastic Search ● Run “curl -X GET 'http://localhost:9200' "
  16. 16. Test basic connection files ● Upload insert.php,out.txt,search.php on /var/www/html folder ● Go to browser and hit insert.php ● Go to browser and hit search.php and search google
  17. 17. Composer.json { "require": { "elasticsearch/elasticsearch": "~2.0" } }
  18. 18. Insert .php
  19. 19. Search . php
  20. 20. Out.txt

×