12.7 C
Texas
angeloma
Senior Writer and partner

How to install Apache Solr on Ubuntu 20.04?

Hi, folks. This post will help you to install Apache Solr on Ubuntu 20.04. This professional tool is the base of many giant companies like Netflix.

Apache Solr is a professional search server created in Java and sponsored by the Apache Foundation. It is highly sophisticated and therefore used by large corporations for their vertical searches.

On the other hand, the concept of vertical search is quite simple to understand. A vertical search server is limited to a domain, a topic, or a target audience. It is ideal for programs and private search engines.

All this is achieved by Apache Solr with high performance, using very well the system resources and being compatible with PHP, Python, XML, and JSON.

- Advertisement -

So, let’s get started.

Install Apache Solr on Ubuntu 20.04

Before starting the process, it is advisable to first update the system completely. To do this, open a terminal or connect to your server via SSH.

Then, execute the following commands:

:~$ sudo apt update
:~$ sudo apt upgrade

At the end, your system will be fully updated and we will be able to continue.

1.- Install Java on Ubuntu 20.04

Apache Solr depends on Java to work. Therefore, you must have it installed previously.

So, to install Java on Ubuntu 20.04, you can run the following command:

:~$ sudo apt install openjdk-11-jre
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
at-spi2-core ca-certificates-java fontconfig-config fonts-dejavu-core fonts-dejavu-extra java-common libatk-bridge2.0-0 libatk-wrapper-java libatk-wrapper-java-jni
libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
libfontconfig1 libfontenc1 libgif7 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libice6 libjpeg-turbo8 libjpeg8 liblcms2-2 libllvm9 libnspr4
libnss3 libpciaccess0 libpcsclite1 libsensors-config libsensors5 libsm6 libvulkan1 libwayland-client0 libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
libxcb-present0 libxcb-randr0 libxcb-shape0 libxcb-sync1 libxcomposite1 libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxkbfile1 libxmu6 libxpm4 libxrandr2
libxrender1 libxshmfence1 libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 mesa-vulkan-drivers openjdk-11-jre-headless x11-common x11-utils
Suggested packages:
default-jre cups-common liblcms2-utils pcscd lm-sensors libnss-mdns fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic
mesa-utils
The following NEW packages will be installed:
at-spi2-core ca-certificates-java fontconfig-config fonts-dejavu-core fonts-dejavu-extra java-common libatk-bridge2.0-0 libatk-wrapper-java libatk-wrapper-java-jni
libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1
libfontconfig1 libfontenc1 libgif7 libgl1 libgl1-mesa-dri libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libice6 libjpeg-turbo8 libjpeg8 liblcms2-2 libllvm9 libnspr4
libnss3 libpciaccess0 libpcsclite1 libsensors-config libsensors5 libsm6 libvulkan1 libwayland-client0 libx11-xcb1 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
libxcb-present0 libxcb-randr0 libxcb-shape0 libxcb-sync1 libxcomposite1 libxdamage1 libxfixes3 libxft2 libxi6 libxinerama1 libxkbfile1 libxmu6 libxpm4 libxrandr2
libxrender1 libxshmfence1 libxt6 libxtst6 libxv1 libxxf86dga1 libxxf86vm1 mesa-vulkan-drivers openjdk-11-jre openjdk-11-jre-headless x11-common x11-utils
0 upgraded, 74 newly installed, 0 to remove and 0 not upgraded.
Need to get 72.1 MB of archives.
After this operation, 555 MB of additional disk space will be used.
Do you want to continue? [Y/n]
1.- Install Java on Ubuntu 20.04
1.- Install Java on Ubuntu 20.04

After the process is finished, check the functioning of Java, showing the installed version.

:~$ java --version
openjdk 11.0.7 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

Now you can continue.

2.- Download and Install Apache Solr on Ubuntu 20.04

Once we have Java installed correctly we can download and install Apache Solr.

To download it you can visit the project’s website or use a mirror as in my case:

:~$ wget -c http://mirrors.advancedhosters.com/apache/lucene/solr/8.5.2/solr-8.5.2.tgz
--2020-07-14 19:09:14-- http://mirrors.advancedhosters.com/apache/lucene/solr/8.5.2/solr-8.5.2.tgz
Resolving mirrors.advancedhosters.com (mirrors.advancedhosters.com)… 213.174.147.249, 2a02:b48:6:1::2
Connecting to mirrors.advancedhosters.com (mirrors.advancedhosters.com)|213.174.147.249|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 190485345 (182M) [application/x-gzip]
Saving to: ‘solr-8.5.2.tgz’
solr-8.5.2.tgz 100%[=====================================================================================>] 181.66M 612KB/s in 4m 36s
2020-07-14 19:13:51 (674 KB/s) - ‘solr-8.5.2.tgz’ saved [190485345/190485345]
2.- Download and install Apache Solr on Ubuntu 20.04
2.- Download and install Apache Solr on Ubuntu 20.04

At the time of writing, the latest stable version of Apache Solr is 8.5.2

Then, it is necessary to decompress the downloaded file:

:~$ tar fxvz solr-8.5.2.tgz

This will create a new folder that we have to access to locate the script that will install it.

:~$ cd solr-8.5.2/

And then, proceed to complete the installation with the following command that invokes a script called install_solr_service.sh and requires as parameter the downloaded compressed file.

:~$ sudo bash bin/install_solr_service.sh ~/solr-8.5.2.tgz 
3.- Installing Apache Solr on Ubuntu 20.04
3.- Installing Apache Solr on Ubuntu 20.04

In the end, you’ll see that the service will be up and running.

Remember that Apache Solr is run as a Systemd service. So you can start it, stop it, and check it out without any problems with the systemctl command.

Now we just have to create a new collection. To do this, run the following command:

:~$ sudo su solr -c "/opt/solr/bin/solr create -c osradar -n data_driven_schema_configs"
Created new core 'osradar
4.- Creating a new colletion
4.- Creating a new colletion

Remember that you can replace osradar with the name of the collection you want.

Now it remains for you to access the Apache Solr web interface. This web interface works through port 8983 and has to be available in the Firewall.

Open your web browser and go to http://server-ip:8983 and you will see the following

5.- Apache Solr on Ubuntu 20.04
5.- Apache Solr on Ubuntu 20.04

And so Apache Solr will be installed and ready to take full advantage of your applications.

Conclusion

Apache Solr is a vital tool for many systems. It is a member of the Apache Foundation which gives an idea of the quality of the product. In this sense, installing it can help our systems use the full potential of a vertical search.

So, share this post and join our Telegram Channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article