Blacklight is an interface for searching a Solr index. The quick install of Blacklight includes the installation of Solr, but we will be installing Solr manually instead. This gives us more control over which version of Solr to install.
If you are not familiar with Solr, imagine a book with an index at the back. If you are looking for a certain word or phrase in the book, you can spend lots of time scanning each page individually or you can flip to the index where the work has already been done for you. A Solr index is essentially the same thing as a book index.
The Solr index looks though all digital documents you tell it to, and indexes the words and phrases in the documents. When you want to search for a particular word, searching the Solr index is then much, much faster than a program that searches every document individually until it finds all instances of the word.
An additional benefit of Solr indexing is that the indexed words and phrases can be used as facets in faceted searching. The words and phrases are already grouped during the indexing process, so these groups are easily displayed and used to filter search queries.
If you have never installed or used Solr before, I recommend doing the Solr quickstart exercise to become familiar with some of the command line commands, what the interface looks like, and for a basic understanding of how the index works.
1. Open a new Terminal window.
2. Connect to the VPS via ssh as the root user:
3. Enter your root user's password when prompted for it and press Return.
4. Change directories to your single user's home directory:
5. List the contents of this directory to check for an existing directory named "solr" with the following command:
6. If there is already a directory named "solr" then change directories into that folder:
If there is not a directory listed with the name "solr" then create the directory with the following command:
If you receive a permissions error saying you cannot make this directory, the easiest thing I found to do is to open a web browser, go to your cPanel on the Bluehost website, go to the file management section and click on the "File Manager" icon, navigate to the Home directory (/home/username/), and then create the folder using the File Manager interface.
7. In Terminal, once you have confirmed that the /home/username/solr directory exists, change directories into it:
8. I used version 5.3.0 of Solr during my testing phases, so that is what I will use for the app. If you want to use a more recent version of Solr, check for the appropriate download link and substitute it in the command below.
Download the Solr tgz package to the /home/username/solr directory with the command:
If successful, you will see something similar to the following in the Terminal window, followed by a new command line prompt:
10. Unpack the tgz package with the following command:
The Terminal window will print many lines of text showing the contents of the tgz package being unpacked into the solr directory.
11. Once the unpacking is finished and you see a new command line prompt, change directories into the solr subdirectory (in our case it is for version 5.3.0, which will be different for you if you installed a different version):
12. Start up your solr service with the following command:
If successful, you will see:
13. Check if your solr service is running and accessible by opening a web browser and going to your URL followed by the 8983 port number:
http://example.com:8983
If everything is working properly, you should see the Solr admin interface.
14. If you want to free up space on the server, you can now delete the .tgz file you downloaded.
Previous post: Setting up the MySQL database
Next post: Installing Passenger
If you are not familiar with Solr, imagine a book with an index at the back. If you are looking for a certain word or phrase in the book, you can spend lots of time scanning each page individually or you can flip to the index where the work has already been done for you. A Solr index is essentially the same thing as a book index.
The Solr index looks though all digital documents you tell it to, and indexes the words and phrases in the documents. When you want to search for a particular word, searching the Solr index is then much, much faster than a program that searches every document individually until it finds all instances of the word.
An additional benefit of Solr indexing is that the indexed words and phrases can be used as facets in faceted searching. The words and phrases are already grouped during the indexing process, so these groups are easily displayed and used to filter search queries.
If you have never installed or used Solr before, I recommend doing the Solr quickstart exercise to become familiar with some of the command line commands, what the interface looks like, and for a basic understanding of how the index works.
Installing Solr on the VPS
We will install Solr under the single user's directory, but we need to be logged in as the root user to do this.1. Open a new Terminal window.
2. Connect to the VPS via ssh as the root user:
$ ssh root@example.com
3. Enter your root user's password when prompted for it and press Return.
4. Change directories to your single user's home directory:
# cd /home/username/
5. List the contents of this directory to check for an existing directory named "solr" with the following command:
# ls -a
6. If there is already a directory named "solr" then change directories into that folder:
# cd solr
If there is not a directory listed with the name "solr" then create the directory with the following command:
# mkdir solr
If you receive a permissions error saying you cannot make this directory, the easiest thing I found to do is to open a web browser, go to your cPanel on the Bluehost website, go to the file management section and click on the "File Manager" icon, navigate to the Home directory (/home/username/), and then create the folder using the File Manager interface.
7. In Terminal, once you have confirmed that the /home/username/solr directory exists, change directories into it:
# cd /home/username/solr
8. I used version 5.3.0 of Solr during my testing phases, so that is what I will use for the app. If you want to use a more recent version of Solr, check for the appropriate download link and substitute it in the command below.
Download the Solr tgz package to the /home/username/solr directory with the command:
# wget http://archive.apache.org/dist/lucene/solr/5.3.0/solr-5.3.0.tgz -O solr-5.3.0.tgz
If successful, you will see something similar to the following in the Terminal window, followed by a new command line prompt:
--2016-05-11 14:04:09-- http://archive.apache.org/dist/lucene/solr/5.3.0/solr-5.3.0.tgz
Resolving archive.apache.org... 163.172.17.199
Connecting to archive.apache.org|163.172.17.199|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 134914712 (129M) [application/x-gzip]
Saving to: “solr-5.3.0.tgz”
100%[===========================================================================================>] 134,914,712 18.3M/s in 8.6s
2016-05-11 14:04:20 (14.9 MB/s) - “solr-5.3.0.tgz” saved [134914712/134914712]
10. Unpack the tgz package with the following command:
# tar -xzvf ./solr-5.3.0.tgz
The Terminal window will print many lines of text showing the contents of the tgz package being unpacked into the solr directory.
11. Once the unpacking is finished and you see a new command line prompt, change directories into the solr subdirectory (in our case it is for version 5.3.0, which will be different for you if you installed a different version):
# cd solr-5.3.0
12. Start up your solr service with the following command:
# bin/solr start -noprompt
If successful, you will see:
Waiting up to 30 seconds to see Solr running on port 8983 [\]
Started Solr server on port 8983 (pid=912). Happy searching!
13. Check if your solr service is running and accessible by opening a web browser and going to your URL followed by the 8983 port number:
http://example.com:8983
If everything is working properly, you should see the Solr admin interface.
14. If you want to free up space on the server, you can now delete the .tgz file you downloaded.
Previous post: Setting up the MySQL database
Next post: Installing Passenger
It was really a nice article and i was really impressed by reading this Ruby on Rails Online Training Hyderabad
ReplyDelete