As an information sharing Wiki, I wanted to run Knowledge on a PC with Ubuntu 14.04. In order to test the execution in the local environment, I put Vagrant in Mac Book Pro and built a disguise environment.
The OS installed in the virtual machine this time is Ubuntu 14.04. I will post a memo from zero to moving Knowledge. Click here for the figure after moving. It's a pretty modern UI!
Proceed to access vagrant with ssh. Proceed to java installation.
It is different for users (jre) and developers (jdk).
If you want to install jre
sudo apt search openjdk-\(\.\)\+-jre$
If you want to install jdk
sudo apt search openjdk-\(\.\)\+-jdk$
This time, install ** openjdk-8 **. As of 2020/04, it seems better to run knowledge with openjdk-8 because there were times when it could be executed.
If you want to install jre
sudo apt install openjdk-8-jre
If you want to install jdk
sudo apt install openjdk-8-jdk
This explanation is easy to understand. Simply put, it is good to recognize that it is "environment construction software for a program (Java Servlet) written in Java that you want to run on a web server". Since it is an environment construction software for Java programs, software (Apache, etc.) that processes HTTP requests from the browser is also required separately.
However, this Tomcat, 8080 port is free, and it also has a simple web server function to process http requests. This allows you to test the java Servlet with tomcat alone.
Let's install Tomcat 9 this time. Normally, I prepare a user to run tomcat, but since it is vagrant, it is a little troublesome. I think the nice thing about virtual machines is that build & scrap is easy, so let's proceed as a vagrant user. Select the version from the tomcat download page. Alternatively, you can find the file by going to this path.
cd /opt
curl -O https://downloads.apache.org/tomcat/tomcat-9/v9.0.34/bin/apache-tomcat-9.0.34.tar.gz
tar -xzvf ./apache-tomcat-9.0.34.tar.gz
sudo chown -R vagrant:vagrant /opt/apache-tomcat-9.0.34
You need to make ubuntu's systemctl management target recognize the tomcat downloaded this time.
sudo vim /etc/systemd/system/tomcat.service
Write the following code in.
[Unit]
Description=Apache Tomcat 9
After=network.target
[Service]
User=vagrant
Group=vagrant
Type=oneshot
PIDFile=/opt/apache-tomcat-9.0.34/tomcat.pid
RemainAfterExit=yes
ExecStart=/opt/apache-tomcat-9.0.34/bin/startup.sh
ExecStop=/opt/apache-tomcat-9.0.34/bin/shutdown.sh
ExecReStart=/opt/apache-tomcat-9.0.34/bin/shutdown.sh;/opt/apache-tomcat-9.0.34/bin/startup.sh
[Install]
WantedBy=multi-user.target
Gives read permission.
sudo chmod 755 /etc/systemd/system/tomcat.service
Make the service executable.
sudo systemctl enable tomcat
After that, you can run / stop / restart with the following code.
sudo systemctl start[/stop/restart] tomcat
Try accessing ** http: // [vagrant machine IP]: 8080 ** to open the default Tomcat screen.
See Knowledge setup method. In short, you can download the knowledge war file and put it in the tomcat webapps folder.
In this procedure, you will put the war file in * / opt / apache-tomcat-9.0.34 / webapps *.
Then restart Tomcat.
sudo systemctl restart tomcat
This will unzip the war file. At this time, below the home of the user who runs tomcat The * .knowledge * file should have been created. if
--It doesn't work --I get a 404 error
If that happens, look at * knowledge / logs / app.log * and you will see the details of the error. ** When you access http: // [IP of vagrant machine]: 8080 / knowledge / **, you can open it safely.
I think that there are situations where Tomcat is used mainly when operating web UI business software. As mentioned in the explanation of Tomcat, the part that processes http requests is an extra function, so it should be used in combination with apache etc. I would like people who have spare capacity to do it.
Recommended Posts