{"id":7244,"date":"2020-11-16T18:26:11","date_gmt":"2020-11-16T15:26:11","guid":{"rendered":"https:\/\/kifarunix.com\/?p=7244"},"modified":"2024-03-14T23:47:39","modified_gmt":"2024-03-14T20:47:39","slug":"install-latest-apache-solr-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-latest-apache-solr-on-ubuntu-20-04\/","title":{"rendered":"Install latest Apache Solr on Ubuntu 20.04"},"content":{"rendered":"\n
In this tutorial, you will how to install latest Apache Solr on Ubuntu 20.04. Apache Solr<\/a> is the popular, blazing-fast, open source enterprise search platform built on Apache Lucene. It is highly reliable, scalable and fault tolerant, providing distributed indexing, replication and load-balanced querying, automated failover and recovery, centralized configuration and more. Solr powers the search and navigation features of many of the world’s largest internet sites<\/em>. With Solr, you put documents in it (called “indexing”) via JSON, XML, CSV or binary over HTTP. You query it via HTTP GET and receive JSON, XML, CSV or binary results<\/em>.<\/p>\n\n\n\n Solr Features as outlined on Apache Solr Features page<\/a>.<\/p>\n\n\n\n Update your system package cache;<\/p>\n\n\n\n JRE is one of the requirements for installing latest Apache Solr on Ubuntu 20.04. JRE version 1.8 or higher. Hence, run the command below to install the default JRE on Ubuntu 20.04;<\/p>\n\n\n\n You can verify the version of installed JRE by executing the command below;<\/p>\n\n\n\n Solr 8.7.0 is the most recent Apache Solr release. Hence, navigate their downloads page<\/a> and grab the latest release archive. You can simply obtain the download url and use wget to pull it down.<\/p>\n\n\n\n Before you can proceed, you need to verify the integrity of the downloaded Apache Solr archive. The downloaded archive can be verified using the PGP or SHA checksum. We use the later in this guide. Therefore, download the SHA512 checksum of the same version of the Apache Solr release you downloaded from the download page.<\/p>\n\n\n\n Once the download is done, calculate the SHA512 checksum of the Apache Solr archive downloaded;<\/p>\n\n\n\n Compare the hash value with the contents of the SHA512 file downloaded.<\/p>\n\n\n\n Ensure that the hashes match.<\/p>\n\n\n\n Once you verify the integrity of the downloaded archive, extract it as follows;<\/p>\n\n\n\n Run the command below to install Apache Solr on Ubuntu 20.04;<\/p>\n\n\n\n The command extracts and installs and create Apache Solr systemd service unit, solr.service.<\/p>\n\n\n\n As you can also see from the installation output, Apache Solr is started and hence running.<\/p>\n\n\n\n Note that it is also installed under You can find the various control scripts under the As you can see, Solr is now listening on port 8983;<\/p>\n\n\n\n To access Apache Solr web admin interface, you can access it via the http:\/\/server-ip-or-resolvable-hostname:8983\/solr<\/p>\n\n\n\n If you are not accessing Apache Solr on localhost, you need to allow external access to port 8983\/tcp, if UFW is running.<\/p>\n\n\n\n You can now create Solr Core to start indexing and analyzing your data.<\/p>\n\n\n\n You can create Solr core from the Core Admin interface or from command line using the The command in short Create a core or collection depending on whether Solr is running in standalone (core) or SolrCloud mode (collection). In other words, this action detects which mode Solr is running in, and then takes the appropriate action (either create_core or create_collection<\/em>).<\/p>\n\n\n\n You can obtain help by executing the commands;<\/p>\n\n\n\n Or<\/p>\n\n\n\n For example, to create a sample Solr Core using \/tmp\/mytestcore as the configuration directory;<\/p>\n\n\n\n You need to create a core as Solr user;<\/p>\n\n\n\n You core should now be available on the Core Admin panel on Solr web interface.<\/p>\n\n\n\n\n
Installing Apache Solr on Ubuntu 20.04<\/h2>\n\n\n\n
Run System Update<\/h3>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
Install Java Runtime Environment (JRE) on Ubuntu 20.04<\/a><\/h3>\n\n\n\n
apt install default-jre<\/code><\/pre>\n\n\n\n
java --version<\/code><\/pre>\n\n\n\n
openjdk 11.0.9.1 2020-11-04\nOpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04)\nOpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)<\/code><\/pre>\n\n\n\n
Install Apache Solr on Ubuntu<\/h3>\n\n\n\n
Download latest Apache Solr release version<\/h4>\n\n\n\n
wget https:\/\/downloads.apache.org\/lucene\/solr\/8.7.0\/solr-8.7.0.tgz<\/code><\/pre>\n\n\n\n
Verify Integrity of Apache Solr Archive<\/h4>\n\n\n\n
wget https:\/\/downloads.apache.org\/lucene\/solr\/8.7.0\/solr-8.7.0.tgz.sha512<\/code><\/pre>\n\n\n\n
gpg --print-md SHA512 solr-8.7.0.tgz<\/code><\/pre>\n\n\n\n
gpg: directory '\/root\/.gnupg' created\ngpg: keybox '\/root\/.gnupg\/pubring.kbx' created\nsolr-8.7.0.tgz: 15A3AF83 997E2CBC 4BFED304 F7D43EFD 260674D9 80592416 05FF3CDE\n 0AE02D8B D1CCD569 73C6CBA1 CC118956 55BB76FC F1991BBB 94B004E5\n 17CE15F7 28FA163F<\/code><\/pre>\n\n\n\n
cat solr-8.7.0.tgz.sha512<\/code><\/pre>\n\n\n\n
15a3af83997e2cbc4bfed304f7d43efd260674d98059241605ff3cde0ae02d8bd1ccd56973c6cba1cc11895655bb76fcf1991bbb94b004e517ce15f728fa163f *solr-8.7.0.tgz<\/code><\/pre>\n\n\n\n
Extract Apache Solr Archive<\/h4>\n\n\n\n
tar xzf solr-8.7.0.tgz<\/code><\/pre>\n\n\n\n
Install Apache Solr on Ubuntu 20.04<\/h4>\n\n\n\n
solr-8.7.0\/bin\/install_solr_service.sh solr-8.7.0.tgz<\/code><\/pre>\n\n\n\n
id: \u2018solr\u2019: no such user\nCreating new user: solr\nAdding system user `solr' (UID 114) ...\nAdding new group `solr' (GID 120) ...\nAdding new user `solr' (UID 114) with group `solr' ...\nCreating home directory `\/var\/solr' ...\n\nExtracting solr-8.7.0.tgz to \/opt\n\n\nInstalling symlink \/opt\/solr -> \/opt\/solr-8.7.0 ...\n\n\nInstalling \/etc\/init.d\/solr script ...\n\n\nInstalling \/etc\/default\/solr.in.sh ...\n\nService solr installed.\nCustomize Solr startup configuration in \/etc\/default\/solr.in.sh\n\u25cf solr.service - LSB: Controls Apache Solr as a Service\n Loaded: loaded (\/etc\/init.d\/solr; generated)\n Active: active (exited) since Mon 2020-11-16 14:26:20 UTC; 5s ago\n Docs: man:systemd-sysv-generator(8)\n Process: 30824 ExecStart=\/etc\/init.d\/solr start (code=exited, status=0\/SUCCESS)\n\nNov 16 14:26:07 ubuntu20.kifarunix-demo.com systemd[1]: Starting LSB: Controls Apache Solr as a Service...\nNov 16 14:26:07 ubuntu20.kifarunix-demo.com su[30828]: (to solr) root on none\nNov 16 14:26:07 ubuntu20.kifarunix-demo.com su[30828]: pam_unix(su-l:session): session opened for user solr by (uid=0)\nNov 16 14:26:20 ubuntu20.kifarunix-demo.com systemd[1]: Started LSB: Controls Apache Solr as a Service.<\/code><\/pre>\n\n\n\n
\/opt\/solr<\/code> (symlinked to \/opt\/solr-$VER, where $VER is the version release number)<\/p>\n\n\n\n
ls \/opt\/solr\/<\/code><\/pre>\n\n\n\n
bin\/ contrib\/ docs\/ licenses\/ LUCENE_CHANGES.txt README.txt \nCHANGES.txt dist\/ example\/ LICENSE.txt NOTICE.txt server\/<\/code><\/pre>\n\n\n\n
\/opt\/solr\/bin\/<\/strong><\/code> directory. For example, you can as well check the status by running the command below;<\/p>\n\n\n\n
\/opt\/solr\/bin\/solr status<\/code><\/pre>\n\n\n\n
Found 1 Solr nodes: \n\nSolr process 30901 running on port 8983\n{\n \"solr_home\":\"\/var\/solr\/data\",\n \"version\":\"8.7.0 2dc63e901c60cda27ef3b744bc554f1481b3b067 - atrisharma - 2020-10-29 19:39:16\",\n \"startTime\":\"2020-11-16T14:26:10.033Z\",\n \"uptime\":\"0 days, 0 hours, 5 minutes, 31 seconds\",\n \"memory\":\"36.9 MB (%7.2) of 512 MB\"}<\/code><\/pre>\n\n\n\n
ss -altnp | grep 8983<\/code><\/pre>\n\n\n\n
LISTEN 0 50 *:8983 *:* users:((\"java\",pid=30901,fd=154))<\/code><\/pre>\n\n\n\n
Accessing Apache Solr Admin Interface<\/h3>\n\n\n\n
ufw allow 8983\/tcp<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
\/opt\/solr\/bin\/solr<\/strong><\/code> command whose syntax is;<\/p>\n\n\n\n
\/opt\/solr\/bin\/solr create [-c name] [-d confdir] [-n configName] [-shards #] [-replicationFactor #] [-p port] [-V]<\/code><\/pre>\n\n\n\n
\/opt\/solr\/bin\/solr create_core -help<\/code><\/pre>\n\n\n\n
\/opt\/solr\/bin\/solr create_collection -help<\/code><\/pre>\n\n\n\n
mkdir \/tmp\/mytestcore<\/code><\/pre>\n\n\n\n
su - solr -c \"\/opt\/solr\/bin\/solr create_core -c mytestcore -d \/tmp\/mytestcore\/\"<\/code><\/pre>\n\n\n\n
Further Reading<\/h3>\n\n\n\n