How to install Latest version of Apache Solr on Ubuntu and how to uninstall

How to install Latest version of Apache Solr on Ubuntu and how to uninstall (remove) completely


Solution 1:

An older version of solr

An older version of solr-tomcat and solr-jetty is in the Ubuntu Universe repositiories, for a newer version see below.

sudo add-apt-repository universe

For Tomcat

sudo apt-get install solr-tomcat

For Jetty

sudo apt-get install solr-jetty

Open the URL http://localhost:8080/solr/admin/, if your tomcat is listen on port 8080.


Uninstall

sudo apt-get remove solr-tomcat
sudo apt-get remove solr-jetty

A newer version of solr

Use the manual installation for a newer version, check the latest version here and replace the version in the commands below, for old versions check here

cd ~
wget http://archive.apache.org/dist/lucene/solr/5.3.1/solr-5.3.1.tgz
tar xzf solr-5.3.1.tgz solr-5.3.1/bin/install_solr_service.sh --strip-components=2
sudo chmod +x install_solr_service.sh
sudo ./install_solr_service.sh solr-5.3.1.tgz

Open the URL http://your_server_ip:8983/solr

More details


Uninstall via

sudo service solr stop
sudo rm -r /var/solr
sudo rm -r /opt/solr-5.3.1
sudo rm -r /opt/solr
sudo rm /etc/init.d/solr
sudo deluser --remove-home solr
sudo deluser --group solr

For a better explanation of the uninstall steps, read my answer here.