Monthly Archives: April 2010

Install and run Apache Roller 4.01 on OpenSolaris

Although I use WordPress to do this blog, I’m also familiar with Apache Roller, a Java-based enterprise blogging system that famously is used to power the IBM developerWorks blogs and blogs.sun.com sites.

http://roller.apache.org/
http://en.wikipedia.org/wiki/Apache_Roller

Although WordPress undoubtedly has more bells and whistles, with themes and plug-ins galore, I find Roller quicker and less fussy in operation, with far more comprehensive documentation – and its scalability cannot be denied. This guide will enable you to install and run Apache Roller for the purposes of evaluation and tinkering.

We will be using OpenSolaris snv_134 x64, with Apache Roller 4.01, Glassfish v2.1, and MySQL 5.1.

(Note that you can click on the “view source” button for the longer command transcripts recreated below for the easy-to-read view.)

View Source

 

1) Install MySQL 5.1

We need both the database, and the JDBC connector. Both are available using the IPS Package Manager GUI. On my snv_134 system, MySQL 5.1 was already installed, but if it isn’t simply point and click.

The package names are:

database/mysql-51
database/mysql-50/connector/jdbc

Install MySQL from IPS

 

2) Create a system-wide properties file for MySQL

This is achieved by creating a file named my.cnf and placing it at /etc

Roller requires UTF-8 compatibility, and, I also wanted to set the default MySQL storage engine to InnoDB. The contents of my configuration file are therefore:

[mysqld]
default-character-set=utf8
default-storage-engine=innodb

 


3)
Run the initial MySQL setup script

Execute the following:

$ pfexec /usr/mysql/5.1/bin/mysql_install_db --user=mysql</pre>

You should observe the following output:

Installing MySQL system tables...
100426 20:07:30 [Warning] Forcing shutdown of 2 plugins
OK
Filling help tables...
100426 20:07:30 [Warning] Forcing shutdown of 2 plugins
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/mysql/5.1/bin/mysqladmin -u root password 'somepassword'
/usr/mysql/5.1/bin/mysqladmin -u root -h afterburner password 'somepassword'

Alternatively you can run:
/usr/mysql/5.1/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/mysql/5.1 ; /usr/mysql/5.1/bin/mysqld_safe &amp;

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql/5.1/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/mysql/5.1/bin/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

 

4) Start the MySQL server

On OpenSolaris, this is controlled by SMF. Enter the following command:

$ pfexec svcadm enable mysql:version_51

Verify the server is running:

$ svcs -a | grep mysql                    
disabled       19:43:08 svc:/application/database/mysql:version_50
online         23:08:12 svc:/application/database/mysql:version_51

 

5) Secure the default MySQL root account

I followed the two steps detailed in the CLI output in step 3), in summary (afterburner is the name of my host – you would change this to your own hostname):

$ pfexec /usr/mysql/5.1/bin/mysqladmin -u root password 'somepassword'
$ pfexec /usr/mysql/5.1/bin/mysqladmin -u root -h afterburner password 'somepassword'

I also followed the procedure at http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html to remove the MySQL anonymous accounts.

 

6) Create a database for Roller

Now that we have set up and configured MySQL, we can proceed with setting up Roller. First, we need to create the database that Roller will populate with its tables on first run. This is covered on page 7 of the Roller Install Guide (available from here), under step 5.1 (“Create a database for Roller”).

The example given in the guide is reproduced similarly here; rollerdb is the name of the database we are creating; the MySQL user rolleradm in the example is created dynamically with the grant command, as is the password that is specified (‘somepassword’ in the example). Change these values as needed:

$ pfexec /usr/mysql/5.1/bin/mysql -u root -p

mysql&gt; create database rollerdb;
mysql&gt; grant all on rollerdb.* to rolleradm@'%' identified by 'somepassword';
mysql&gt; grant all on rollerdb.* to rolleradm@localhost identified by 'somepassword';
mysql&gt; exit

 

7) Install and configure Glassfish

The Glassfish application server will contain the Roller web app. Fortunately, it’s also available from IPS as a one-click install.

The package name is:

web/glassfish-2

Install Glassfish using IPS

Once installed, create the directories for the Glassfish domains:

