Due to the consistency requirements of the company's products, we switched from Jetty to GlassFish3.1.2. this time we installed GlassFishwebprofile on Ubuntu12.04Server (64bit). This article mainly comes from idea
Due to the consistency requirements of the company's products, we switched from Jetty to GlassFish3.1.2. this time we installed GlassFish web profile on Ubuntu 12.04 Server (64bit.
The content of this paper mainly comes from http://www.nabisoft.com/tutorials/glassfish/installing-glassfish-311-on-ubuntu
The preceding section is very comprehensive. I deleted the section iptables that is not required because we use nginx for forwarding. It also solves some other problems.
For example, GlassFish3.1.2 has changed the security rules. Some additional steps are required.
1. Install JDK and set environment variables.
I installed jdk1.6.
- Root @ www.linuxidc.com :~ # Java-version
- Java version "1.6.0 _ 32"
- Java (TM) SE Runtime Environment (build 1.6.0 _ 32-b05)
- Java HotSpot (TM) 64-Bit Server VM (build route 7-b02, mixed mode)
2. Create a dedicated account
Create a glassfish SYSTEM account first
- # Adduser -- home/glassfish -- system -- shell/bin/bash glassfish
- Adding system user 'glassfish '(UID 108 )...
- Adding new user 'glasshai' (UID 108) with group 'nogroup '...
- Creating home directory '/home/glassfish '...
Create a user group glassfishadmin
- # Groupadd glassfishadm
Add glassfish to the glassfishadm group, and set the directory of the glassfishadmin group to/home/glassfish.
- # Usermod-a-G glassfishadm glassfish
- Chgrp-R glassfishadm/home/glassfish
3. Install unzip
- Apt-get install unzip
4. Download glassfish
Switch to the glassfish user and download and decompress
- Su glassfish
- Cd/home/glassfish
- Mkdir downloads
- Cd downloads
- Wget http://download.java.net/glassfish/3.1.2/release/glassfish-3.1.2-web.zip
- Unzip glassfish-3.1.2.zip
Copy the extracted file to the/hom/glassfish directory, and then exit the user.
- Mv/home/glassfish/downloads/glassfish3/*/home/glassfish/
- Mv/home/glassfish/downloads/glassfish3/. org. opensolaris, pkg/home/glassfish/. org. opensolaris, pkg
- Exit
5. modify directory permissions
Make sure that the program runs under the glassfish user
- Root @ www.linuxidc.com :~ # Chown-R glassfish/home/glassfish
- Root @ www.linuxidc.com :~ # Chmod-R ug + rwx/home/glassfish/bin/
- Root @ www.linuxidc.com :~ # Chmod-R ug + rwx/home/glassfish/bin/
- Root @ www.linuxidc.com :~ # Chmod-R o-rwx/home/glassfish/bin/
- Root @ www.linuxidc.com :~ # Chmod-R o-rwx/home/glassfish/bin/
6. Modify the port
Modify/hom/glassfish/domains/domain1/config/domain. xml as follows:
- <Network-listeners>
- <Network-listener Port="8081" Protocol=Http-listener-1" Transport="Tcp" Name=Http-listener-1" Thread-pool="Http-thread-pool"> Network-listener>
- <Network-listener Port="8181" Protocol=Http-listener-2" Transport="Tcp" Name=Http-listener-2" Thread-pool="Http-thread-pool"> Network-listener>
- <Network-listener Port="4848" Protocol="Admin-listener" Transport="Tcp" Name="Admin-listener" Thread-pool="Admin-thread-pool"> Network-listener>
- Network-listeners>
In this way, http uses 8081, https uses 8181, and AdminGUI uses port 4848.