Install Tomcat 7 In FreeBSD 9.3


Please shareShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on RedditDigg thisShare on StumbleUpon

From Wikipedia,

Apache Tomcat is an open source web server and servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, and provides a pure Java HTTP web server environment for Java code to run in. In the simplest config Tomcat runs in a single operating system process. The process runs a Java virtual machine (JVM). Every single HTTP request from a browser to Tomcat is processed in the Tomcat process in a separate thread.

My testbox details:

root@FreeBSd9:~ # uname -a
FreeBSD FreeBSd9.3 9.3-RC1 FreeBSD 9.3-RC1 #0 r267656: Fri Jun 20 02:13:42 UTC 2014 amd64

Install  Tomcat 7

I was trying to install from the ports  (/usr/ports/www/tomcat7 ) then i got many issues, finally i stopped the installation and started with the pkg tool.

Now, lets start:

root@FreeBSd9:/usr/ports/www/tomcat7 # pkg install tomcat7
Updating repository catalogue
The following 15 packages will be installed:

Installing recordproto: 1.14.2
Reinstalling libxcb-1.10_2 (needed shared library changed)
Installing xbitmaps: 1.1.1
Installing printproto: 1.0.5
Installing javavmwrapper: 2.5
Installing java-zoneinfo: 2014.c
Reinstalling libX11-1.6.2_2,1 (needed shared library changed)
Installing libXp: 1.0.2_2,1
Installing libXmu: 1.1.2_2,1
Installing libXtst: 1.2.2_2
Installing libXaw: 1.0.12_2,2
Installing open-motif: 2.3.4_1
Installing openjdk6: b31_3,1
Installing jakarta-commons-daemon: 1.0.15
Installing tomcat7: 7.0.54

The installation will require 192 MB more space

63 MB to be downloaded

Proceed with installing packages [y/N]: y

This OpenJDK implementation requires fdescfs(5) mounted on /dev/fd and procfs(5) mounted on /proc.

If you have not done it yet, please do the following:

mount -t fdescfs fdesc /dev/fd
 mount -t procfs proc /proc

To make it permanent, you need the following lines in /etc/fstab:

fdesc /dev/fd fdescfs rw 0 0 proc /proc procfs rw 0 0

Now, Tomcat is ready to start. Before that lets edit the user files to add users/admins and managers.

Edit the users file (my example file)

 vim /usr/local/apache-tomcat-7.0/conf/tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
 <role rolename="manager-gui"/>
 <role rolename="manager-script"/>
 <role rolename="manager-jmx"/>
 <role rolename="manager-status"/>
 <role rolename="admin-gui"/>
 <role rolename="admin-script"/>
 <user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>

Lets start Tomcat:

 root@FreeBSd9:/usr/ports/www/tomcat7 # cd /usr/local/apache-tomcat-7.0/bin/
 root@FreeBSd9:/usr/local/apache-tomcat-7.0/bin # ls
 bootstrap.jar commons-daemon.jar tomcat-native.tar.gz
 commons-daemon-native.tar.gz tomcat-juli.jar
 root@FreeBSd9:/usr/local/apache-tomcat-7.0/bin # ./
 Using CATALINA_BASE: /usr/local/apache-tomcat-7.0
 Using CATALINA_HOME: /usr/local/apache-tomcat-7.0
 Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0/temp
 Using JRE_HOME: /usr/local
 Using CLASSPATH: /usr/local/apache-tomcat-7.0/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0/bin/tomcat-juli.jar
 Tomcat started.
 root@FreeBSd9:/usr/local/apache-tomcat-7.0/bin #

Normally, the server is listening on port 8080. Check that with:

root@FreeBSd9:~ # netstat -an | grep 8080
tcp46      0      0                    *.8080             *.*                       LISTEN

Now, navigate to http://ip:8080 or http://hostname:8080.

freebsdunixmen1 freebsdunixmen2 freebsdunixmen3 freebsdunixmen4