Install and configure solr Manually with Magento

solr

Install and configure solr Manually with Magento

Install solr in UBUNTU with command line. Please find below mentioned command for installation.

1
2
3
4
5
6
7
sudo apt-get -y install openjdk-7-jdk
cd /opt
sudo tar -xvf solr-4.7.2.tgz
sudo cp -R solr-4.7.2/example /opt/solr
cd /opt/solr
java -jar start.jar

Now check solr running on your server or not with http://yourip:8983

sudo vi /etc/default/jetty

Copy the below mentioned text into the file and press ESC the :wq and enter.

1
2
3
4
5
6
NO_START=0 # Start on boot
JAVA_OPTIONS="-Dsolr.solr.home=/opt/solr/solr $JAVA_OPTIONS"
JAVA_HOME=/usr/java/default
JETTY_HOME=/opt/solr
JETTY_USER=solr
JETTY_LOGS=/opt/solr/logs

Create one more file

1
sudo vi /opt/solr/etc/jetty-logging.xml

Copy the below mentioned text into the file and press ESC the :wq and enter.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<!-- =============================================================== -->
<!-- Configure stderr and stdout to a Jetty rollover log file -->
<!-- this configuration file should be used in combination with -->
<!-- other configuration files.  e.g. -->
<!--    java -jar start.jar etc/jetty-logging.xml etc/jetty.xml -->
<!-- =============================================================== -->
<Configure id="Server" class="org.mortbay.jetty.Server">
<New id="ServerLog" class="java.io.PrintStream">
<Arg>
<New class="org.mortbay.util.RolloverFileOutputStream">
<Arg><SystemProperty name="jetty.logs" default="."/>/yyyy_mm_dd.stderrout.log</Arg>
<Arg type="boolean">false</Arg>
<Arg type="int">90</Arg>
<Arg><Call class="java.util.TimeZone" name="getTimeZone"><Arg>GMT</Arg></Call></Arg>
<Get id="ServerLogName" name="datedFilename"/>
</New>
</Arg>
</New>
<Call class="org.mortbay.log.Log" name="info"><Arg>Redirecting stderr/stdout to <Ref id="ServerLogName"/></Arg></Call>
<Call class="java.lang.System" name="setErr"><Arg><Ref id="ServerLog"/></Arg></Call>
<Call class="java.lang.System" name="setOut"><Arg><Ref id="ServerLog"/></Arg></Call>
</Configure>

Now create solr user and permission :

sudo useradd -d /opt/solr -s /sbin/false solr
sudo chown solr:solr -R /opt/solr

create solr startup :

sudo wget -O /etc/init.d/jetty https://cheppers.com/sites/default/files/attachments/jetty_0.txt
sudo chmod a+x /etc/init.d/jetty
sudo update-rc.d jetty defaults

sudo /etc/init.d/jetty start

Now configuring the magento for Solr.

One thought on Install and configure solr Manually with Magento

Leave a comment