Gijs Molenaar has build OpenCV 2.1 packages for Ubuntu Lucid and Karmic. You don’t need to compile OpenCV anymore if you use these packages, except for when you want something special like enable IPP. Jaunty packages are also available but not updated anymore.
Ubuntu_Packages - OpenCV Wiki