mbrainiac
(usa Debian)
Enviado em 23/03/2018 - 10:04h
Instalação do tomcat9:
root@brainiac-desktop:/usr/local# ls
apache-tomcat-9.0.6 etc include lib netbeans-8.2 share
bin games jdk1.8.0_111 man sbin src
root@brainiac-desktop:/usr/local# cd apache-tomcat-9.0.6
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# chgrp -R tomcat /usr/local/apache-tomcat-9.0.6
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# chmod -R g+r conf
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# chmod g+x conf
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# chown -R tomcat webapps/ work/ temp/ logs/
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6#
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# update-java-alternatives -l
java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64
java-1.9.0-openjdk-amd64 1091 /usr/lib/jvm/java-1.9.0-openjdk-amd64
java-8-oracle 1081 /usr/lib/jvm/java-8-oracle
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6# nano /etc/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre
Environment=CATALINA_PID=/usr/local/apache-tomcat-9.0.6 /temp/tomcat.pid
Environment=CATALINA_HOME=/usr/local/apache-tomcat-9.0.6
Environment=CATALINA_BASE=/usr/local/apache-tomcat-9.0.6
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/usr/local/apache-tomcat-9.0.6/bin/startup.sh
ExecStop=/usr/local/apache-tomcat-9.0.6/bin/shutdown.sh
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
F2 S(sim)
Next, reload the systemd daemon so that it knows about our service file:
root@brainiac-desktop:/usr/local# systemctl daemon-reload
root@brainiac-desktop:/usr/local# systemctl start tomcat
To ensure the Tomcat service re-starting at boot, you have to enable it:
root@brainiac-desktop:/usr/local# systemctl enable tomcat
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6/conf# ls
Catalina context.xml logging.properties tomcat-users.xsd
catalina.policy jaspic-providers.xml server.xml web.xml
catalina.properties jaspic-providers.xsd tomcat-users.xml
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6/conf# nano tomcat-users.xml
colar dentro da tag <tomcat-users> </tomcat-users>:
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui,admin-gui"/>
F2 S(sim)
root@brainiac-desktop:/usr/local/apache-tomcat-9.0.6/conf# systemctl restart tomcat
No browser digite localhost:8080
http://tinypic.com/view.php?pic=b7c0mq&s=9#.WrT6itYh0b0
Clicando com user tomcat e pass tomcat:
http://tinypic.com/view.php?pic=30sbw1x&s=9#.WrT7UtYh0b0