Tuesday, November 27, 2007

Installing Java and Tomcat (without apache) on base Linux system (Amazon EC2 Fedora Core 4 image)

For YIQYAQ we're running Tomcat as the web server, on basic Linux Fedore Core 4 images at Amazon EC2. These are the steps taken to install Java and Tomcat on those systems and get it running. I'm not much of a Linux, Java, or Tomcat expert, so I can't say these are the best steps to take, only that they're what I did and they seem to work.

  1. Get java from http://java.sun.com/javase/downloads/index.jsp, install JRE self extracting file jre-6u3-linux-i586.bin into the root of the linux system, then follow these command from the linux system
    1. mkdir /java
    2. mv /jre-6u3-linux-i586.bin /java/
    3. cd /java
    4. chmod 555 jre-6u3-linux-i586.bin
    5. ./jre-6u3-linux-i586.bin
    6. rm jre-6u3-linux-i586.bin
  2. Setup Java environment variables
    1. cd ~
    2. nano .bash_profile
    3. add lines
      export JAVA_HOME
      export JAVAHOME
    4. lower down, change from
    5. exit nano, exit shell, and restart shell to get new environment set up
  3. Download tomcat 6.0.14 from http://tomcat.apache.org/download-60.cgi#6.0.14 to the root of your linux system as apache-tomcat-6.0.14.tar.gz, and follow these commands to install it
    1. mkdir /tomcat
    2. cd /tomcat
    3. mv /apache-tomcat-6.0.14.tar.gz .
    4. gunzip -c apache-tomcat-6.0.14.tar.gz | tar xopf –
    5. rm apache-tomcat-6.0.14.tar.gz
  4. Setup environment variables for tomcat
    1. cd ~
    2. nano .bash_profile
    3. add lines
      export CATALINA_HOME
    4. exit nano, exit shell, and restart shell to get new environment set up
  5. Test that tomcat is working.
    1. cd ~CATALINA_HOME/bin
    2. ./startup.sh
    3. From browser, verify that http://your-web-domain-address:8080/ returns the default tomcat page
  6. Change tomcat to run on port 80 instead of 8080
    1. cd $CATALINA_HOME
    2. cp conf/server.xml conf/server.xml.original
    3. nano conf/server.xml
    4. replace all 8080 with 80, then exit and save
    5. bin/shutdown.sh
    6. bin/startup.sh
    7. From browser, verify that http://your-web-domain-address/ returns the default tomcat page
  7. Setup manager for Tomcat
    1. nano $CATALINA_HOME/conf/tomcat-users.xml
    2. add this user
      <role rolename="standard"/>
      <role rolename="manager"/>
      <user username="managername" password="managerpwd" roles="standard,manager"/>
      replace managername and managerpwd with your real, super-duper top-secret values
    3. restart tomcat
That's it. All done.

Installing ImageMagick with JPEG and PNG Support

ImageMagick is a set of command-line tools for manipulating image files. By default it supports GIF but not the other command interweb formats of JPG (JPEG) and PNG. These are the steps I followed to install ImageMagick on an Amazon EC2 Fedora core-4 Linux image.

This process is also described at Installing ImageMagick with JPEG, TIFF and PNG Support, but I had some problems with a couple of the commands there, it was using files older than the current, and it included TIFF support which I don't expect to be using.

