[JAVA] Install tomcat on Sakura's VPS

Premise

The level that I could only move for two days without knowing it myself. difficult. You can operate Linux and vim enough to run php on a rental server. The VPS contract has been completed at Sakura. CentOS 7 installed on Sakura's web console apache installed If you haven't done so far I understand even cats! Sakura's VPS course-2nd "Let's touch the server! Read and do exactly that. It's easy so far.

After that, mainly Procedure to install Apache Tomcat 9 on CentOS 7 I will proceed with reference to Here, I will only add that I was stuck, so please come back only if you could not do the above.

Do big things (because there are dependencies, you may fail if you do not do it in order from the top)

Install Java Install tomcat Set firewall from terminal Release the port from Sakura's console.

java Install jdk. ** (Since it is not upward compatible, make it a compatible version of the framework you want to use. It is not OK if it is new.) ** Just do yum install.

TomCat First, somehow download it to the server. (Also choose the one that matches the java version. It doesn't mean that it should be new.)

When you google, people will teach you various ways, but there are so many things that you don't know. You can either log in to the server and use the curl or wget command, or download it locally from a GUI browser and copy it to the server via ftp. Everything is the same, so you can copy and paste the method you know and rewrite only the version. For the version, check the currently available number on the tomcat official page and replace it.

After downloading, move to the specified directory and unzip. This is also written in various ways Anything below / opt / looks good? / opt / tomcat There was an article written in a directory like /opt/apache-8.0.5-tomcat-M24/. ** * It is necessary to rewrite the path name decided here in the setting file that will appear later, so if you can not start Tomcat, check the path installed here. ** **

Register the service. (This is a mess for me. If you want to know it properly, please see other people.) I'm not sure, but if you don't make it correctly and start it successfully, Tomcat won't start. I'm addicted to it, so I'll write the tips for copying the reference page.

/etc/systemd/system/tomcat.service

[Unit]
Description=Apache Tomcat 9
After=network.target

[Service]
User=tomcat
Group=tomcat
Type=oneshot
PIDFile=/opt/apache-tomcat-9.0.0.M21/tomcat.pid
RemainAfterExit=yes

ExecStart=/opt/apache-tomcat-9.0.0.M21/bin/startup.sh
ExecStop=/opt/apache-tomcat-9.0.0.M21/bin/shutdown.sh
ExecReStart=/opt/apache-tomcat-9.0.0.M21/bin/shutdown.sh;/opt/apache-tomcat-9.0.0.M21/bin/startup.sh

[Install]
WantedBy=multi-user.target

As conclusion /opt/apache-tomcat-9.0.0.M21/ Match the part of to the name of the directory where you unzipped tomcat earlier. Please note that it is not always the case to change the downloaded version name. I was addicted to it. In my case, it was /opt/tomcat/bin/startup.sh. Use cd / opt / to ls to see what you named it. If you make a mistake here, you will be covered with errors when you type the confirmation command later.

After chmoding and systemctl enable tomcat systemctl start tomcat.

This page explains some of the meanings of the above code. ↓ How to write a * .service file for systemd

Until I read this page, I didn't know what the settings were, but it seems that the order in which the apps registered in the startup are started is specified in After or Before, and the script file specified in the Exec ~ line is started. Seems to be the main function. (.sh is a shell script) I think it's a system like Ant, Gradele, Marven, etc. in Java or PHP. (maybe)

firewalld settings

If you copy the entire code of the reference page described at the top of this page and copy the entire command, it will work, so I will omit it. If you dare to write, there is a version name in tomcat.xml, but the tag is just a description (like a print or echo command), so just rewrite it so that you can understand the version name.

Release the port from Sakura's console.

I can't find a site that explains this for some reason, but in the case of Sakura VPS, the port is restricted from the WEB console by default, so I have to stop or release only the necessary ports to connect to the 8080 port. can not. The console address came by email when you subscribed to Sakura's VPS, so please enter from the link there.

Operation check

If you can set it correctly, enter the server as an administrator /opt/tomcat/webapps/ If you create a folder of your choice below, it will be the project root. Since an application called examples is included from the beginning for the operation check test of tomcat (if it does not exist, make it appropriately and make index.html) In the browser xxx.xxx.xx.xx:8080/example (Rewrite x to the IP address you got)

If the sample is displayed, it is successful.

Also xxx.xxx.xx.xx:8080 Just type and you should see the default page for Tomcat. I tried pressing the Manager App button and it was played. There seems to be another setting to enter the management screen. very··

Recommended Posts

Install tomcat on Sakura's VPS
Install Ruby on Sakura's VPS
Install tomcat + eclipse on mac
Install Java, Apache, Tomcat9 on EC2 (Amazon Linux2)
Install gradle on mac
Install Corretto 8 on Windows
Install OpenJDK on macOS
Install Golang on CentOS 8
Install pyqt5 on ubuntu
Install Neo4j 4.1.3 on centOS
Tomcat v8 on CentOS7
Install Docker on Manjaro
Install Vertica 10.0 on CentOS 6.10
Install Ruby on Ubuntu 20.04
Install PostgreSQL 12 on Centos8
Install nginx on centOS7
Install lombok on SpringToolSuite4
Install Python 3 on CentOS 7
Install kuromoji on CentOS7
Install Autoware on Ubuntu 18.04.5
Install Mattermost on CentOS 7
Install PostGIS 2.5.5 on CentOS7
Install jpndistrict on CentOS 7
Install openjdk11 on mac
Install Homebrew on Ubuntu 20.04
1002 error on tomcat + webSocket
Install Redmine 4.1.1 on CentOS 7
Install OpenJDK 8 on mac
Smokeping Install on CentOS7
Install PostgreSQL 13 on CentOS 7.5
Install Docker on Windows 10 PRO
Install OpenJDK7 (JAVA) on ubuntu 14.04
Install Cybozu Office 10 on Ubuntu 20.4
Install Docker on Ubuntu Server 20.04
Install Sidekiq pro on Rails
Install rbenv on Amazon Linux
Install zabbix agent (5.0) on Ubuntu 18.04
Install MAV Proxy on Ubuntu 18.04
Install OpenFOAM v2006 on CentOS
Install Arudino IDE on Ubuntu 20
Install Java on WSL Ubuntu 18.04
Install Jenkins on Docker's CentOS
Install Ubuntu Desktop 20.10 on RaspberryPi4
Install Apache on CentOS on VirtualBox
Install Arduino IDE on Ubuntu 20.04
Install Rails on macOS Catalina
Install raspi-config on Ubuntu 20.04 (LTS)
Install Ruby 2.7 on RHEL 8 (AppStream)
Install docker on AWS EC2
Install WordPress 5.5 on Ubuntu 20.04 LTS
Install Ruby 2.7 on CentOS 7 (SCL)
Install PlantUML on Intellij on Ubuntu
Install Ubuntu Server 20.04 on Btrfs
Note: Install PostgreSQL 9.5 on Ubuntu 18.04
Install tomcat plugin in eclipse
Install java 1.8.0 on Amazon linux2
Install openjdk8 on Docker image (Debian)
OpenShift 4.6 UPI install on bare metal
Try DPDK20 SDK on CentOS7 ①Install
Install MariaDB on Raspberry Pi OS
Install Docker on AWS Ubunt 20.04 LTS