Glassfish_Solaris
Introduction
This guide is dedicated to installing XWiki on Solaris 11 using Glassfish V3. The setup is meant for larger organizations comprising of a front-end Java container and back-end database server.
For the purposes of this guide, FreeBSD 8.2 will be used with PostgreSQL 9.1 database server as the backend.
For our test purposes the front-end Glassfish server will have an IP address of 172.99.99.2 and the back-end database server will have an IP address of 172.99.99.5.
Network Topology
For the test network, a FreeBSD based router will be used using the dynamic routing protocol RIPv2 - connected to a Cisco 857W router which will redistribute the default route using the default-information originate command under dynamic router configuration mode in order to redistribute the gateway of last resort definition and/or the local subnets of the internal network.
The full diagram of our network:
Quick check to show that all is well:
172.99.0.0/28 is subnetted, 1 subnets
R 172.99.99.0 [120/1] via 192.168.0.200, 00:00:17, BVI2
FreeBSD 8.2:
gw# netstat -r
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.0.1 UG1 1 0 em0
localhost link#3 UH 0 0 lo0
172.99.99.0/28 link#2 U 0 71 em1
172.99.99.1 link#2 UHS 0 0 lo0
192.168.0.0 link#1 U 1 88 em0
192.168.0.200 link#1 UHS 0 0 lo0
192.168.1.0 192.168.0.1 UG1 1 5 em0
192.168.2.0 192.168.0.1 UG1 0 0 em0
FreeBSD 8.2 Database Server
To start with lets setup the backend database server!
First the PostgreSQL server needs to be built from the ports collection:
make install clean
From here we need to activate the PostgreSQL server on boot by adding to the /etc/rc.conf file:
Now we are going to initialize the database content and create the data directory in order for the postgres service to be able to get configured. The steps being taken are to login as the pgsql user with administrative privileges then run the initdb command:
initdb -D /usr/local/pgsql/data
PostgreSQL has now been setup in order to use as a full-functional database service. The xwiki role and database must now be created. From the same pgsql user as before, we must access the PostgreSQL CLI ( ):
>CREATE ROLE xwiki WITH PASSWORD 'xwiki' LOGIN;
>CREATE DATABASE xwiki OWNER xwiki ENCODING 'UTF8';
In order to be able to login to the database server as either 'local' or 'remote' host the pg_hba.conf file needs to be edited. The file's location on FreeBSD if built from Ports is /usr/local/pgsql/data/pg_hba.conf, and the addition that needs to be made is this:
The next step is to edit the /usr/local/pgsql/data/postgres.conf file and change the listen_addresses from 127.0.0.1 to *. Then finally restart the service:
PostgreSQL has now been setup!
Solaris 11
Download Solaris 11 Text based installer from the official download page.
After Solaris 11 has been installed and the correct IP address setup and the system booted into full operation-mode, a package refresh needs to be performed in order to ensure that the installed packages are up-to-date.
pkg update *
From here we will now install the GUI (FOR TEST PURPOSES ONLY! A GUI should NEVER be installed on a server as it's a huge security risk and wastes valuable RAM for nothing), and additionally the JDK 6 environment:
pkg install jdk-6
Enable GDM by:
Next up we will download the Glassfish V3 installer
From here we will make the script executable, then run it:
./ogs-3.1.1-ml-unix.sh
Choose the /opt directory to install the Glassfishv3 instance in; this will make the system easier to administrate later on.
The install process should look like this:
Tie Glassfish into the SMF descriptions by creating a 'service':
Then enable the default domain, hence 'starting' the Glassfish server in general:
We can check from here that the service is running by using the netstat command:
This should indicate that the Glassfish ports: 4848, 8080, and 8181 are 'online' and 'accepting' communications.
Now point Firefox in the Solaris GUI to: http://127.0.0.1:4848
The result should be:
Download the 'latest' Postgres JDBC driver from here and copy it to /opt/glassfish3/glassfish/domain1/lib/ on the Glassfish server.
Restart the Glassfish instance using:
Then from the web GUI, goto JDBC Connection Pools and create a 'new' connection called postgresql and save.
Edit the connection pool (this can be done on creation as well) and choose javax.sql.ConnectionPoolDataSource as the data source, and postgresql as the database driver.
From there edit the JDBC Pool Properties and add:
PortNumber: 5432
Password: xwiki
User: xwiki
DatabaseName: xwiki
to the list.
The pen-ultimate stage is to download the xwiki.war file of the 'latest' version and add it to Glassfish. This can simply be done by going to the web GUI then, Applications and loading an External application in to the server.
Once that has been completed the last and ultimate stage is to download the xwiki.xar file and import that into the XWiki instance.
First of all create a user called Admin with whatever password is desired however to keep in line with previous XWiki versions where the username and password was pre-set, I have chosen admin as the password.
Go to the XWiki administration panel after logging in, and choose to Import; select the xwiki.xar file and 'import' the contents.
When refreshing the browser or re-pointing it to the XWiki instance the scene should now look like:
DNS Server Configuration
Just for fun this is the DNS zone file that I was using:
;
; BIND data file for example.com
;
$TTL 1d
@ IN SOA ns1.xwiki-rocks.com. mail.xwiki-rocks.com. (
2012020403 ; Serial
7200 ; Refresh
120 ; Retry
2419200 ; Expire
86400) ; Default TTL
;
IN NS ns1.xwiki-rocks.com.
IN NS ns2.xwiki-rocks.com.
ns1.xwiki-rocks.com. IN A 172.99.99.10
ns2.xwiki-rocks.com. IN A 172.99.99.11
xwiki-rocks.com. IN A 172.99.99.1
www.xwiki-rocks.com. IN A 172.99.99.2
db.xwiki-rocks.com. IN A 172.99.99.5
Which when put into 'service' should generate a more 'human' style browsing environment:
The only real additions now could be a reverse proxy service put in place in order to communicate with port 8080 while listening on port 80 or alternatively the 'listening port' of Glassfish could be changed to 80 directly.
More information can be found here: