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.
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)
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
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.
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