Installing Apache Solr in Ubuntu 22.04
The following tutorial describes how to install Apache Solr in Ubuntu in a few simple steps 22.04.
We will do everything through the terminal in a few minutes.
First, we install Java.
We run a terminal and issue the command:
1 | apt-get install default-jdk -y |
we check the java version by issuing the command:
1 | java -version |
1 2 3 | openjdk version "11.0.15" 2022-04-19 OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1) OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1, mixed mode, sharing) |
We download Apache Solr and unpack it:
1 | wget https://downloads.apache.org/lucene/solr/8.11.1/solr-8.11.1.tgz |
1 | tar -xvzf solr-8.11.1.tgz |
we run the installation script:
1 | ./solr-8.11.1/bin/install_solr_service.sh solr-8.11.1.tgz |
If everything went ok, we should see the messages:
1 2 3 4 5 6 7 8 9 10 11 12 | Service solr installed. Customize Solr startup configuration in /etc/default/solr.in.sh ? solr.service - LSB: Controls Apache Solr as a Service Loaded: loaded (/etc/init.d/solr; generated) Active: active (exited) since Sat 2022-05-06 03:00:19 UTC; 5s ago Docs: man:systemd-sysv-generator(8) Process: 4692 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS) Jul 25 03:00:09 ubuntu2204 systemd[1]: Starting LSB: Controls Apache Solr as a Service... Jul 25 03:00:09 ubuntu2204 su[4694]: (to solr) root on none Jul 25 03:00:09 ubuntu2204 su[4694]: pam_unix(su-l:session): session opened for user solr by (uid=0) Jul 25 03:00:19 ubuntu2204 systemd[1]: Started LSB: Controls Apache Solr as a Service. |
we run Solr on the system with the command:
1 | systemctl start solr |
We create the Solr collection:
1 | su - solr -c "/opt/solr/bin/solr create -c newcollection -n data_driven_schema_configs" |
To get to our solra in the browser, go to the address:
http://your-ip:8983/solr