- 25 views
It is crucial for you to install Apache Solr 7.7.0! Not higher version (currently Solr 8.9), because Drupal 7 will not work with higher version at all!
1.1. Install Java
Install Java.
$ sudo apt install default-jdk -y
Verify the Java installation.
$ java -version
1.2. Install Apache Solr
To download the latest version of Apache Solr, go to the Apache official download website.
Download Apache Solr.
$ sudo wget https://archive.apache.org/dist/lucene/solr/7.7.0/solr-7.7.0.tgz
Extract the downloaded archives.
$ sudo tar xzf solr-7.7.0.tgz
Install Apache Solr.
$ sudo bash solr-7.7.0/bin/install_solr_service.sh solr-7.7.0.tgz
Check the status of the Apache Solr service.
$ sudo systemctl status solr
Enable the Apache Solr service to start on system boot.
$ sudo systemctl enable solr
Allow port 8983
through the UFW firewall.
$ sudo ufw allow 8983
To access the Apache Solr web interface, go to your browser and enter http://serverIP:8983
. For example:
http://192.0.2.11:8983
Do not use build-in GUI of Apache Solr on port 8983. While I believe it might work, for me it did not and yielded a few errrors. It is easier to do it in terminal.
The core needs to be created under the user "solr". Use the following command:
sudo -u solr ./bin/solr create -c mycore
This step was crucial and I only happened to stumble upon solution in this issue thread:
3.1. Copy all configuration files from the module folder (search_api_solr/solr-conf/7.x) to {solr_installation_folder}/server/solr/{core_name}/conf folder
- For me I needed to copy from "/var/www/clients/client1/web67/web/sites/all/modules/search_api_solr/solr-conf/7.x" to "/var/solr/data/mycore/conf"
3.2. Restart solr server using command:
Sudo service solr restart
Steps from there are pretty much easy.
4.1. Go to /admin/config/search/search_api in your website and hit "Add server".
4.2. Select Solr service under Service Class selection box
4.3. Creditials:
- HTTP protocol leave at "http"
- Solr host have to be IP address of your server (or localhost, if you are developing locally)
- Solr port is default 8983
- Solr path is /solr/mycore
While generally speaking version 7.7.0 is not secure enough and you will need to do some patching yourself because of security holes, you can at least get rid of Apache Solr GUI on URL http://your_server_ip:8983/solr/
5.1. Open the file /etc/default/solr.in.sh
5.2. Add the following line at the very end of the file:
SOLR_OPTS="$SOLR_OPTS -Djetty.host=127.0.0.1"
5.3. Restart Apache Solr using the command:
Sudo service solr restart
This will prevent people from visiting your admin GUI for apache Solr. You can always SSH tunnel yourself in so you can visit this URL safely, or you can simply remove the line and reload Solr temporarily.