Technology, Social Media, Travel
RSS icon Email icon Home icon
  • Installing Solr on Ubuntu Jaunty 9.04

    Posted on August 20th, 2009 John Berns 11 comments
    Solr install success on Ubuntu Jaunty 9.04

    Solr install success on Ubuntu Jaunty 9.04

    I just installed Apache Solr on Ubuntu Jaunty 9.04. I am not a Java or Tomcat person, so it was all rather new and a confusing, there was no good install guide and I hit a few walls, so here are some pointers that should get you to a working install.

    I am using the command-line install method, so it’s works for desktop and server editions. You can skip the apt-gets and use Synaptics Package Manager to install the packages if you prefer.

    1) Install Java

    sudo apt-get install sun-java6-bin sun-java6-demo sun-java6-jdk sun-java6-jre

    I believe the default install of Jaunty installs openjdk java, so you will want to make sure that Sun Java is chosen:

    sudo update-alternatives --config java

    You will prompted to pick a version as the default:

    Select the Sun Java version

    Select the Sun Java version

    Edit /etc/profile to sent the JAVA_HOME environment variable:

    JAVA_HOME=/usr/lib/jvm/java-6-sun
    export JAVA_HOME

    2) Install Tomcat

    sudo apt-get install tomcat5.5 libtomcat5.5-java tomcat5.5-admin tomcat5.5-webapps

    Check that Tomcat is running:

    sudo service tomcat5.5 status

    Grant yourself Tomcat Manager and Admin permissions; edit /usr/share/tomcat5.5/conf/tomcat-users.xml and include the following:

    <user username="myname" password="mypassword" roles="admin,manager"/>

    3 Install Solr

    sudo apt-get install solr-common solr-tomcat5.5 libxpp3-java

    (I kept getting “java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserException at java.lang.Class.forName0(Native Method)” in the Solr admin page; a little searching led me to find that the problems was that libxpp3-java was not installed. Why it’s not a required package, I don’t know!)

    4) Restart Tomcat and Test Solr

    sudo service tomcat5.5 restart

    Now you can go to the Tomcat web admin page at http://localhost:8180/ and login with the credentials you supplied above.

    Go to http://localhost:8180/solr/ and do a test query to confirm it’s working.

    results

    Of course you will get zero results, you have no content indexed yet.

    That should be enough to get started!

  • Tidy Up Your XML in Vim

    Posted on June 13th, 2009 John Berns 1 comment

    You have some nice, compact XML, the kind without whitespace or newlines, like this:

    01-raw-xml-in-vim-no-whitespace

    Not easy to read. OK for computers to crunch–but if you want to get an idea of the document’s structure at a glance or do some editing–well, you might want it formatted a little nicer.

    So let’s use Tidy to clean it up–all from the comfort of your Vim session…

    (You could also use xmllint–your choice–depends on what you have installed and what you prefer.)

    You can execute a shell command from Vim by typing:

    :!

    Then to tidy up your XML run tidy with the following options:

    tidy -mi -xml -utf8

    “-im” means indent and modify the original file; “-xml” means, you are dealing with XML and “-utf8″ is optional, it means “use UTF-8 for both input and output” so you’ll get readable characters instead of encodings if you have umlats or grave symbols.

    You can see all of tidy’s formatting, encoding and other options by typing

    tidy -h

    So the whole command we type into Vim is:

    :! tidy -mi -xml -utf8

    02-raw-xml-tidy-command

    You will drop to shell while the command executes:

    03-raw-xml-tidy-complete

    Hit “return” when you are done and then Vim will ask if you want to reload the file:

    04-raw-xml-reload

    And there you go, beautifully formatted HTML to read!

    05-formatted-xml

    Enjoy ;-) !