Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this script line to install all packages for a new server.

apt-get install mysql-server openjdk-7-jre-headless tomcat7 tomcat7-admin jsvc apache2 ntp subversion

As you can see it installs Java 7, but Java 6 is also installed because tomcat7 (indirectly) depends on it. I'm pretty sure I can run Tomcat 7 with Java 7, so I don't want to install two JREs. How can I prevent Java 6 from being installed?

Update: Closer inspection shows that

  • tomcat7, via tomcat-common, depends on default-jre-headless | java6-runtime-headless | java6-runtime | java-6-runtime (assuming the pipes mean "one of").
  • openjdk-7-jre-headless provides java6-runtime-headless, so that dependency should be met.
  • Instead, default-jre-headless is installed, which installs Java 6.

Why does that happen? Is it because I install them all at once. Should I split it up into 2 calls?

(Ubuntu 12.04 server, 64-bit)

share|improve this question

Use --nodeps option with apt-get to ignore dependencies being installed.

There is another way is that you download a package and install it with dpkg with --ignore-depends=package,...

A GUI package manager such as Synaptic, will make you able to select-deselect the dependencies before installation of selected packages.

share|improve this answer

Actually the line above does not install Java 6. At some point in the development of the script I had openjdk-7-jre-lib there, instead of openjdk-7-jre-headless, and that one depends on openjdk-6-jre-lib, for some reason.

share|improve this answer

Create a debian package that "Provides: " the dependency you do not want to install. Install it.

share|improve this answer
I found at the dependency should already be provided. Updated the question. – Bart van Heukelom May 24 '12 at 11:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.