1

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)

1

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.

1

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.

0

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

  • I found at the dependency should already be provided. Updated the question. – Bart van Heukelom May 24 '12 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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