Get the most out of your Centmin Mod LEMP stack
Become a Member

Xenforo How To Install Elasticsearch 6.x for Xenforo

Discussion in 'Centmin Mod User Tutorials & Guides' started by Sunka, Nov 30, 2017.

  1. sepulchre

    sepulchre Member

    168
    22
    18
    Dec 22, 2014
    Ratings:
    +28
    Local Time:
    8:08 AM
    Can I use this tutorial for installing ES 7.4?

    Do I need to change anything? Will be my first go for ES.

     
  2. rdan

    rdan Well-Known Member

    5,446
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    3:08 PM
    Mainline
    10.2
  3. Andy

    Andy Active Member

    544
    89
    28
    Aug 6, 2014
    Ratings:
    +133
    Local Time:
    1:08 AM
    Updated to php 7.4.1 and elastic 7.5.1 and it fails to start.
    Anyone with issue?
     
  4. rdan

    rdan Well-Known Member

    5,446
    1,408
    113
    May 25, 2014
    Ratings:
    +2,201
    Local Time:
    3:08 PM
    Mainline
    10.2
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,647
    12,230
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,799
    Local Time:
    5:08 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah that is because Centmin Mod configures /tmp with noexec permissions for security
     
  6. Andy

    Andy Active Member

    544
    89
    28
    Aug 6, 2014
    Ratings:
    +133
    Local Time:
    1:08 AM
    It wasn't a problem until recently i believe. version 7.4 or so.
     
  7. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    3:08 PM
    Followed the procedure but I got error upon starting of elasticsearch..

    I got a fresh CentOS with CentminMOD and xenforo installed.

    Do I have do anything with firewall (csf)?
     
  8. pamamolf

    pamamolf Premium Member Premium Member

    4,084
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    9:08 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    If you are using Elastic on the same server as Xenforo then you don't have to open any ports.

    You may need to check the logs first and see what's the problem...

    Check at:
    Code:
    /var/log/elasticsearch/
    and run also:
    Code:
    journalctl -u elasticsearch --no-pager
    You should be able to get some info why it is not starting.
     
  9. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    3:08 PM
    Thanks for your reply.

    I started the test from a fresh server again.

    Code (Text):
    # yum remove elasticsearch
    Loaded plugins: fastestmirror, priorities, versionlock
    No Match for argument: elasticsearch
    No Packages marked for removal


    Code (Text):
    # rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch


    Create a file
    Code (Text):
    /etc/yum.repos.d/elasticsearch.repo
    with the following content:

    Code (Text):
    cat /etc/yum.repos.d/elasticsearch.repo
    [elasticsearch-6.x]
    name=Elasticsearch repository for 6.x packages
    baseurl=https://artifacts.elastic.co/packages/6.x/yum
    gpgcheck=1
    gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
    enabled=1
    autorefresh=1
    type=rpm-md


    No java installed:

    Code (Text):
    # java -version
    -bash: java: command not found


    Now install java:

    Code (Text):
    # yum -y install java-1.8.0-openjdk
    Loaded plugins: fastestmirror, priorities, versionlock
    Loading mirror speeds from cached hostfile
     * base: mirror.0x.sg
     * centos-sclo-rh: mirror.0x.sg
     * centos-sclo-sclo: mirror.0x.sg
     * epel: epel.dionipe.id
     * extras: mirror.newmediaexpress.com
    ...
    ...
    ...
    
    Installed:
      java-1.8.0-openjdk.x86_64 1:1.8.0.242.b08-0.el7_7                                          
    
    Dependency Installed:
      copy-jdk-configs.noarch 0:3.3-10.el7_5                                                    
      giflib.x86_64 0:4.1.6-9.el7                                                                
      java-1.8.0-openjdk-headless.x86_64 1:1.8.0.242.b08-0.el7_7                                
      javapackages-tools.noarch 0:3.4.1-11.el7                                                  
      libXtst.x86_64 0:1.2.3-1.el7                                                              
      lksctp-tools.x86_64 0:1.0.17-2.el7                                                        
      pcsc-lite-libs.x86_64 0:1.8.8-8.el7                                                        
      python-javapackages.noarch 0:3.4.1-11.el7                                                  
      python-lxml.x86_64 0:3.2.1-4.el7                                                          
      ttmkfdir.x86_64 0:3.0.9-42.el7                                                            
      tzdata-java.noarch 0:2019c-1.el7                                                          
      xorg-x11-fonts-Type1.noarch 0:7.5-9.el7                                                    
    
    Complete!
    


    Now install elasticsearch:

    Code (Text):
    # yum -y install elasticsearch
    Loaded plugins: fastestmirror, priorities, versionlock
    Loading mirror speeds from cached hostfile
     * base: mirror.0x.sg
     * centos-sclo-rh: mirror.0x.sg
     * centos-sclo-sclo: mirror.0x.sg
    
    ...
    ...
    ...
    
    Installed:
      elasticsearch.noarch 0:6.8.7-1                                                            
    
    Complete!
    


    Add the following 3 lines at the end of the file /etc/elasticsearch/elasticsearch.yml:

    Code (Text):
    # tail /etc/elasticsearch/elasticsearch.yml
    #
    # ---------------------------------- Various -----------------------------------
    #
    # Require explicit names when deleting indices:
    #
    #action.destructive_requires_name: true
    
    cluster.name: my_elastic
    network.host: localhost
    http.port: 9200


    I skipped the RAM setup in post #1 for now.

    Code (Text):
    # mkdir /etc/elasticsearch/scripts/
    


    Then:

    Code (Text):
    # cp -a /home/nginx/domains/mydomain.com/public/library/XenES/_scripts/*.groovy /etc/elasticsearch/scripts/
    cp: cannot stat ‘/home/nginx/domains/mydomain.com/public/library/XenES/_scripts/*.groovy’: No such file or directory
    


    There's no such directory "library/XenES/.." in /public/ or /public/forum

    Skipped the above.

    Start elasticsearch:

    Code (Text):
    # service elasticsearch start
    Starting elasticsearch (via systemctl):                    [  OK  ]


    Then:
    Code (Text):
    # systemctl daemon-reload


    Then:
    Code (Text):
    # systemctl enable elasticsearch.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/elasticsearch.service to /usr/lib/systemd/system/elasticsearch.service.
    


    Then:
    Code (Text):
    # systemctl start elasticsearch.service


    Then: (after waiting for 3 minutes according to post #1)
    Code (Text):
    # curl -XGET 'localhost:9200'
    {
      "name" : "L7Ob0XF",
      "cluster_name" : "my_elastic",
      "cluster_uuid" : "BhSLEiweRvxxxxutopkJWw",
      "version" : {
        "number" : "6.8.7",
        "build_flavor" : "default",
        "build_type" : "rpm",
        "build_hash" : "c63e621",
        "build_date" : "2020-02-26T14:38:01.193138Z",
        "build_snapshot" : false,
        "lucene_version" : "7.7.2",
        "minimum_wire_compatibility_version" : "5.6.0",
        "minimum_index_compatibility_version" : "5.0.0"
      },
      "tagline" : "You Know, for Search"
    }
    


    HEY it actually WORKS this time!!!

    QUESTION:

    1) What's the purpose of the cp -a line above for? Can I just skip it? If not, how do I fix it?

    2) Is it necessary for me to upgrade to elasticsearch 7.6 if what I'm doing with elasticsearch is installing enhancedsearch add-on and other add-ons that might depend on it? Any significant performance gain or features gain? How do I upgrade from 6.x to 7.x?

    3) is it really necessary to setup the RAM? how much is advised?

    MANY thanks for your help!!!!

    TIP: If you want to do the CODE with black background and white text, you have to use the CODEb tag:

    CODEb]text text text[/CODEb
     
    Last edited: Mar 5, 2020
  10. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    8:08 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    It is needed for xf1, you can skeep it if you have xf2

    I installed v.7 few days ago, after many, many tries, errors.
    For me, it is better to do clean install. rRemoving older elasticsearch before. Also I updated java to v11
    If I find time, I will write my tutorial for version 7

    It depends how much, but 512 mb os enough for site with 1 million posts
     
  11. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    3:08 PM
    Any quick hint? I may try to do it on a fresh server tomorrow.
     
  12. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    8:08 AM
    Nginx 1.17.9
    MariaDB 10.3.22
    I will try to post it tonight
     
  13. modder

    modder Member

    117
    16
    18
    Dec 6, 2019
    Ratings:
    +27
    Local Time:
    3:08 PM
    Yaah. Make a new thread for 7.x please.
     
  14. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    8:08 AM
    Nginx 1.17.9
    MariaDB 10.3.22
  15. deltahf

    deltahf Premium Member Premium Member

    587
    265
    63
    Jun 8, 2014
    Ratings:
    +489
    Local Time:
    2:08 AM
    Elasticsearch was working fine on my Vultr staging server, but after restoring the system image (yes, it was an image created while the machine was turned off), I found that Elasticsearch was no longer working.

    Now, when I try to reinstall it following these instructions, I'm getting this weird failure from yum:

    Code (Text):
    $ yum -y install elasticsearch
    Loaded plugins: fastestmirror, priorities, versionlock
    Loading mirror speeds from cached hostfile
     * base: centos.mirror.constant.com
     * centos-sclo-rh: mirror.metrocast.net
     * centos-sclo-sclo: mirror.atlanticmetro.net
     * epel: epel.mirror.constant.com
     * extras: nyc.mirrors.clouvider.net
     * rpmforge: mirror.teklinks.com
     * updates: repos-va.psychz.net
    328 packages excluded due to repository priority protections
    Excluding 4 updates due to versionlock (use "yum versionlock status" to show them)
    Resolving Dependencies
    --> Running transaction check
    ---> Package elasticsearch.noarch 0:6.8.13-1 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    =========================================================================================================================================
     Package                           Arch                       Version                        Repository                             Size
    =========================================================================================================================================
    Installing:
     elasticsearch                     noarch                     6.8.13-1                       elasticsearch-6.x                     142 M
    
    Transaction Summary
    =========================================================================================================================================
    Install  1 Package
    
    Total download size: 142 M
    Installed size: 229 M
    Downloading packages:
    elasticsearch-6.8.13.rpm                                                                                          | 142 MB  00:00:02
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : elasticsearch-6.8.13-1.noarch                                                                                         1/1
    Error unpacking rpm package elasticsearch-6.8.13-1.noarch
    warning: /etc/elasticsearch/elasticsearch.yml created as /etc/elasticsearch/elasticsearch.yml.rpmnew
    error: unpacking of archive failed on file /usr/share/elasticsearch/LICENSE.txt;60024f3f: cpio: open
      Verifying  : elasticsearch-6.8.13-1.noarch                                                                                         1/1
    
    Failed:
      elasticsearch.noarch 0:6.8.13-1
    
    Complete!
    


    I tried the instructions on another machine and it worked fine, so I don't think there's anything wrong with the repo... this just seems to be an issue with my staging box.

    Any ideas?
     
  16. Itworx4me

    Itworx4me Active Member

    312
    28
    28
    Mar 14, 2017
    Ratings:
    +51
    Local Time:
    11:08 PM
    Nginx 1.25.X
    MariaDB 10.6.X
    Try this code and than reinstall.
    Code (Text):
    yum remove elasticsearch
     
  17. deltahf

    deltahf Premium Member Premium Member

    587
    265
    63
    Jun 8, 2014
    Ratings:
    +489
    Local Time:
    2:08 AM
    Thanks, unfortunately I have tried uninstalling and a full reinstall, but it didn’t help.