The first step was to get the required source files for each of the components required. These are the files I retrieved, and the web addresses were I retrieved them. (Note, the exact version numbers change over time.) Each of the .tar.gz files I downloaded and copied to the /usr/local/src directory of my EC2 linux system.
from my linux image I then performed these commands (and in this order) to unpack, compile, and install the components and ImageMagick.
  1. cd /usr/local/src
  2. gunzip -c zlib-1.2.3.tar.gz | tar xvf -
  3. rm zlib-1.2.3.tar.gz
  4. cd zlib-1.2.3
  5. ./configure
  6. make
  7. make install
  8. cd /usr/local/src
  9. gunzip -c libpng-1.2.23.tar.gz | tar xvf -
  10. rm libpng-1.2.23.tar.gz
  11. cd libpng-1.2.23
  12. ./configure
  13. make
  14. make install
  15. cd /usr/local/src
  16. gunzip -c jpegsrc.v6b.tar.gz | tar xvf -
  17. rm jpegsrc.v6b.tar.gz
  18. cd jpeg-6b
  19. ./configure --enable-shared
  20. make
  21. make install
    [may need to create man directories]
  22. cd /usr/local/src
  23. gunzip -c ImageMagick.tar.gz | tar xvf -
  24. rm ImageMagick.tar.gz
  25. cd ImageMagick-6.3.7
  26. ./configure
    [verify that jpeg and png are on]
  27. make
  28. make install
Now run a simple test to see that ImageMagick is working
  1. cd /
  2. identify –list Format
    [verify that jpeg and png are on]
  3. convert logo: logo.gif
  4. convert logo: logo.jpg
  5. convert logo: logo.png
    [verify with separate viewer that this images are all OK]
That's it. The ImageMagick command are now ready.

Installing GCC on Amazon EC2 fedora core 4 base

I'm using the ec2-public-images/fedora-core4-base.manifest.xml image on Amazon's EC2 system. (I don't know how this differs from the develop-image.manifest.xml, but wanted to start with something as basic as possible).

This image comes without a GCC compiler. There's almost nothing you can make out of Linux without a compiler.

Adding a compiler is a piece of cake with this command
    yum install gcc
That's it. super easy. You can find more about yum (such as yum update) here.

Monday, October 1, 2007

Portable MP3 in car sounds great via Cassette Adapter

We recently purchased a new adapter for playing our ipod / iphone in the car: the Belkin Mobile Cassette Adapter. It sounds fantastic, especially compared to the old FM adapter we used to use. Those FM mp3 & ipod adapters require finding an empty band, squashing music, sound yucky, and cost a lot more. This cassette adapter was only about $15 at Fry's. Any quality FM adapter costs a whole lot more and doesn't sound nearly as good.

This cassette adapter worked right off with our old ipod mini. For the iPhone I used a razor blade to trim away the last eighth-inch or so of rubber off the end of the plug, so it fits into the recessed iphone ear jack, and it works great.

Monday, July 23, 2007

Get FolderShare to work with Windows and Macintosh

I think Microsoft's FolderShare is a very useful program for synchronizing programs across multiples computers (also makes a quick-and-easy backup solution). When I got my new MacBook Pro I was excited to see that they have a Mac version, as well as a Windows version, so that I could retain the same files, and backups, whether I'm working in Mac or Windows.

But I spent hours finding a way to make the files transfer from Windows to Mac (the other way around, Mac to Windows, worked fine from the get-go). Hours of toying with proxies, and my router, were a waste of time.

The solution (for me): Disable Encryption. In the Settings -> Transfers tab, when I turn off "Encrypt transfers" it works OK. When I leave it off, it fails.

It's working great for me now. My file bits are flying around the Internet unencrypted now, so please, everyone, don't peek. If anyone has a way to make FolderShare work between Mac and Windows with encryption, please let me know.

Wednesday, July 11, 2007

iPhone Audio Fix

Problem: My iPhone was not working in a lot of ways, all related to sound from the speakers or audio into the microphone. In general, audio was not working on my iPhone. The problem showed itself in various forms:
  • For a while, the keys and button presses were making no sound.
  • For a while, during phone calls I could hear and talk on speakerphone, but in regular phone I could not hear what the other party was saying and they could not hear me.
  • For a while, all audio failed for music, podcasts, etc... sound failed for everything except speakerphone.

Solution: Plug in the headphones. Listen to some music. Then pull out the headphones. This seems to have reset the internal states so that the iPhone audio is working again.