Jonas Midstrup's Blog

Programming, IT in general and everything in between.

Archive for the ‘Windows Server 2008 R2’ tag

Installing Apache Solr on Windows

with one comment

Apache Solr is a Java-based enterprise search platform build on top of the Apache Lucene search engine (the two of them are now merged). It makes all the great search engine features available through a RESTful API (HTTP/XML and JSON): indexing, full-text search, hit highlighting, faceted search, dynamic clustering, database integration, rich document (e.g., Word, PDF) handling, and geospatial search. The best part is that it’s open source and free for all.

I have got a lot of know-how about this great tool both for home and business purpose and would like to share, in this blog-post, how you can install Solr on a Windows system (Windows 6 / 7 / 2008 (R2) Server). This guide is written because I had a hard time finding a guide on this subject out there on the web. So here we go.

First of all, you need to install a webserver that can run Java-servlets. I use the Apache Tomcat webserver. Download the latest Tomcat server (the MSI installer is perfect for this – Binary Distributions -> Core -> 32-bit/64-bit Windows Service Installer) and install it on your system: http://tomcat.apache.org/download-70.cgi (right now the latest version is 7.0) After this is installed, check that it is correctly installed and running (go to http://localhost:8080/).

After you have checked that it is running correctly, go to the directory where you installed Tomcat and then open the server.xml file in the conf folder (conf\server.xml). Inside this you then add this attribute to the first Connector XML-tag (Server -> Service -> Connector): URIEncoding=”UTF-8″.

Download and unzip the latest version of Solr into a temporary folder on your system – could be something like “C:/temp/solr” (I have experienced some problems running version 3.5 on Tomcat – use the 3.4 version for now): http://www.apache.org/dyn/closer.cgi/lucene/solr/

Create a folder on your file system where you would like Solr to be installed. Copy the content from the “C:\temp\solr\example\solr” folder into the folder you just created.

Stop the Tomcat service. If you installed using the MSI installer you can do this by going to the Tomcat folder inside All Programs in the start menu and click on “Configure Tomcat” (you might need to do this by right-clicking on it and choose to “Run as administrator”). Keep the Tomcat configuration window open after you have stopped the service. We are going to use it later.

Copy the *solr*.war file from “C:\temp\solr\dist” to the webapps folder inside your Tomcat installation folder. The .war file is called apache-solr-3.4.0.war for instance when you have the 3.4 version of Solr. When the file is copied, rename it to “solr.war”.

Now we need to configure Tomcat so that it recognizes the Solr install folder that you created earlier. This is done by adding a Java Option: Open the Tomcat configuration window mentioned earlier and then go to the “Java” tab. Here you have a “Java Options” textbox with alot of lines in it. On the bottom of this textbox add the line “-Dsolr.solr.home={solr-install-folder}”, where {solr-install-folder} is the path to your Solr install folder.

In the Tomcat configuration window, start the Tomcat service again. After starting the service, try to open a web-browser and navigate to this site (the local Solr administration site): http://localhost:8080/solr/admin. If the site starts nicely, Solr has been installed on your system.

Written by jonasm

December 20th, 2011 at 1:13 pm

Bootup the virtual haddisk

without comments

Fall last year (2009) I was attending a session with Scott Hanselman in Copenhagen, Denmark where he talked about the, back then, brand new features in ASP.NET MVC 2.0. After getting to the conference room at the hotel 15 minutes late, because he went to the wrong hotel (yes Copenhagen can be a large city to travel in :) he started the session by telling about a new cool feature in Windows 7 where it’s possible to make a bootable virtual harddisk that you can attach in the Disk Manager and then boot up on just like if it was a normal installed OS.

This is cool because you don’t have to run it in the Virtual PC (as a x86 installation – why can’t MS just make the free version of VPC x64 based!?), you can distribute it on multiple PC’s and because it boots up normally it utilizes the hardware in the PC as the normal OS. In that way it becomes the golden mean between a rigid Virtual PC installation and the mess of having two OS-installations.

This I knew I had to try some time and yesterday I got the opportunity. I needed to run a Windows Server 2008 R2 Enterprise beside my Windows 7 installation to use some of the services in the server for a little project I’m working on. Here I will explain what I did and what I learned.

I have to tell you a very important thing I learned after my PC crashed and didn’t wont to boot up again after I thought I had got everything done exactly as in Scott’s blogposts: YOU NEED TO HAVE WINDOWS 7 ULTIMATE TO GET THIS TO WORK! Otherwise you will find yourself stuck, as I was, with a PC that gives you a strange boot error, a Logitech USB/Bluetooth keyboard that is not working outside of Windows and no PS2 keys anywhere near you so you can skip the error, because PS2 was “so outdated”. Now, when I make something like this from now on, I will have a PS2 keyboard no less than 1 meter away from me :)

The first thing to do is to make the bootable VHD (Virtual Hard Disk) from a Windows installation ISO. This blog from Scott will tell you what to do:
Step-By-Step: Turning a Windows 7 DVD or ISO into a Bootable VHD Virtual Machine

So I followed Scott’s description of how to make the VHD and I was able to get it done. Remember the /SKU:SERVERENTERPRISE setting in the cscript command if you want to have a enterprise server.

Then I moved on to this post from Scott telling about how to get it to appear when booting up the PC:
Less Virtual, More Machine – Windows 7 and the magic of Boot to VHD

When you have a VHD already you just need to go down to the paragraph with the title “Setting up your Windows Boot Menu to boot to an Existing VHD” and start from there. This is quit straight forward, but remember one thing when doing this: go to the Disk Manager and attach the VHD before doing any of the things in this post! Otherwise it won’t work.

After doing the bcdedit commands and veryfied that your VHD appears in the Windows Boot Manager (remember to be absolutely sure that everything is looking alright here before restarting your system!). The problem is that if the Windows Boot Manager finds that one of the entries is not correct it simply wont but anything, even the OS that is correct! When you boot up now you will have a new OS in the Windows Boot Manager menu that you can choose. The first time you startup the new OS you will have a Administrator user and it will prompt you to give it a password.

Then you are good to go! :) The coolest thing about all this is that you have all your harddisks in the new system (the VHD will now be your C-drive) and you can move files from one harddisk to the other and even cooler, you can take the VHD, move it to another PC, add it to the Windows Boot Manager using the last post from Scott that I mentioned and you have a full functioning OS with all you need installed.

Have fun with it :)

Written by jonasm

July 29th, 2010 at 2:05 pm