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

About these ads

One thought on “Install and run Apache Roller 4.01 on OpenSolaris”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s