1) Update System
sudo apt-get update && sudo apt-get upgrade -y
2) Install open-jdk
sudo apt-get install openjdk-11-jdk -y
3) Download Apache Tomcat and extract tomcat to your Linux Machine
cd /opt/
sudo wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.50/bin/apache-tomcat-9.0.50.tar.gz
sudo tar -zxvf apache-tomcat-9.0.50.tar.gz
sudo mv apache-tomcat-9.0.50 tomcat
sudo chmod -R 777 tomcat
# Update vagrant user as per your requirement
sudo chown -R vagrant:vagrant tomcat
4) Configure Apache Tomcat 9 as system service.
Open tomcat service file sudo vi /etc/systemd/system/tomcat.service
Add below content.
[Unit]
Description=Tomcat 9
After=network.target
[Service]
Type=forking
# Update users as per target machine
User=vagrant
Group=vagrant
Environment="JAVA_OPTS=-Djava.security.egd=file:///dev/urandom"
Environment="CATALINA_BASE=/opt/tomcat"
Environment="CATALINA_HOME=/opt/tomcat"
Environment="CATALINA_PID=/opt/tomcat/temp/tomcat.pid"
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
5) Start tomcat service
sudo systemctl start tomcat
5) Check tomcat service
sudo systemctl status tomcat
6) Enable tomcat service
sudo systemctl enable tomcat
No comments:
Post a Comment