diff --git a/SolrUbuntu.md b/SolrUbuntu.md new file mode 100644 index 0000000..b16c660 --- /dev/null +++ b/SolrUbuntu.md @@ -0,0 +1,120 @@ +# SOLR + +## Installation SOLR + ++ `cd /opt/` ++ Download solr source code:\ +`sudo wget https://www-eu.apache.org/dist/lucene/solr/7.7.3/solr-7.7.3.tgz` ++ extract compressed source code: +`sudo tar xzf solr-7.7.3.tgz solr-7.7.3/bin/install_solr_service.sh --strip-components=2` ++ run install script:\ +`sudo bash ./install_solr_service.sh solr-7.7.3.tgz` + +### Response + +id: ‘solr’: no such user\ +Creating new user: solr\ +Adding system user 'solr' (UID 123) ...\ +Adding new group 'solr' (GID 130) ...\ +Adding new user 'solr' (UID 123) with group 'solr' ...\ +Creating home directory '/var/solr' ... + +Extracting solr-7.7.3.tgz to /opt\ +Installing symlink /opt/solr -> /opt/solr-7.7.3 ...\ +Installing /etc/init.d/solr script ...\ +Installing /etc/default/solr.in.sh ... + +Service solr installed.\ +Customize Solr startup configuration in /etc/default/solr.in.sh + +check if solr service is running:\ +`sudo service solr status`\ +or via Solr Admin Panel:\ + + +## Configuration SOLR + +```bash +sudo mkdir -p /var/solr/data/tethys_data/conf +sudo mkdir -p /var/solr/data/tethys_data/data +``` + +**Configure Stopwords for your solr index**\ +Solr has the ability to read in a list of stop words, or words that should be ignored during indexing, so that those words do not clutter your index and are removed from influencing result relevancy. Add a list of common stop words to your stopwords.txt file.\ +`sudo nano /var/solr/data/tethys_data/conf/stopwords.txt`\ +So your file might look something like this: + +```ini +#Stopwords for example.com +a +an +and +are +as +at +be +but +by +for +if +... +``` + +**Configure Synonyms for your solr index**\ +`sudo nano /var/solr/data/tethys_data/conf/synonyms.txt` + +```ini +# Synonym mappings can be used for spelling correction too +pixima => pixma +``` + +**Copy your model schema.xml and solrconfig into conf folder:** + +download the cofig files: + +```bash +wget https://raw.githubusercontent.com/geolba/tethys-search/master/schema.xml +wget https://raw.githubusercontent.com/geolba/tethys-search/master/solrconfig.xml +``` + +move them into the conf directory: + +```bash +sudo mv /home/user/schema.xml /var/solr/data/tethys_data/conf/ +sudo mv /home/user/solrconfig.xml /var/solr/data/tethys_data/conf/ +``` + +**Grant folder permissions for solr user**\ +`sudo chown -R solr:solr /var/solr/data/tethys_data/` + +**Create solr index (c = Collection name; d = folder name)**\ +`sudo su - solr -c "/opt/solr/bin/solr create -c tethys_data -d /var/solr/data/tethys_data/ -n /var/solr/data/tethys_data/conf/"` + +Output Will be:\ +Created new core 'tethys_data' + +## Manage Solr service + +```bash +sudo service solr status +sudo service solr start +sudo service solr stop +``` + +## Uninstall SOLR + +delete your solr index:\ +`sudo su - solr -c "/opt/solr/bin/solr delete -c tethys_data"` + +```bash +sudo service solr stop +sudo rm -r /var/solr +sudo rm -r /opt/solr-7.7.3 +sudo rm -r /opt/solr +sudo rm -r /opt/solr-7.7.3.tgz +sudo rm /opt/install_solr_service.sh +sudo rm /etc/init.d/solr +sudo rm /etc/default/solr.in.sh +sudo deluser --remove-home solr +sudo deluser --group solr +```