Skip to content
Sébastien LUCAS edited this page May 28, 2013 · 14 revisions

Solr API

solr + jetty + drupal

Tutorials

http://19thstreetdesign.com/blog/2009.02.04/installing-apache-solr-drupal-6 http://drupal.org/node/1935934 https://www.digitalocean.com/community/articles/how-to-install-apache-tomcat-on-ubuntu-12-04

How to installing tomcat and Solr on Debian or Ubuntu

Tomcat

Step One—Install Tomcat

In some tuto it say to install tomcat7, In other 6, we will stay on 6 for now

Install Tomcat6 package

sudo apt-get install tomcat6

By default it runs on port 8080. If you need to change the port

edit /etc/tomcat6/server.xml

To change the default port here is a tuto http://www.mkyong.com/tomcat/how-to-change-tomcat-default-port/

Start the server

```/etc/init.d/tomcat6 start```

Step Two—Install Java

We installed the entire Apache Tomcat server on our virtual server in the previous step. Before we can use it, however, we do need to have Java installed on the VPS as well. If you currently do not have java, you can download it quite easily with apt-get.

sudo apt-get install default-jdk

Once you have Tomcat and Java installed on the virtual private server, all that remains is to start them.

Step Three—Configure .bashrc

In order to start Tomcat, we need to add it as an environment variable in the /.bashrc file. sudo nano ~/.bashrc

You can add this information to the end of the file:

export JAVA_HOME=/usr/lib/jvm/default-java
export CATALINA_HOME=~/path/to/tomcat

In my case with default tomcat installation on ubuntu

#https://www.digitalocean.com/community/articles/how-to-install-apache-tomcat-on-ubuntu-12-04
export JAVA_HOME=/usr/lib/jvm/default-java
export CATALINA_HOME=/usr/share/tomcat6

It can have this error

Using CATALINA_BASE:   /usr/share/tomcat6
Using CATALINA_HOME:   /usr/share/tomcat6
Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
Using JRE_HOME:        /usr/lib/jvm/default-java
Using CLASSPATH:       /usr/share/tomcat6/bin/bootstrap.jar
touch: cannot touch `/usr/share/tomcat6/logs/catalina.out': No such file or directory
/usr/share/tomcat6/bin/catalina.sh: 375: /usr/share/tomcat6/bin/catalina.sh: cannot create /usr/share/tomcat6/logs/catalina.out: Directory nonexistent

That can be fixed by creating the directory

 mkdir /usr/share/tomcat6/logs 

Save and exit out of .bashrc. You can make the changes effective by restarting the bashrc file.

. ~/.bashrc

Authorize connexion with the new 8081 port and IPTABLES

http://www.alsacreations.com/tuto/lire/622-Securite-firewall-iptables.html

Not as easy ! What does it mean localhost in a remote server, to be changed by server ip. Further more in other tuto found, need to install java, configure some variable in bashr https://www.digitalocean.com/community/articles/how-to-install-apache-tomcat-on-ubuntu-12-04

In this tuto #https://www.digitalocean.com/community/articles/how-to-install-apache-tomcat-on-ubuntu-12-04 export JAVA_HOME=/usr/lib/jvm/default-java export CATALINA_HOME=/usr/share/tomcat6

and go to http://localhost:8080 You should see the defaut Tomcat page


Solr

Download apache Solr http://apache.crihan.fr/dist/lucene/solr/ (version 3.6.x)

wget http://apache.crihan.fr/dist/lucene/solr/3.6.1/apache-solr-3.6.1.tgz

Untar

tar xvzf apache-solr-3.6.1.tgz

Create the $SOLR_HOME directory


mkdir /opt/solr
mkdir /opt/
mkdir /opt//solr

From the apache-solr directory copy the war file


sudo cp /path/to/apache-solr-3.6.1/dist/apache-solr-3.6.1.war /opt/solr/

Note that the war file must be renamed

Copy the solr home from the example folder for Solr download


sudo cp -r /path/to/apache-solr-3.6.1/example/solr/ /opt/solr/

Create the data directory


sudo mkdir /opt/solr//solr/data

Change the permission for the tomcat6 user


sudo chown tomcat6: -R /opt/solr//solr/data

Create your context :


edit /etc/tomcat6/Catalina/localhost/.xml

and add:

<code xml>
    code class="xml">
    <?xml version="1.0" encoding="utf-8"?>
    <Context docBase="/opt/solr/<PROJECT_NAME>/solr.war" debug="0" crossContext="true">
    <Environment name="solr/home" type="java.lang.String" value="/opt/solr/<PROJECT_NAME>/solr" override="true"/>
    </Context>
</code>
restart tomcat
/etc/init.d/tomcat6 restart

You are done. You should have the admin of Solr here localhost:8080/<project_name>/admin

WIKI by Sébastien Lucas CEO & Funder or Bricks

Clone this wiki locally