How to configure Apache Solr on Ubuntu 14/15
Hello everyone, welcome to read our Apache Solr article today. Simply put, Apache Solr is the most prestigious open-source search platform. Combined with Apache Lucene running on the back-end of the website, you can easily create search engines to search websites, databases, and files. It can index and search multiple websites and return search suggestions based on the content of the search text.
Solr uses HTTP Extensible Markup Language (XML) to provide application APIs for JSON, Python, and Ruby ). According to the Apache Lucene project, Solr provides many functions, which are very popular among administrators:
- Full-text search
- Faceted Navigation)
- Spelling suggestion/Automatic completion
- Sort and arrange custom documents
Prerequisites:
On a new Ubuntu 14/15 system that uses the minimal installation package, you only need a small amount of preparation to install Apache Solor.
1) System Update
Use a non-root user with sudo permission to log on to your Ubuntu server and use it in all subsequent steps of installing and using Solr.
After successful logon, use the following command to upgrade your system to the latest updates and patches:
$ sudoapt-get update
2) install JRE
To install Solr, you must first install JRE (Java Runtime Environment) as the basic Environment. because solr and tomcat are both based on Java, We need to install the latest Java version and configure the Java local Environment.
To install the latest version of Java 8, run the following command to install the Python Software Properties Toolkit:
$ sudoapt-get install python-software-properties
Configure the repository of the latest Java 8 version.
$ sudo add-apt-repository ppa:webupd8team/java
Now you can use the following command to update the package source list and use 'apt-get' to install the latest version of Oracle Java 8.
$ sudoapt-get update
$ sudoapt-get install oracle-java8-installer
During installation and configuration, Click 'OK' to accept the Oracle Binary Code License Agreement (Oracle Binary Code License Agreement) of Java SE Platform and JavaFX ).
After the installation is complete, run the following command to check whether the installation is successful and check the installed version.
kash@solr:~$ java -version
java version "1.8.0_66"
Java(TM) SE RuntimeEnvironment(build 1.8.0_66-b17)
JavaHotSpot(TM)64-BitServer VM (build 25.66-b17, mixed mode)
The execution results show that we have successfully installed Java and met the basic requirements for installing Solr. Next, let's proceed to the next step.
Install Solr
There are two different ways to install Solr on Ubuntu. In this article, we only use the latest source package to demonstrate the installation of the source code.
To install Solr using the source code, download the latest available installation package from the official website. Copy the following link and use the 'wget' command to download it.
$ wget http://www.us.apache.org/dist/lucene/solr/5.3.1/solr-5.3.1.tgz
Run the following command to decompress the archived service to the/bin directory.
$ tar-xzf solr-5.3.1.tgz solr-5.3.1/bin/install_solr_service.sh --strip-components=2
Run the script to start the Solr service. This will first create a solr user and then install Solr as a service.
$ sudobash./install_solr_service.sh solr-5.3.1.tgz
Solr Installation
Run the following command to check the Solr service status.
$ service solr status
Solr status
Create a Solr set:
Now we can use Solr users to add multiple sets. As shown in, you only need to specify the Set Name and Its configuration set in the command line to create multiple sets.
$ sudosu- solr -c "/opt/solr/bin/solr create -c myfirstcollection -n data_driven_schema_configs"
Create a set
We have successfully created a new core instance directory for our first set and can add data to it. To view the default mode file in the database, find '/opt/solr/server/solr/configsets/dataDrivenSchema_configs/conf '.
Use Solr Web
Use the default port 8983 to connect to Apache Solr. Open your browser and enter http: // your_server_ip: 8983/solr or http://your-domain.com: 8983/solr. Make sure your firewall allows port 8983.
http://172.25.10.171:8983/solr/
Web Access Solr
Click 'core admin' in the left menu of Solr's Web Console. You will see the set created using the command line method. You can click 'add core' to create a new Core.
Add Core
As shown in, you can select a set and point to the document to add content or query data from the document. Add data in the specified format as shown below.
{
"number":1,
"Name":"George Washington",
"birth_year":1989,
"Starting_Job":2002,
"End_Job":"2009-04-30",
"Qualification":"Graduation",
"skills":"Linux and Virtualization"
}
After adding the file, click 'submit document.
Add document
Summary
After the installation is successful on Ubuntu, you can use the Solr Web interface to insert or query data. If you want to use Solr to manage more data and files, you can create more collections. I hope you like this article and hope it will help you.
Solr3.6.1 build an environment in Tomcat6
Tomcat-based Solr3.5 cluster deployment
Load Balancing for Solr clusters using Nginx on Linux
Install and use Solr in Linux
Deploy Solr 4 on Ubuntu 12.04 LTS through Tomcat
Solr implements Low Level query parsing (QParser)
Build a search Server Based on Solr 3.5
Solr 3.5 development and application tutorial PDF
Solr 4.0 deployment instance tutorial
Solr details: click here
Solr: click here
Via: http://linoxide.com/ubuntu-how-to/configure-apache-solr-ubuntu-14-15/
Proofreader of taichirain: Caroline
This article was originally compiled by LCTT and launched with the honor of Linux in China
This article permanently updates the link address: