Xenforo Enhanced Search depends on ElasticSearch 2.0+. Installing and configuring ElasticSearch so it works with XF might be a challenge, so I have put together some quick instructions for installing it on CentOS 7. With some tweaks the instructions should probably work on other versions of CentOS/Fedora/Redhat and derived distros as well.
All the commands assume you are the root user or that you run the instructions with sudo.
We'll install the ElasticSearch yum repo so that you can easily get patch/bugfix updates with "yum update".
First install the ElasticSearch GPG key:
Then create the yum repo file for ElasticSearch 7:
Then do the actual installation:
By default on CentOS 7, SELinux is running in enforcing mode. So we need to tell SELinux that the web server (Apache, Nginx or something else) should be allowed to talk to ElasticSearch over TCP:
We'll now make some config changes to the main ElasticSearch config file. We want a name for the cluster, and we'll set the host, TCP port and enable the security settings so we can later set passwords.
Start ElasticSearch - this might take a few seconds:
It's good practice to create a password for ElasticSearch, and there are plenty of examples of ElasticSearch instances that were hacked because they didn't create passwords. (It's also a good idea have a firewall and not to open the ElasticSearch port to the Internet!) So let's create those passwords now - you'll be prompted to type in passwords for 7 or so users. Make sure to note down these passwords! You'll need the 'elastic' user and password when you configure Enhanced Search in the XF admin CP.
The final installation step is to configure ElasticSearch to start whenever the machine boots up:
Now you can verify that ElasticSearch is up and running as expected with:
... which should give output similar to this:
All the commands assume you are the root user or that you run the instructions with sudo.
We'll install the ElasticSearch yum repo so that you can easily get patch/bugfix updates with "yum update".
First install the ElasticSearch GPG key:
Bash:
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
Bash:
cat > /etc/yum.repos.d/elasticsearch.repo <<EOF
[elasticsearch]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF
Bash:
yum install elasticsearch
Bash:
setsebool httpd_can_network_connect on -P
Bash:
cat > /etc/elasticsearch/elasticsearch.yml <<EOF
cluster.name: elasticxf
network.host: 127.0.0.1
http.port: 9200
xpack.security.enabled: true
EOF
Bash:
systemctl start elasticsearch.service
Bash:
/usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive
Bash:
systemctl daemon-reload
systemctl enable elasticsearch.service
Bash:
curl -u elastic -X GET "localhost:9200/?pretty"
Bash:
{
"name" : "localhost.localdomain",
"cluster_name" : "elasticxf",
"cluster_uuid" : "sSvt41vAS8i6Z1RRFI5V4w",
"version" : {
"number" : "7.8.0",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "757314695644ea9a1dc2fecd26d1a43856725e65",
"build_date" : "2020-06-14T19:35:50.234439Z",
"build_snapshot" : false,
"lucene_version" : "8.5.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}