I've inherited a dangerously out of date server. How do I plan to safely upgrade it?

Based on the versions of those packages, this appears to be Ubuntu Hardy 8.04 LTS. That's over five years old. Despite its age, official support only ended in May 2013 but it's never going to get security updates any longer and that's a problem.

The versions listed above were published in 2010 and that should highlight the urgency of the task at hand. This server is probably vulnerable to multiple remote exploits.

You could attempt in-place distribution upgrades to 12.04 (which is supported until 2017) but this means service interruption immediately and could mean things break. It could also take a couple of iterations to get to 12.04. It's just a messy idea.

I'd start afresh. New server, new Ubuntu install.

  1. Make a backup just in case it does just explode but otherwise leave the old server as it is. Whoever is currently using this server will not appreciate any downtime so leaving the old one up is your route to happy co-workers and a happy boss.

  2. Install Ubuntu 12.04 (or whatever the latest LTS is at the time of reading) on a new server (or virtual machine, however you've got things set up). If this is one of many servers at the company, it might be worth looking at hardware consolidation/redundancy techniques that virtualisation works well with.

  3. Build a list of things you need to get working from the old server. What websites are there running on it? What services do people depend on it providing? What IPs does it use? Can the IP be changed? How? Where? Who will that disrupt?

    By the end of this stage you should have a document telling you what you need to do.

  4. Install the packages from #3 but don't simply copy forward old configuration.

    It's really tempting to port /etc/ over from the old server but I've done similar things with PHP before and it set me back days. Use your observations from #3 and from playing around with the old server to build new a new configuration based on modern best practices.

  5. Copy your websites and databases over.

  6. Test and fix. I've no idea how long this will take because I've never upgraded a Tomcat website before but at the very least you need to make sure it still does everything it's supposed to.

  7. When you're happy it works, you'll need to copy over the data again from the old server (assuming people have been using it in the meantime).

  8. Unplug the old server and toss it into the sea. Or repurpose it. It's probably ancient and inefficient so it might not be a bad idea to

As Brendan mentions in the comments, you should be generating a ton of documentation between steps 3 and 6. If you just keep writing down what you're doing and why as you do things, it'll take you 30 minutes longer but it'll leave you with a solid plan for next time. When you're done, there may have been unneccessary steps you can skip next time so make sure you add a conclusion.

I would also be tempted to drop the previous owner and their boss a note about the state of the server and how dangerously negligent lapsed security updates are. You can do this without sounding like an interfering tool but that's optional.