This is a step by step on how to setup Solr server running on Jetty on Ubuntu 10.04 LTS.
This step by step is written while setting up a solr server on a Linode server.
Set hostname
echo "your-hostname" > /etc/hostname hostname -F /etc/hostname
Modify /etc/hosts
vi /etc/hosts
Change to
127.0.0.1 localhost.localdomain localhost your.servers.ip your.domain.com your-hostname
Set timezone
dpkg-reconfigure tzdata
Setting Solr multi core, using this guide as base: http://tinyurl.com/2d367rz
Thank you Dave
Install Solr and Jetty
apt-get install solr-jetty openjdk-6-jdk
Configure Jetty
First backup default config
cp -a /etc/default/jetty /etc/default/jetty.bak
Modify /etc/default/jetty
vi /etc/default/jetty
Change NO_START=1 to NO_START=0 Set JETTY_HOST=your.domain.com (use the servers domain)
Configure Solr
create config file to enable multicore
vi /usr/share/solr/solr.xml
add to file:
<solr persistent="true" sharedLib="lib"> <cores adminPath="/admin/cores" shareSchema="true" adminHandler="au.com.davehall.solr.plugins.SolrCoreAdminHandler"> </cores> </solr>
Make jetty owner
chown jetty:jetty /usr/share/solr chown jetty:jetty /usr/share/solr/solr.xml chmod 640 /usr/share/solr/solr.xml mkdir /usr/share/solr/cores chown jetty:jetty /usr/share/solr/cores
Create symlink to centralize configs
ln -s /usr/share/solr/solr.xml /etc/solr/
Configure for drupal
backup first
mv /etc/solr/conf/schema.xml /etc/solr/conf/schema.orig.xml mv /etc/solr/conf/solrconfig.xml /etc/solr/conf/solrconfig.orig.xml
fetch the drupal solr module
wget http://ftp.drupal.org/files/projects/apachesolr-6.x-1.2.tar.gz (check d.o for latest version) tar xvzf apachesolr-6.x-1.2.tar.gz mv apachesolr/ drupal-apachesolr
copy drupal configs
cp /etc/solr/drupal-apachesolr/{schema,solrconfig}.xml /etc/solr/conf/
create each of the cores (add more for several domains)
mkdir -p /var/lib/solr/cores/{,subdomain_1_,subdomain_2_}your_domain_com/{data,conf} chown -R jetty:jetty /var/lib/solr/cores/{,subdomain_1_,subdomain_2_}your_domain_com
Finally fetch this plugin
mkdir /usr/share/solr/lib cd /usr/share/solr/lib
Cross your fingers everything is correct and start Jetty
/etc/init.d/jetty start
Goto http://tinyurl.com/cy4n8xw
Did it work? Yeah!
Create a core for domain: http://tinyurl.com/cesdfeg
SETUP SECURITY
Based on http://tinyurl.com/cg4sxlv
vi /etc/jetty/webdefault.xml
goto the very end
add just before closing web-app tag
<security-constraint> <web-resource-collection> <web-resource-name>Solr authenticated application</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> <role-name>solr-role</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>Solr Realm</realm-name> </login-config>
Set user and passwd
vi /etc/jetty/realm.properties
add
username: password, solr-role
modify /etc/jetty/jetty.xml
vi /etc/jetty/jetty.xml
Search for Configure Authentication Realms
modify Test Realm change it to Solr Realm
Stop and Start Jetty
$ /etc/init.d/jetty stop $ /etc/init.d/jetty start
Configure your ApacheSolr Drupal module with the following
Solr host name: username:password@your.domain.com Solr port: 8080 Solr path: /solr/your_core_name/
Hope you found this guide useful.
I also find the tips in this guide very usefull, http://tinyurl.com/ce66c2s
Add new comment