1.Установка Java
|
# apt-get update && apt-get install default-jdk |
|
# update-alternatives --config java |
|
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" |
|
# source /etc/environment |
|
/usr/lib/jvm/java-8-openjdk-amd64 |
|
# update-java-alternatives -l |
|
java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64 |
2.Установка Tomcat Последняя 8.5.X-версия доступна по адресу http://tomcat.apache.org/download-80.cgi Создаем группу и пользователя tomcat, под которыми будет запускаться Tomcat-сервер
|
# useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat |
|
# cd /tmp/ && wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.34/bin/apache-tomcat-8.5.34.tar.gz |
|
# tar xvzf apache-tomcat-8*.tar.gz -C /opt/tomcat/ --strip-components=1 && rm /tmp/apache-tomcat-8* |
|
# chown -R tomcat /opt/tomcat/ |
Создание UNIT-файла и запуск Tomcat
|
# nano /etc/systemd/system/tomcat.service |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
[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 Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_BASE=/opt/tomcat Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom' ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh User=tomcat Group=tomcat UMask=0007 RestartSec=10 Restart=always [Install] WantedBy=multi-user.target |
|
# systemctl daemon-reload |
|
# systemctl status tomcat |
3.Настройка Iptables
|
# iptables -A INPUT -p tcp --dport 8080 -j tomcat |
|
# iptables -I tomcat -s my_ip_address -j ACCEPT |
|
# apt-get update && apt-get install netfilter-persistent && /etc/init.d/netfilter-persistent save |
4.Настройка Tomcat […]