Skip to content

Instantly share code, notes, and snippets.

@jessemartinez
Last active May 1, 2023 15:58
Show Gist options
  • Save jessemartinez/f6bd547dfbe0ce935dda9e3132025473 to your computer and use it in GitHub Desktop.
Save jessemartinez/f6bd547dfbe0ce935dda9e3132025473 to your computer and use it in GitHub Desktop.
Install Solr 8.11.2 for ASpace

Install Solr

The following instructions are derived from the official Solr installation documentation: https://solr.apache.org/guide/8_11/taking-solr-to-production.html

Create the solr user

Use whatever method your OS requires.

sudo adduser solr

Automatic installation

This runs the automatic Solr installer. This will install Solr at /opt/solr and SOLR_HOME at /var/solr, and will install Solr as a systemd service.

cd /opt
sudo wget https://archive.apache.org/dist/lucene/solr/8.11.2/solr-8.11.2.tgz
sudo tar xzf solr-8.11.2.tgz solr-8.11.2/bin/install_solr_service.sh --strip-components=2
sudo ./install_solr_service.sh solr-8.11.2.tgz -i /opt -d /var/solr -u solr -s solr -p 8983

Manual installation

The automatic installation is preferred. The following steps may be incomplete. See the Solr documentation for full installation options and details.

cd /opt
sudo wget https://archive.apache.org/dist/lucene/solr/8.11.2/solr-8.11.2.zip
sudo unzip solr-8.11.2.zip
sudo rm solr-8.11.2.zip
sudo ln -s /opt/solr-8.11.2 /opt/solr

Add environmental variables

You will likely need to add these environmental variables to the solr user's .bashrc or .bash_profile.

SOLR_PID_DIR=/var/solr
SOLR_HOME=/var/solr/data

Change Solr file permissions

Note
Replace staff in solr:staff with the appropriate group account, or leave the entire string as solr
sudo chown -R solr:staff /opt/solr*
sudo chmod -R g+rw /opt/solr*

Add Solr as a service

sudo vi /etc/systemd/system/solr.service

Copy the following text.

[Unit]
Description=Apache SOLR
 
[Service]
Type=forking
User=solr
Environment=SOLR_INCLUDE=/opt/solr/bin/solr.in.sh
ExecStart=/opt/solr/bin/solr start
ExecStop=/opt/solr/bin/solr stop
Restart=on-failure
LimitNOFILE=65000
LimitNPROC=65000
TimeoutSec=180s
 
[Install]
WantedBy=multi-user.target

Then activate the new service.

sudo systemctl daemon-reload
sudo systemctl enable solr
sudo systemctl start solr

Copy over ASpace Solr conf files

Note
Replace /apps/archivesspace/solr/ with the location of your ASpace instance
sudo mkdir -p /opt/solr-8.11.2/server/solr/configsets/archivesspace/conf
sudo cp -a /apps/archivesspace/solr/* /opt/solr-8.11.2/server/solr/configsets/archivesspace/conf

Restart Solr

Restart Solr as systemd service.

sudo systemctl restart solr

or

sudo su - solr
cd /opt/solr
bin/solr stop
bin/solr start

Add new Solr core

sudo su - solr
cd /opt/solr
bin/solr create -c archivesspace -d archivesspace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment