Installing tomcat on Ubuntu
How to find java version
Install Tomcat on CentOS 7
To install tomcat on Ubuntu 18.04, run
1 |
apt install tomcat9 |
Start tomcat with
1 |
systemctl start tomcat9 |
Once tomcat started, you will be able to see it at
http://your-ip-addr:8080/
You can verify tomcat running with netstat
1 2 3 4 |
root@magmito-server:~# netstat -lntp | grep java tcp6 0 0 127.0.0.1:8005 :::* LISTEN 2921/java tcp6 0 0 :::8080 :::* LISTEN 2921/java root@magmito-server:~# |
Tomcat default home page is
1 |
/var/lib/tomcat9/webapps/ROOT/index.html |
Some other folders
1 2 |
CATALINA_HOME=/usr/share/tomcat9 CATALINA_BASE=/var/lib/tomcat9 |
Deploying Application
You can upload war file to /var/lib/tomcat9/webapps folder. When you upload war file, it get auto extracted to the folder.
To deplay sample application, do following
1 2 |
cd /var/lib/tomcat9/webapps/ wget https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/sample.war |
Now you will see “sample” folder (/var/lib/tomcat9/webapps/sample). You can access the application with url
1 |
http://your-ip-addr:8080/sample/ |