Product docs and API reference are now on Akamai TechDocs.
Search product docs.
Search for “” in product docs.
Search API reference.
Search for “” in API reference.
Search Results
 results matching 
 results
No Results
Filters
Add a Custom Search to your Site with Solr
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
DeprecatedThis guide has been deprecated and is no longer being maintained.
Apache Solr is an open source search platform that provides administrators with a customizable and scalable solution for managing online content. Solr can be configured to index all uploaded data, resulting in fast search results, whether used enterprise-wide or with a single website. In addition to a built-in web control interface, developers can also link access via a client API.
Before You Begin
Familiarize yourself with our Getting Started guide and complete the steps for setting your Linode’s hostname and timezone.
Complete the Securing Your Server to create a standard user account, harden SSH access and remove unnecessary network services.
Update your system and package repositories and install
wget
.
root
or with the sudo
prefix. For more information on privileges, see our
Users and Groups
guide.Install Java
Install Java 8 JDK:
Debian & Ubuntu
Add the Java 8 repository, download the GPG key, and install Java 8.
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 apt update apt install oracle-java8-installer
On most systems, the
oracle-java8-set-default
package will also be downloaded and installed. To verify, run the following command and check for matching output. If your output does not match, continue to Step 3. Otherwise, Java 8 installation is complete:dpkg --list | grep oracle
Output:
ii oracle-java8-installer 8u144-1~webupd8~0 all Oracle Java(TM) Development Kit (JDK) 8 ii oracle-java8-set-default 8u144-1~webupd8~0 all Set Oracle JDK 8 as default Java
Install the
oracle-java8-set-default
package:apt install oracle-java8-set-default
Fedora & RHEL based
yum install java-1.8.0-openjdk.x86_64
Arch Linux
pacman -S jre8-openjdk
openSUSE
zypper in java-1_8_0-openjdk
Verify the Java installation:
java -version
The output should be similar to:
openjdk version "1.8.0_144" OpenJDK Runtime Environment (IcedTea 3.5.1) (suse-13.3-x86_64) OpenJDK 64-Bit Server VM (build 25.144-b01, mixed mode)
Download and Install Apache Solr
Replace each instance of 6.6.1
in the examples below with the latest version from the official Apache Solr website
.
Navigate to the
/opt
directory and download Solr:cd /opt wget http://apache.claz.org/lucene/solr/6.6.1/solr-6.6.1.tgz
Extract the Solr installation script from the downloaded archive:
tar xzf solr-6.6.1.tgz solr-6.6.1/bin/install_solr_service.sh --strip-components=2
Execute the Solr installation script. Arch Linux users should skip to the Arch-specific steps below:
bash ./install_solr_service.sh solr-6.6.1.tgz
Arch Linux
Download the installation script for Arch Linux:
wget https://github.com/Darkstar90/solr-arch-install/blob/master/install_solr_service_arch.sh
Execute the custom Arch Linux installation script:
bash ./install_solr_service_arch.sh solr-6.6.1.tgz
Create a Firewall Rule for Solr
Solr listens on port 8983
by default. Open the port to allow access to the web interface using your preferred firewall manager:
FirewallD
sudo firewall-cmd --zone=public --add-port=8983/tcp --permanent
sudo firewall-cmd --reload
UFW
ufw allow 8983/tcp comment "Solr port"
iptables
iptables -A INPUT -p tcp --dport 8983 -j ACCEPT -m comment --comment "Solr port"
Access the Solr Administration Page
Solr is managed from a web-facing administration page, which can be reached via your Linode’s IP address or domain name on port 8983
.
In a web browser, enter your Linode’s IP address or domain name, followed by port 8983
:
198.51.100.0:8983/solr
Secure the Solr Administration Page
Set up a password protected login page for the Solr admin page:
Navigate to
/opt/solr/server/etc
and edit thewebdefault.xml
file. Add the following to the end of the file, before</web-app>
:- File: /opt/solr/server/etc/webdefault.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<login-config> <auth-method>BASIC</auth-method> <realm-name>Solr Admin Auth</realm-name> </login-config> <security-constraint> <web-resource-collection> <web-resource-name>Solr Admin Auth</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>user</role-name> </auth-constraint> </security-constraint>
In the same directory, edit the
jetty.xml
file and add the following before</Configure>
at the end:- File: /opt/solr/server/etc/jetty.xml
1 2 3 4 5 6 7 8 9
<Call name="addBean"> <Arg> <New class="org.eclipse.jetty.security.HashLoginService"> <Set name="name">Solr Admin Auth</Set> <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set> <Set name="refreshInterval">0</Set> </New> </Arg> </Call>
Create a
realm.properties
file in the current directory to add the user login information. Replace the usernameadmin
andadmin123
password with the user and secure password of your choice:- File: /opt/solr/server/etc/realm.properties
1
admin: admin123,user
Here,
admin:
assigns a username “admin” with the passwordadmin123
.user
attributes this new user to the “user” role-name set inwebdefault.xml
.Restart the solr service:
systemctl restart solr
You can also use this process to secure other web pages within Solr. For example, if you have two Solr search cores created,
core1
andcore2
, you can limit access to both by adding additional<url-pattern>
lines towebdefault.xml
:<url-pattern>/core1/*</url-pattern> <url-pattern>/core2/*</url-pattern>
Where to Go From Here
With Solr installed on your Linode, you are now ready to create search indexes and add data, or integrate it with your web application or website. If you need help with this, the Apache Solr Reference Guide page on the Apache Solr website is a great place to start.
More Information
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This page was originally published on