Solr

Dec 16, 2013
2 min read
May 27, 2023 09:13 EEST

Installation of Solr on FreeBSD in combination with jetty. I you have tomcat running I suggest you move to jetty. I assume you have already a running java environment (openjdk) running.

Install jetty:

cd /usr/ports/www/jetty/
make install
make clean
echo jetty_enable="YES" >> /etc/rc.conf
cp /usr/local/jetty/etc/jetty.xml /usr/local/etc/jetty.xml
echo "# Do not truncate command line arguments in ps(1) listing" >> /etc/sysctl.conf
echo kern.ps_arg_cache_limit=10000 >> /etc/sysctl.conf
/etc/rc.d/sysctl restart

and solr with:

cd /usr/ports/textproc/apache-solr
make install
make clean

Configure solr, I use only one database, but you can use as many as you want.

mkdir /usr/local/solr
cd !$
cp /usr/local/share/examples/apache-solr/solr/solr.xml .
chmod 664 solr.xml
chown -R www:www .

Edit solr.xml to have the following content:

<?xml version="1.0" encoding="UTF-8" ?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at
     http://www.apache.org/licenses/LICENSE-2.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.```
-->

<!--
   This is an example of a simple "solr.xml" file for configuring one or
   more Solr Cores, as well as allowing Cores to be added, removed, and
   reloaded via HTTP requests.
   More information about options available in this configuration file,
   and Solr Core administration can be found online:
   http://wiki.apache.org/solr/CoreAdmin```
-->

<!--
 All (relative) paths are relative to the installation path
  persistent: Save changes made via the API to this file
  sharedLib: path to a lib directory that will be shared across all cores```
-->
<solr persistent="false">

  <!--
  adminPath: RequestHandler path to manage cores.
    If 'null' (or absent), cores will not be manageable via request handler
  -->
  <cores adminPath="/admin/cores" sharedLib="lib">
    <core name="drupal" instanceDir="drupal" />
  </cores>```
</solr>

Next step is to create the folders and copy config files for all cores you have added:

mkdir -p drupal/conf
cd !$
cp -r /usr/local/share/examples/apache-solr/solr/conf/* ./
cd -
chown -R www:www *

Now we configure jetty to use Solr:

cd /usr/local/jetty/webapps/
ln -s /usr/local/share/java/classes/apache-solr-3.6.0.war solr.war
cd /usr/local/jetty
ln -s /usr/local/solr
service jetty restart

You should now get a Solr page by going to http://localhost:8080/solr/drupal/admin/.


Related Posts