OPERATING SYSTEMSOS Linux

Install Tomcat on Ubuntu



Help you install tomcat and start using this webserver on Ubuntu. First, the JDK needs to be installed first in order to install tomcat. If you don’t have JDK installed then start by installing JDK or if you have it already installed then skip the JDK installation step. If you don’t know whether JDK is installed on your system or not then you can simply run this command in terminal:

$ javac

If it results in error, it means that there is no JDK installed. If JDK is not installed on your system then you can install it by using the following command in terminal:

$ sudo apt-get install openjdk-12-jdk

Make sure you watch complete video because command and data given won’t make sense without watching entire video.
All the commands and data used in the video is given below:

$ sudo groupadd tomcat
$ sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
$ sudo mkdir /opt/tomcat
$ wget https://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.45/bin/apache-tomcat-8.5.45.tar.gz
$ sudo tar xzvf apache-tomcat-8*tar.gz -C /opt/tomcat –strip-components=1
$ cd /opt/tomcat
$ sudo chgrp -R tomcat /opt/tomcat
$ sudo chmod -R g+r conf
$ sudo chmod g+x conf
$ sudo chown -R tomcat logs
$ sudo update-java-alternatives -l
$ sudo nano /etc/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking
Environment=JAVA_HOME=paste the copied path
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
Exe

cStop=/opt/tomcat/bin/shutdown.sh
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

$ sudo systemctl daemon-reload
$ sudo systemctl start tomcat
$ sudo systemctl status tomcat
$ sudo ufw allow 8080
$ sudo nano /opt/tomcat/conf/tomcat-users.xml

user username=”admin” password=”password” roles=”manager-gui,admin-gui”/

$ sudo chown tomcat work
$ sudo systemctl restart tomcat

The File Permission Video (chmod):


source
ubuntu download

Leave a Reply

Your email address will not be published. Required fields are marked *