1

On our server we have two tomcat8 installations on debian wheezy. One tomcat was installed via apt-get install , the second instance was then just copied from the first installation. But this makes it complicated to maintain. I only get automatic updates (apt-get update, apt-get upgrade) for the first installation, the second installation needs to be updates manually.

Is there a way to install and update two installtions of tomcat via apt-get?

  • Can you explain the context a little more. Tomcat is a server, right? Why do you need two of them on one machine? – Faheem Mitha Jan 15 '15 at 12:01
  • The setup with 2 tomcats is required by the applications we run on it, no chance to change it in short term. – markus Jan 15 '15 at 13:11
  • Ok, but some more details might he helpful. Do some apps use one server and some apps the other server? Do the servers need to be exactly the same version? – Faheem Mitha Jan 15 '15 at 15:37
  • yes some apps are deployed in server one and other ones in server2. Both tomcat servers should have the same version. – markus Jan 15 '15 at 17:03
  • Ok, if you want to independent versions both installed from upstream and which will be maintained by upstream, I think installing one in a chroot and making it available to the main system might be an option. The chroot can probably be set up to be updateable via apt. – Faheem Mitha Jan 16 '15 at 0:28
2

Don't copy the files. You can run multiple copies of the same executable.

If you really need to have tomcat installed in another directory hierarchy, make symbolic links. You can use a script like this:

dpkg -L tomcat6 tomcat6-common |
while IFS= read -r x; do
  if ! [ -d "$x" ]; then
    mkdir -p "/srv/alt-tomcat/${x%/*}"
    ln -s "$x" "/srv/alt-tomcat/$x"
  fi
done    

You'll still need to update the symbolic links when the list of files contained in the package changes, but not for security updates and other bug fixes.

  • Would two servers run OK independently in that kind of setup? What about them running on the same ports, because presumably the config would be identical too? – Faheem Mitha Jan 16 '15 at 0:29
  • @FaheemMitha You would of course run the two servers with different configuration files. But unless there's something really weird about tomcat (which I can't completely rule out), you wouldn't duplicate any of the files from the distribution, only the configuration file which you'd modify anyway. – Gilles Jan 16 '15 at 0:39
  • Thanks for that hint, I will try it out in our demo environment and let you know. – markus Jan 16 '15 at 8:22

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.