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
, viatomcat-common
, depends ondefault-jre-headless | java6-runtime-headless | java6-runtime | java-6-runtime
(assuming the pipes mean "one of").openjdk-7-jre-headless
providesjava6-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)
Use
--nodeps
option withapt-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.
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 ofopenjdk-7-jre-headless
, and that one depends onopenjdk-6-jre-lib
, for some reason.Create a debian package that "Provides: " the dependency you do not want to install. Install it.