Blacklight is a Ruby on Rails Engine plugin, meaning it provides a small application that runs inside an existing Ruby on Rails project. For notes on upgrading Blacklight, check out our [[Release Notes And Upgrade Guides]] index. ## Pre-requisites * Ruby 1.9 or higher (consider using [[RVM|https://rvm.beginrescueend.com/rvm/install/]] or [[RBEnv|http://rbenv.org/]] to manage your Ruby version). * Java 1.5 or higher (in order to run solr under a java servlet container) * **For Windows users**: You may want to use [RailsInstaller](http://railsinstaller.org/) to get a Ruby on Rails environment. > NOTE: We run our continuous integration tests against Ruby 1.9.3, Ruby 1.8.7, JRuby and REE using the latest release of Rails, although we highly recommend using Ruby 1.9 and Rails 3.2. In addition, you should have the Bundler and Rails ruby gems installed: ```bash $ gem install bundler $ gem install rails ``` ## Install and Use 1. Create a new rails 3 application ```bash $ rails new my_app # create # create README # create Rakefile # create config.ru # create .gitignore # create Gemfile # [...] $ cd my_app ``` Rails automatically created an `public/index.html` file. However, Blacklight will provide a default `root` route for your application, so you probably want to remove it: ```bash $ rm public/index.html ``` 2. Append this line to your application's `Gemfile` ```ruby gem 'blacklight' ``` Especially if you are running on Linux, you may have to add `gem 'therubyracer'` to your gemfile, to get a Javascript runtime needed by the asset pipeline. then, update the bundle ```bash $ bundle install ``` 3. Install blacklight using Devise for user authentication: ```bash $ gem install devise $ rails generate blacklight --devise ``` If you would prefer to integrate with an alternative user authentication provider, see the [[User Authentication]] documentation. You can also install with no support for logged in users simply by omitting the devise install, and generating blacklight with `rails generate blacklight` (no --devise argument). 4. Run your database migrations to create Blacklight's database tables: ```bash $ rake db:migrate ``` 5. You will need to install and configure Solr. You can install Blacklight's example Solr configuration (using the jetty servlet container) that is configured to work with the Blacklight defaults: ```bash $ rails generate blacklight:jetty ``` Alternatively, you can also install your own copy of Solr or point Blacklight at an existing Solr server ( referred to in your `config/solr.yml`). The Blacklight configuration must match your Solr configuration. In addition, Blacklight has minor expectations about the Solr configuration and schemas. You can generate the Blacklight demonstration solrconfig and schema files using: ```bash $ rails generate blacklight:solr_conf path/to/output/directory/ ``` **For Windows Users: ** This step will only work on *nix platforms. You can manually download and extract a tagged version of [blacklight-jetty](https://github.com/projectblacklight/blacklight-jetty/tags). After extracting the file, you need to update the `config/solr.yml` file to add a `jetty_path` key to your test environment, e.g.: ```yaml test: &test url: http://localhost:8983/solr jetty_path: C:\path\to\jetty ``` 6. Make sure your Solr server is running. If you installed the Blacklight demo Solr/Jetty package, you can start the Jetty/Solr server using: ```bash $ java -jar jetty/start.jar & ``` 6. Index some data. You can index test MARC records provided Blacklight running: ```bash $ rake solr:marc:index_test_data ``` 7. Start up your application ```bash $ rails server ``` Visit the catalog at [[http://localhost:3000/catalog]]. You should see the Blacklight interface with 30 MARC records for testing. Additional MARC records are available from the [[blacklight-data|https://github.com/projectblacklight/blacklight-data]] repository. These can be ingested into Solr using SolrMarc, ```bash $ rake solr:marc:index MARC_FILE=(path to file) ``` See [[Configuring and Customizing Blacklight]] for information about how to customize the Blacklight user interface, search experience, and more.