Installare una versione specifica di Tomcat in Debian

From RVM Wiki
Revision as of 17:37, 8 April 2015 by Gabriele.vivinetto (talk | contribs) (Created page with "{{Stub}} * Installare Java * Creating a new user, sans password, no direct logins <pre> sudo adduser \ --system \ --shell /bin/bash \ --gecos 'Tomcat Java Servlet a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Attenzione questo articolo è ancora incompleto.
Sentiti libero di contribuire cliccando sul tasto edit.


  • Installare Java
  • Creating a new user, sans password, no direct logins
	
sudo adduser \
  --system \
  --shell /bin/bash \
  --gecos 'Tomcat Java Servlet and JSP engine' \
  --group \
  --disabled-password \
  --home /home/tomcat \
  tomcat
  • Installing Tomcat7

Downloading and unarchiving the archive 1 2 3

$ cd /tmp $ wget http://mirror.cogentco.com/pub/apache/tomcat/tomcat-7/v7.0.37/bin/apache-tomcat-7.0.37.tar.gz $ tar xvzf ./apache-tomcat-7.0.37.tar.gz Moving the distribution into /usr/share/tomcat7 1 2

$ sudo mkdir /usr/share/tomcat7 $ sudo mv /tmp/apache-tomcat-7.0.37 /usr/share/tomcat7

To make it easy to replace this release with future releases, we are going to create a symbolic link that we are going to use when referring to Tomcat (after removing the old link, you might have from installing a previous version): Linking tomcat to tomcat7.x.x 1 2

$ sudo rm -f /usr/share/tomcat $ sudo ln -s /usr/share/tomcat7/apache-tomcat-7.0.37 /usr/share/tomcat

Since we created a tomcat user, he should also own all these files in Changing ownership and make scripts executable 1 2

$ sudo chown -R tomcat:tomcat /usr/share/tomcat7 $ sudo chmod +x /usr/share/tomcat/bin/*.sh

If Tomcat’s default HTTP port (8080) is already in use, you need to edit the server.xml configuration file, e.g. edit /usr/share/tomcat/conf/server.xml and replace 8080 with 8000

Starting Tomcat Tomcat Startup 1 2 3 4 5 6 7

$ sudo /bin/su - tomcat -c /usr/share/tomcat/bin/startup.sh

Stopping Tomcat Tomcat Shutdown 1 2 3 4 5 6 7

$sudo /bin/su - tomcat -c /usr/share/tomcat/bin/shutdown.sh Tomcat Startup/Shutdown 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

  1. !/bin/sh
      1. BEGIN INIT INFO
  2. Provides: Tomcat
  3. Required-Start: $network
  4. Required-Stop: $network
  5. Default-Start: 2 3 5
  6. Description: Java Servlet and JSP Engine
      1. END INIT INFO

case "$1" in 'start')

   /bin/su - tomcat -c /usr/share/tomcat/bin/startup.sh
   ;;

'stop')

   /bin/su - tomcat -c /usr/share/tomcat/bin/shutdown.sh
   ;;
  • )
   echo "Usage: $0 { start | stop }"
   ;;

esac exit 0


Riferimenti