1. Check java installation
--------------------------
1.a. Execute java -version at the command line.
The result should be java5. Otherwise install that version.
Java6 not yet fullly supported

2. Postgres installation
------------------------
2a. Install Postgres (8.2.4 through 8.2.6)
Linux/Redhat : yum -y install postgresql postgresql-server
Windows : unzip the zip file and run the msi file included

2b. Create a db user rhqadmin :
su postgres
createuser -h 127.0.0.1 -p 5432 -U postgres -S -d -R -P rhqadmin
-S : not a super user
-d : can create databases
-R : can't create role
-P : with password

2c. Create the rhq database
createdb -h 127.0.0.1 -p 5432 -U rhqadmin rhq


3. JBossON server installation
--------------------------
XXX stands for JBossON version number
3a. Unzip jon-server-XXX.zip
3b. Linux only : chmod u+x *.sh under jon-server-XXX/bin and jon-server-XXX/jbossas/bin
(chmod is only needed for version 2.0.0)
3c. Start the server at the command line
cd jon-server-XXX/bin
Linux : ./rhq-server.sh console
Windows : ./rhq-server.bat console

3d. First connection
In a browser, go to page : http://localhost:7080/
Test the db connection.

Click on the install button

If 'RHQ_Principal missing' issue pops up :
	psql -h 127.0.0.1 -p 5432 -U rhqadmin rhq
	rhq#CREATE Table RHQ_Principal ();
	rhq#\q
	
	Use the link to go back to the installation page
	Click again the install button
	Accept to overwrite the existing schema

3e. Installation as a service (optional)
Stop the command line server
Linux : 'rhq-server.sh start' has to be launched during the init process ; use a symbolic link for instance.
Windows : rhq-server.bat install ; rhq-server.bat remove to uninstall the service


4. JBossON agent installation
-------------------------
4a. Unzip jon-agent-XXX.zip
4b. Linux only : chmod u+x *.sh under jon-agent-XXX/bin
(chmod is only needed for version 2.0.0)
4c. Start the agent
cd jon-agent-XXX/bin
Linux : ./rhq-agent.sh
Windows : rhq-agent.bat

4d. Installation as a service
Stop the running agent
Linux : 'bin/rhq-agent-wrapper.sh start' has to be launched during the init process ; use a symbolic link for instance.
Windows : bin/rhq-agent-wrapper.bat start

4e. If you need to reinstall the server and the agent, on your laptop for instance,
run the agent with the "-l" flag to clean the agent configuration since the security token is no longer valid
for the freshly installed server.
./rhq-agent.sh or .bat --help shows the possible flags

5. License installation
-----------------------
After a moment, installation is done. Click on the link to access the login page : rhqadmin - rhqadmin
Update the License using the provided file on the CD or by the trainer.
Go tho  the Dashboard to see the main page ; you should see there some resources available : JBossON server, JBossON agent, Postgres.


Postgres Notes
--------------
Before you can do anything, you must initialize a database storage area on disk, a so-called database cluster. 
It is usually done during postgres installation ; otherwise :
pg_createcluster <version> <cluster name>

Starting the database server
postgres -D /var/lib/postgres/8.2/main >logfile 2>&1 &
-D : control the database cluster location

Alternative
pg_ctl start -l logfile -D /usr/local/pgsql/data

To change database users password afterwards :
psql
postgres=#alter user postgres with password 'password_chosen';