$ pfexec mkdir /var/appserver
$ pfexec mkdir /var/appserver/domains

Then run the asadmin command, and create the domain domain1:

$ pfexec asadmin
asadmin&gt; create-domain --adminport 8081 --domaindir /var/appserver/domains/ domain1
Please enter the admin user name&gt;admin
Please enter the admin password&gt;
Please enter the admin password again&gt;
Please enter the master password [Enter to accept the default]:&gt;
Please enter the master password again [Enter to accept the default]:&gt;
Using port 8081 for Admin.
Using default port 8080 for HTTP Instance.
Using default port 7676 for JMS.
Using default port 3700 for IIOP.
Using default port 8181 for HTTP_SSL.
Using default port 3820 for IIOP_SSL.
Using default port 3920 for IIOP_MUTUALAUTH.
Using default port 8686 for JMX_ADMIN.
Domain being created with profile:developer, as specified by variable AS_ADMIN_PROFILE in configuration file.
------ Using Profile [developer] to create the domain ------
XML processing for profile: Base document [/usr/appserver/lib/install/templates/default-domain.xml.template]. Profile name [developer]. Processing property [domain.xml.style-sheets].

Security Store uses: JKS
Domain domain1 created.
asadmin&gt; exit

 

Start the domain:

$ pfexec asadmin start-domain domain1
Starting Domain domain1, please wait.
Default Log location is /var/appserver/domains/domain1/logs/server.log.
Redirecting output to /var/appserver/domains/domain1/logs/server.log
Domain domain1 is ready to receive client requests. Additional services are being started in background. 
Domain [domain1] is running [Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs)] with its configuration and logs at: [/var/appserver/domains].
Admin Console is available at [http://localhost:8081].
Use the same port [8081] for "asadmin" commands.
User web applications are available at these URLs:
[http://localhost:8080 https://localhost:8181 ].
Following web-contexts are available:
[/web1  /__wstx-services ].
Standard JMX Clients (like JConsole) can connect to JMXServiceURL:
[service:jmx:rmi:///jndi/rmi://afterburner:8686/jmxrmi] for domain management purposes.
Domain listens on at least following ports for connections:
[8080 8181 8081 3700 3820 3920 8686 ].
Domain does not support application server clusters and other standalone instances.

 

Once the domain is running, point your web browser to http://127.0.0.1:8081 to access the Glassfish admin BUI. I prefer secure connections to everything myself, even when running development setups – so the first thing I do is enable a secure connection to the Glassfish admin BUI. This is as simple as ticking the “Enabled” tickbox for the “Security” parameter, under “Configuration -> HTTP Service -> HTTP Listeners -> admin-listener”:

Enable a secure Glassfish admin interface

 

8) Download and install Roller

The Roller 4.01 download page may be found at: http://roller.apache.org/download.cgi#roller40

I decompressed the .zip file to /opt and created a symbolic link so I could access it at /opt/Roller

 

9) Install the JDBC connector

In step 1) we downloaded the JDBC connector using IPS. To install it for use with Roller:

$ cd /var/appserver/domains/domain1/lib/
$ pfexec cp /usr/mysql/connectors/jdbc/5.1/mysql-connector-java-5.1.5-bin.jar .

 

10) Create a custom Roller startup properties override file

I created a roller-custom.properties file that contains startup override settings for Roller. This is placed at /var/appserver/domains/domain1/lib/classes

My roller-custom.properties file contains:

installation.type=auto
database.configurationType=jdbc
database.jdbc.driverClass=com.mysql.jdbc.Driver
database.jdbc.connectionURL=jdbc:mysql://localhost:3306/rollerdb
database.jdbc.username=rolleradm
database.jdbc.password=somepassword
mail.configurationType=properties
mail.hostname=mymailserver.company.com
securelogin.enabled=true

The JDBC credentials as visible above are the same as the MySQL user with permissions on the Roller database as covered in step 6).

 

11) Deploy Roller to Glassfish

Refer to page 11 of the Roller Install Guide. I’m using the Glassfish BUI to upload /opt/Roller/webapp/roller

Deploy Roller to Glassfish

In our roller-custom.properties file we have specified secure logins to Roller. We therefore need to enable an HTTP listener in Glassfish that listens on port 8443 (which Roller uses for HTTPS logins). I’ve used the existing http-listener-2 listener, enabled the “Security” setting, and changed the “Listener Port” to 8443:

Enable an HTTPS listener in Glassfish for Roller

 

12) Launch Roller and complete setup

Finally, we now navigate to http://localhost:8080/roller and let Roller work its magic:

Roller - create database tables?

Roller welcome screen

If you have trouble with the above steps, be sure to inspect any error messages closely, as Roller is actually helpfully descriptive about why it cannot launch. Undeploying/redeploying Roller in Glassfish, and restarting the Glassfish domain containing Roller may also help.

As a final step, I looked over the “Configuration tips and tricks” section in the Install Guide, and decided to perform the security step detailed on page 15 in step 9.2 – “Changing keys in security.xml”.

 

You should now be ready to explore Roller:

Dave's Blog in Roller

Advertisements

HP Laserjet prints endless copies…

An interesting problem encountered today while helping a friend set up an HP Laserjet 4200 in a small private mixed Ubuntu/Windows XP home office network; when printing (in particular) from Ubuntu clients, the printer would output endless copies of the job until the “Cancel” button on its front panel was pressed, or until it was out of paper.

After a bit of head-scratching/web-searching, it turned out that this was to do with a setting on the printer itself; under one of the various printing configuration menus, the “COPIES” parameter had been set by the previous owner to “32000” (!). Windows clients seemed to ignore this setting and faithfully print how many copies were specified by the user in the client application print settings, but Ubuntu clients seemed to take this setting literally.

Setting the “COPIES” parameter on the printer to “1” resolved this issue.

Some quick Gnome/OpenSolaris tips…

1) How do I alter the default window size of the Gnome Desktop terminal when launched?

Add the geometry option to the gnome-terminal command. For example, I have a Gnome Terminal Panel item configured to launch with:

gnome-terminal --geometry=130x40

 

2) In an Gnome-based Virtualbox Unix/Unix-like guest, why can’t I use the numeric keypad as expected?

Chances are the “Pointer can be controlled using the keypad” setting is enabled in the Gnome keyboard preferences. Go to System -> Preferences -> Keyboard, and disable this setting under the “Mouse Keys” tab:

Gnome/Ubuntu Mouse Keys tab settings

3) Why doesn’t the OpenSolaris Gnome Volume Applet remember the volume settings between reboots?

Yeah, this is small but incredibly annoying – and a right pain in the arse to have to twiddle the volume setting every morning. Hasn’t been fixed in about forever.

There is a workaround mentioned here:

http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6606096

However, there are two problems with it. First, /etc/X11/gdm does not exist on my snv_134 x64 system (the correct location is /etc/gdm) and second; the mixerctl command has been replaced by audioctl in build 130 onwards.

Therefore on my snv_134 x64 system I made the following changes to apply a revised workaround:

Edit /etc/gdm/PostSession/Default so it contains the following line:

audioctl save-controls -f $HOME/.ossaudiosettings

Edit /etc/gdm/PreSession/Default so it contains the following line:

audioctl load-controls $HOME/.ossaudiosettings

Audio settings should then be remembered on reboot.

 

4) How do I shorten the GRUB menu wait time on OpenSolaris?

On an snv_134 x64 system, edit the timeout value in /rpool/boot/grub/menu.lst

For example:

timeout 5

Results in a wait time of 5 seconds.

Oracle’s “free” $90 (U.S.) Microsoft Office ODF plugin

From The Register:

http://www.theregister.co.uk/2010/04/19/oracle_charges_for_odf_office_plugiin/:

“Oracle is now charging $90 for the free Sun plug-in that teaches Microsoft Office how to use the latest open document format…The Home and Student edition of Microsoft Office 2007 costs $149.95, and the standard edition is $399.94. So, even if we’re kind, the cost of four plug-ins buys you the entire suite.”

Right.

My favourite bit – see if you can figure out what’s wrong with this picture (I’ve GIMPed it to add a little hint):

Oracle's not so free plug-in...

Use NFS to create a VirtualBox “shared folder” for a FreeBSD 8.0 Guest

