Install Tomcat 8 In FreeBSD 10/10.1

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@Freebsd-unixmen:~ # pkg   install tomcat8
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01    
Fetching packagesite.txz: 100%    5 MiB 486.0kB/s    00:11    
Processing entries: 100%
FreeBSD repository update completed. 24086 packages processed
The following 5 packages will be affected (of 0 checked):

New packages to be INSTALLED:
        tomcat8: 8.0.18
        openjdk: 7.76.13_1,1
        java-zoneinfo: 2015.a
        javavmwrapper: 2.5
        jakarta-commons-daemon: 1.0.15

The process will require 165 MiB more space.
57 MiB to be downloaded.

Proceed with this action? [y/N]:

Configuration

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

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-8.0/conf/tomcat-users.xml
<tomcat-users xmlns="http://tomcat.apache.org/xml"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
              version="1.0">


<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"/>


</tomcat-users>

Lets start Tomcat

root@FreeBSd9:/usr/ports/www/tomcat7 # cd /usr/local/apache-tomcat-8.0/bin/

root@Freebsd-unixmen:/usr/local/apache-tomcat-8.0/bin # ./startup.sh 
Using CATALINA_BASE:   /usr/local/apache-tomcat-8.0
Using CATALINA_HOME:   /usr/local/apache-tomcat-8.0
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-8.0/temp
Using JRE_HOME:        /usr/local
Using CLASSPATH:       /usr/local/apache-tomcat-8.0/bin/bootstrap.jar:/usr/local/apache-tomcat-8.0/bin/tomcat-juli.jar
Tomcat started.
root@Freebsd-unixmen:/usr/local/apache-tomcat-8.0/bin # 

Check if the port 8080 listening

root@Freebsd-unixmen # netstat -an | grep 8080
tcp46      0      0 *.8080                 *.*                    LISTEN

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

Done!

转自:http://www.unixmen.com/install-tomcat-7-freebsd-9-3/

此条目发表在BSD分类目录,贴了, 标签。将固定链接加入收藏夹。