âAccording to Apache website âThe Apache TomcatÂ® software is an open-source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies. The Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket specifications are developed under the Java Community Process.â
The last stable release is Tomcat 8.5.15.
How To Install Tomcat Server?
If we were to install on Ubuntu desktop we just had to go to Tomcat download page and choose the format to download it. Since we are using command line we have to download it using the link to the compressed file. This process was tested on from tomcat7 to tomcat9 alpha. To do it run the command bellow on the command line:
$ wget http://www-us.apache.org/dist/tomcat/tomcat-8/v8.5.14/bin/apache-tomcat-8.5.14.tar.gz
$ sudo mv apache-tomcat-8.5.14.tar.gz /var/opt/
âStep 2.5 (optional):
âTo avoid asking for password change to superuser.
$ sudo su
âExtract the files.
$ tar -xvzf apache-tomcat-8.5.14.tar.gz tomcat
Note that if you didnât use step 2.5 you will have to use the above command with sudo
Create the init script in /etc/init.d/tomcat8 and include the information below -
### BEGIN INIT INFO
# Provides: tomcat7
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop Tomcat server
### END INIT INFO
case $1 in
restart) stop; start;;
*) echo "Run as $0 "; exit 1;;
Change its permissions and add the correct symlinks automatically:
$ chmod 755 /etc/init.d/tomcat7
$ update-rc.d tomcat7 defaults
Now your tomcat will start when your system starts and you can control it with service tomcat7 <stop|start|restart>
Note for starting Tomcat you must have OpenJDK or JDK installed.
âThere are many solutions for running web server applications and this is only one of them. If you are a web developer or server admin, this script could help you keep your server always up, without needing to get worried if you forgot to run in on your system start. Leave your thoughts in the comment section below.