Whilst tinkering with NFS, I found a neat application for the lack of shared folders support for my FreeBSD 8.0 VirtualBox guest running in an OpenSolaris host. Although there is a FreeBSD port of VirtualBox Guest Additions, it doesn’t seem to do too much else other than enable seamless host/guest mouse integration.

This is an insecure configuration, and I certainly would not recommend running it on anything other than a private configuration. All the same, this works quite well for me, so may be of use for someone else.

I’m using an OpenSolaris snv_134 x64 host, running VirtualBox 3.1.6 with a FreeBSD 8.0 x86 guest machine installed configured according to https://davekoelmeyer.wordpress.com/2010/03/31/freebsd-8-0-x86-and-kde4-full-screen-in-virtualbox-3-1-4/. The name of my host serving up NFS exports is afterburner.

 

Let’s configure the OpenSolaris host for NFS. First, create an NFS share point named “testshare” at /export:

$ pfexec mkdir /export/testshare
$ pfexec chmod 777 /export/testshare

 

Create an NFS share group named “testgroup”, and verify the operation:

$ pfexec sharemgr create testgroup

$ sharemgr list -v                
default	enabled	nfs
zfs	enabled	
testgroup	enabled	nfs

 

Add the share /export/testshare to the share group “testgroup”, and verify the operation:

$ pfexec sharemgr add-share -s /export/testshare -d "this is a test NFS share" testgroup

$ sharemgr show -v                                                                      
default
zfs
testgroup
	  /export/testshare	"this is a test NFS share"

$ share
-@testgroup     /export/testshare   rw   "this is a test NFS share"

 

Now, configure FreeBSD to automagically mount the NFS share when accessed, using amd (no, not that one). This is a modification of the very helpful guide here, and I agree with that author’s assertion that documentation for those new to amd is somewhat lacking.

 

So, enable amd in FreeBSD by adding amd_enable=”YES” and amd_flags=”” to /etc/rc.conf. My /etc/rc.conf file (in total) reads:

# -- sysinstall generated deltas -- # Sun Mar 28 04:08:02 2010
# Created: Sun Mar 28 04:08:02 2010
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
amd_enable="YES"
amd_flags=""
local_startup="${local_startup} /usr/local/kde4/etc/rc.d"
kdm4_enable="YES"
hald_enable="YES"
dbus_enable="YES"
vboxguest_enable="YES"
hostname="freebsd"
ifconfig_em0="DHCP"
keymap="us.iso"
moused_enable="YES"
sshd_enable="YES"

 

Create the file /etc/amd.conf containing the following:

[global]
auto_dir        = /.amd
log_file        = /var/log/amd.log
log_options     = error,fatal,warning
map_type        = file
search_path     = /etc

[/nfs]
map_name        = amd.nfs

 

Create the file /etc/amd.nfs containing the following (this should be all on one line, but for blog formatting sake I have added a line break directly after the first equals sign, and there should be no space between it and the following double quotation mark):

testshare  fs:=${autodir}${path};type:=program;mount:=
"/sbin/mount mount -t nfs -o rw,-N afterburner:/export/testshare ${fs}";

(Note that afterburner is the name of my host system serving up the NFS export, and I’ve added this to my FreeBSD guest’s hosts file at /etc/hosts. You would of course modify this to suit your own setup.)

 

Finally, start the amd daemon:

# /etc/rc.d/amd start

 

Now, in the FreeBSD guest open up a terminal and cd to /nfs/testshare. amd should mount the location as an NFS share automagically, and you can now exchange files between the VirtualBox host and guest environments.

For ease-of-use I’ve created a symlink on the respective desktops of my host and guest OSs:

NFS shared folder between OpenSolaris and FreeBSD

“Jive vs. Open Source”

Great article by Matt Asay on recent events coming out of Jive Software:

“In a somewhat Quixotic quest, Jive Software has been showcasing a white paper titled “Jive vs. Open Source”…with a page devoted to what it claims are the negatives of Drupal and Liferay…by choosing to focus on open source, in general, and Drupal, in particular, Jive has effectively taken out a billboard advertisement that essentially proclaims: “We’re really worried about Drupal. It’s a big-time threat to our business.” No one talks about competitors that don’t present serious, significant competition. Jive wouldn’t be talking about Drupal and Liferay unless it were seriously worried…”

