Alfresco 5.0.d – Installing SOLR 4 from scratch

SOLR 4 artifacts can be downloaded individually from Alfresco Wiki at Community file list page:

These artifacts are enough to install SOLR in a different Tomcat from Alfresco, apart from a standard Apache Tomcat 7 distribution.

For this blog post, Java 8 and a running Alfresco 5.0.d installed in /opt/alfresco running in port 8080 is required.

Installing Tomcat 7

Create a working directory and unzip Tomcat 7 software.

$ mkdir /opt/alfresco-solr4-5
$ cd /opt
$ cp alfresco-solr4-5
$ cd alfresco-solr4-5
$ unzip apache-tomcat-7.0.69
$ mv apache-tomcat-7.0.69 tomcat

Copy SOLR 4 web application by using solr4.war name.

$ cp alfresco-solr4-5.0.d.war /opt/alfresco-solr4-5/tomcat/webapps/solr4.war

Configure Tomcat to run in port 9XXX and to use Alfresco keystore.

<?xml version='1.0' encoding='utf-8'?>
<Server port="9005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
    <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" />
  <Service name="Catalina">
    <Connector port="9080" URIEncoding="UTF-8" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="9443" maxHttpHeaderSize="32768" />
    <Connector port="9009" URIEncoding="UTF-8" protocol="AJP/1.3" redirectPort="9443" />

    <Connector port="9443" URIEncoding="UTF-8" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true" maxThreads="150" scheme="https" keystoreFile="/opt/alfresco/alf_data/keystore/ssl.keystore" keystorePass="kT9X6oe68t" keystoreType="JCEKS" secure="true" connectionTimeout="240000" truststoreFile="/opt/alfresco/alf_data/keystore/ssl.truststore" truststorePass="kT9X6oe68t" truststoreType="JCEKS" clientAuth="want" sslProtocol="TLS" allowUnsafeLegacyRenegotiation="true" maxHttpHeaderSize="32768" />  

    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>

      <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />



Configuring SOLR cores

Create space to store SOLR indexes.

$ mkdir /opt/alfresco-solr4-5/alf_data/solr4

Copy SOLR cores configuration

$ unzip /opt/alfresco-solr4-5/solr4

Configure each SOLR core to use that space.

$ vi /opt/alfresco-solr4-5/solr4/archive-SpacesStore/conf/


$ vi /opt/alfresco-solr4-5/solr4/workspace-SpacesStore/conf/



Configuring SOLR software

Create SOLR configuration for Tomcat web application.

$ vi /opt/alfresco-solr4-5/tomcat/conf/Catalina/localhost/solr4.xml
<?xml version="1.0" encoding="utf-8"?>
<Context debug="0" crossContext="true">
  <Environment name="solr/home" type="java.lang.String" value="/opt/alfresco-solr4-5/solr4" override="true"/>
  <Environment name="solr/model/dir" type="java.lang.String" value="/opt/alfresco-solr4-5/alf_data/solr4/model" override="true"/>
  <Environment name="solr/content/dir" type="java.lang.String" value="/opt/alfresco-solr4-5/alf_data/solr4/content" override="true"/>

Adjusting Alfresco configuration

Alfresco properties file have to be modified in order to use that new SOLR by editing these lines in /opt/alfresco/tomcat/shared/classes/

### Solr indexing ###

Original Alfresco resources for SOLR (configuration, contents and web app) can be removed from this installation, as SOLR will run in a different app server.

$ rm -rf /opt/alfresco/solr4
$ rm -rf /opt/alfresco/alf_data/solr4
$ rm -rf /opt/alfresco/tomcat/webapps/solr4.war
$ rm -rf /opt/alfresco/tomcat/webapps/solr4

Restart Alfresco after.

$ /opt/alfresco/ restart


Testing configuration

Start Tomcat

$ /opt/alfresco-solr4-5/tomcat/bin/ start

You will be able to index and search in your main Alfresco installation at http://localhost:8080/share and your SOLR web console will be available at https://localhost:9443/solr4.

This method can be applied with minor changes to other Alfresco CE 5.X releases.


2 thoughts on “Alfresco 5.0.d – Installing SOLR 4 from scratch

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s