Install Apache Solr on Ubuntu

Installing Solr using apt-get (easy way)

Solr doesn't work alone; it needs a Java servlet container such as Tomcat or Jetty. In this article, we'll use Jetty, although Tomcat is just as easy. First, we should install the Java JDK.

To install Open JDK 7

sudo apt-get -y install openjdk-7-jdk

Create a directory named 'java' into directory 'usr'

sudo mkdir /usr/java

Create a simple soft link for folder /usr/lib/jvm/java-7-openjdk-amd64 as /usr/java/default

sudo ln -s /usr/lib/jvm/java-7-openjdk-amd64 /usr/java/default

Ubuntu provides 3 Solr packages by default:
     solr-common :  the package that contains the actual Solr code;
     solr-tomcat : Solr integrated with Tomcat; and
     solr-jetty : which is just like solr-tomcat but with the Jetty web server.

We will install solr-tomcat

sudo apt-get -y install solr-tomcat

You can now access your installation just as before at http://YOUR_IP:8983/solr
HOWEVER, in my case, it was installed on port 8080 So if above URL doesn't work, give a shot to http://YOUR_IP:8080/solr

Now, lets check Configuring a schema.xml for Solr

Execute following commands :

To change into the solr directory.

cd /usr/share/solr

Remove the data directory

sudo rm -R data

Take a backup of default schema file in same folder, not mandatory, but just in case.

sudo cp schema.xml schema_default.xml

Copy search_api_solr module's schema.xml into the deafult location of solr i.e. /usr/share/solr/conf

sudo cp -f /var/www/html/DrupalProjectFolder/sites/all/modules/contrib/search_api_solr/solr-conf/4.x/schema.xml /usr/share/solr/conf

Finally,  Restart tomcat server.

sudo service tomcat6 restart

When you now visit your Solr instance i.e. visit http://localhost:8080/solr/, you should see the Dashboard with the collection.

Reference
                https://www.digitalocean.com/community/tutorials/how-to-install-solr-on-ubuntu-14-04
                https://www.digitalocean.com/community/tutorials/how-to-install-solr-5-2-1-on-ubuntu-14-04

Add new comment