Indeed. Clicking on the link to the white paper referred to in Matt’s article leads to a post by Jive’s CTO in full damage-control mode. I’m a user of Jive’s open-sourced Openfire server, a fantastic product which due to an apparent change in Jive’s support of open source projects (intimated in Matt’s article) I cannot obtain professional support for even if I wanted. This recent “skirmish” (as Jive puts it) indicates a pretty serious disconnection between Jive’s marketroids and their open source efforts.

As Matt also sums up nicely:

“…here’s the one big fact that Jive can’t counter: Anyone with serious questions about Drupal (or Liferay) has but to download and install the software. It’s open-source. It’s free. No one needs to ask Jive what to think about Drupal or Liferay. If you want answers on Jive, the process involves everyone’s favorite, a salesperson! Joy.”

So, my thanks to Jive Software to switching me on to Drupal. Even better, it’s a one-click install from the OpenSolaris contrib repository – and no salesperson needed:

Drupal from OpenSolaris IPS

Project Wonderland – rebooted

Fresh from Oracle withdrawing support for Project Wonderland, the community goes it alone with Open Wonderland:

http://openwonderland.org/

Great to see, and I’m sure Open Wonderland will have a bright future, given the amount of community enthusiasm and engineering talent behind it.

Finally had enough time during my downtime to quickly install a Wonderland 0.5 Preview 2 client/server combo on my OpenSolaris x64 box:

Open Wonderland Orientation world

Using the onboard Intel G31 Express integrated graphics, I was unable to run the Wonderland client; this was believed to be a driver issue, so that graphics platform it would seem is unsupported for now. I retrofitted an nVidia Quadro FX540 card and could then run the client – however, performance of the “Orientation” world (pictured above) using this fairly decent piece of hardware with recent nVidia drivers was slow to the point of being unusable (if you look closely at the bottom of the screen grab you can see a FPS reading of 2.4). This is a known problem with the Orientation world, and it appears the developers are working on it.

Still, exciting times ahead!

James Gosling quits Oracle

Oracle seem to make a lot of noise about how Java is at the core of their middleware products – so for the father of Java to quit abruptly with some quite heavily implied not-too-nice feelings about the matter is quite a blow:

http://nighthacks.com/roller/jag/entry/time_to_move_on

I’m not sure at which point we consider referring to the loss of significant parts of Sun’s (RIP) engineering and research talent an exodus, but with a few more high-profile losses like this it can’t be too far off…

Format a USB flash drive with FAT32 on OpenSolaris x64

Obtain the disk device pathname:

$ rmformat
Looking for devices...
     1. Logical Node: /dev/rdsk/c13t0d0p0
        Physical Node: /pci@0,0/pci1028,214@1d,7/storage@3/disk@0,0
        Connected Device: OTi      Flash Disk       2.00
        Device Type: Removable
	Bus: USB
	Size: 247.0 MB
	Label: 

 

Using fdisk, create a FAT32 partition occupying 100 percent of the disk space:

$ pfexec fdisk /dev/rdsk/c13t0d0p0

 

Create a PCFS filesystem on the partition (in this case labelling it “daves”):

$ pfexec mkfs -F pcfs -o fat=32,b=daves /dev/rdsk/c13t0d0p0:c
Construct a new FAT file system on /dev/rdsk/c13t0d0p0:c: (y/n)? y

 

If necessary, mount the device manually (in this case to a mount point named “USB”):

$ pfexec mount -F pcfs /dev/dsk/c13t0d0p0:1 /export/home/dave/USB/

Note that PCFS performance under Solaris is pretty slow. For the UFS version of this how-to, see here.

Two quick problems with VNC

1) When using vncviewer to remote control a machine running Ubuntu 9.10 x86, I seemingly can’t move nor control windows on the remote host. Solution (helpfully described at http://forums.fedoraforum.org/showthread.php?t=201885) – make sure Visual Effects (i.e. Compiz) are disabled on the remote host.

 

2) When a VNC session is running in full-screen, how to restore a windowed view? Solution – press F8 to bring up the options menu.

VNC - disabled desktop effects and displaying options menu