Skip to content

Installation: solr 4.2

afred edited this page Jun 18, 2014 · 18 revisions

Notes

Solr indexes the content and metadata of your HydraDAM for quick and easy searching.

Steps

We recommend installing all the components of the project in the directory /opt and as a result these instructions are designed to be copy/paste. However, if you want to name your project something other than 'hydradam' you'll need to make appropriate changes in steps 4 and 12. These instructions have been tested with solr 4.2 and may or may not work with later versions.

All commands are run in a terminal window unless otherwise specified.

  1. Change the directory to the install directory.
mkdir -p /opt/install && cd /opt/install
  1. Download solr 4.2.
wget http://archive.apache.org/dist/lucene/solr/4.2.0/solr-4.2.0.tgz
  1. Unpack the tarball.
tar xvzf solr-4.2.0.tgz
  1. Double-check that your $HYDRA_NAME variable is set correctly.
echo $HYDRA_NAME
# should output "hydradam"
  1. Create the solr project directories.
mkdir /opt/solr /opt/solr/$HYDRA_NAME /opt/solr/$HYDRA_NAME/lib
  1. Put the solr .war file in the main project directory
cp ./solr-4.2.0/dist/solr-4.2.0.war /opt/solr/$HYDRA_NAME
  1. Copy the necessary java archives to the library
sudo cp ./solr-4.2.0/dist/*.jar /opt/solr/$HYDRA_NAME/lib
  1. Copy the contrib subdirectory.
sudo cp -r ./solr-4.2.0/contrib /opt/solr/$HYDRA_NAME/lib
  1. Copy the sample collection1 directory to production.
sudo cp -r ./solr-4.2.0/example/solr/collection1 /opt/solr/$HYDRA_NAME/collection1
  1. Copy the English stopwords up a level.
sudo cp /opt/solr/$HYDRA_NAME/collection1/conf/lang/stopwords_en.txt /opt/solr/$HYDRA_NAME/collection1/conf/
  1. Create the project xml file.
cat > /opt/solr/$HYDRA_NAME/$HYDRA_NAME.xml <<EOF
<?xml version="1.0" encoding="utf-8"?>  
<Context docBase="/opt/solr/hydradam/solr-4.2.0.war" debug="0" crossContext="true">  
    <Environment name="solr/home" type="java.lang.String" value="/opt/solr/hydradam" override="true"/>  
</Context>
EOF
  1. Give the tomcat user ownership of /opt/solr. On Ubuntu:
# If you are using Ubuntu, use this command.
sudo chown -R tomcat7:tomcat7 /opt/solr

# If you are using CentOS, use this command.
sudo chown -R tomcat:tomcat /opt/solr
  1. Link tomcat to the project xml file.
# If you using Ubuntu, use this command
sudo ln -s /opt/solr/$HYDRA_NAME/$HYDRA_NAME.xml /etc/tomcat/Catalina/localhost/$HYDRA_NAME.xml

# If you are using CentOS, use this command
sudo ln -s /opt/solr/$HYDRA_NAME/$HYDRA_NAME.xml /etc/tomcat6/Catalina/localhost/$HYDRA_NAME.xml
  1. Restart tomcat.
    # If you are using Ubuntu, use this command
    sudo service tomcat7 restart
    
    # If you are using CentOS, use this command
    sudo service tomcat6 restart

The final output for step 3 and on above should look like this:

[your_username@ip install]$ mkdir /opt/solr /opt/solr/$HYDRA_NAME /opt/solr/$HYDRA_NAME/lib  
[your_username@ip install]$ cp ./solr-4.2.0/dist/solr-4.2.0.war /opt/solr/$HYDRA_NAME  
[your_username@ip install]$ sudo cp ./solr-4.2.0/dist/*.jar /opt/solr/$HYDRA_NAME/lib  
[your_username@ip install]$ sudo cp -r ./solr-4.2.0/contrib /opt/solr/$HYDRA_NAME/lib  
[your_username@ip install]$ sudo cp -r ./solr-4.2.0/example/solr/collection1 /opt/solr/$HYDRA_NAME/collection1  
[your_username@ip install]$ sudo cp /opt/solr/$HYDRA_NAME/collection1/conf/lang/stopwords_en.txt /opt/solr/$HYDRA_NAME/collection1/conf/  
[your_username@ip install]$ cat > /opt/solr/$HYDRA_NAME/$HYDRA_NAME.xml <<EOF  
> <?xml version="1.0" encoding="utf-8"?>  
> <Context docBase="/opt/solr/hydradam/solr-4.2.0.war" debug="0" crossContext="true">  
>     <Environment name="solr/home" type="java.lang.String" value="/opt/solr/hydradam" override="true"/>  
> </Context>  
> EOF  

[your_username@ip install]$ sudo chown -R tomcat:tomcat /opt/solr  
[your_username@ip install]$ sudo service tomcat6 restart  
Stopping tomcat6:                                          [  OK  ]  
Starting tomcat6:                                          [  OK  ]  

Verification Steps

  1. Check the solr admin page.
curl localhost:8080/$HYDRA_NAME/

The output should show the html of the solr home page, an excerpt of which is shown below.

</head>  
<body>  

  <div id="wrapper">

    <div id="header">

      <a href="./" id="solr"><span>Apache SOLR</span></a>

      <p id="environment">&nbsp;</p>

    </div>

    <div id="main" class="clearfix">

      <div id="init-failures">

          <h2>SolrCore Initialization Failures</h2>
          <ul></ul>
          <p>Please check your logs for more information</p>

      </div>

      <div id="content-wrapper">
        <div id="content">

          &nbsp;

        </div>
      </div>

Next Step

Proceed to Install Redis or return to the Overview page.

Clone this wiki locally