powered by Jive Software

Howto: Openfire - Ubuntu 6.06 LTS LAMP

Installing openfire

http://www.igniterealtime.org/projec...fire/index.jsp

Install Ubuntu 6.06 LTS LAMP - Recommended sites to setup your LAMP server:

https://help.ubuntu.com/community/ApacheMySQLPHP

Check which version of Java you are running. Note the following: the .tar.gz build does not contain a bundled Java runtime (JRE). Therefore, you must have JDK or JRE 1.5.0 (Java 5) or later installed on your system. You can check your java version by typing “java -version” at the command line and (if necessary) upgrade your Java installation by visiting http://java.sun.com.)

Java 6 is available for 6.06 LTS via the “backports” repository. If

this is a fresh install of Ubuntu, you will need to edit your

SOURCES.LIST to enable this repository.

$ sudo vi /etc/apt/sources.list

Uncomment the following line(s):

  1. deb http://us.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse*

  2. deb-src http://us.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse*

$ sudo apt-get update

$ sudo apt-get install sun-java6-bin

  • Thanks for the edit SkydiverFL

$ java -version

Install java6 If you don’t have java already installed.

$ sudo apt-get install sun-java6-bin

Set java6 as your default.

$ sudo update-alternatives --config java

select /usr/lib/jvm/java-6-sun/jre/bin/java

To create a database for openfire MySQL, Oracle, Microsoft SQLServer, PostgreSQL, IBM DB2, or HSQLDB can be used. I chose MySQL since it was installed with my LAMP setup.

Now use phpmyadmin or the terminal to create the database. The following is through the terminal.

Login as root

$ su

Login to MySQL

  1. mysql*

or the following if you setup a user and a password.

  1. mysql -u USERNAME -p*

Create the database in MySQL

  1. mysql> CREATE DATABASE openfire;*

  2. mysql> exit*

If you need more help setting up and/or configuring MySQL I recommend these two sites:

http://www.howtoforge.com/perfect_setup_ubuntu_6.06_p4
http://stanton-finley.net/fedora_core_5_installation_notes.html#MySQL

Download Openfire to a directory. I chose the /opt/ directory.

  1. cd /opt*

Download File or go here to get the most recent: http://www.igniterealtime.org/downloads/index.jsp#openfire

  1. wget http://www.igniterealtime.org/downloadServlet?filename=openfire/openfire_3_3_2.t ar.gz*

  2. mv downloadServlet?filename=openfire%2Fopenfire_3_3_2.tar.gz openfire_3_3_2.tar.gz*

Extract the files.

  1. tar -zxvf openfire_3_3_2.tar.gz*

Create a symlink

  1. ln -s /opt/openfire/bin/openfire /etc/init.d/*

Make the symlink executible

  1. chmod +x /etc/init.d/openfire*

Add openfire to our startup.

  1. update-rc.d openfire defaults*

Fix the nohup output.

  1. vim /opt/openfire/bin/openfire*

Modify openfire script with the following: >…/logs/SDTOUT.log 2>…/logs/SDTERR.log into

ORIGINAL:

Code:

-----

nohup “$app_java_home/bin/java” -server -Dinstall4j.jvmDir="$app_java_home" -Dexe4j.moduleName="$prg_dir/$progname" $INSTALL4J_ADD_VM_PARAMS -classpath “$local_classpath” com.install4j.runtime.Launcher start org.jivesoftware.openfire.starter.ServerStarter false false “$prg_dir/…/logs/stderror.log” “$prg_dir/…/logs/stdoutt.log” true true false “” true true 0 0 “” 20 20 “Arial” “0,0,0” 8 500 “version 3.3.2” 20 40 “Arial” “0,0,0” 8 500 -1 -DopenfireHome=$app_home -Dopenfire.lib.dir=$app_home/lib &

-----

Goto line 262 of /opt/openfire/bin/openfire and insert the following at the end of nohup … with >…/logs/STDOUT.log 2>…/logs/STDERR.log

MODIFIED:

Code:

-----

nohup “$app_java_home/bin/java” -server -Dinstall4j.jvmDir="$app_java_home" -Dexe4j.moduleName="$prg_dir/$progname" $INSTALL4J_ADD_VM_PARAMS -classpath “$local_classpath” com.install4j.runtime.Launcher start org.jivesoftware.openfire.starter.ServerStarter false false “$prg_dir/…/logs/stderror.log” “$prg_dir/…/logs/stdoutt.log” true true false “” true true 0 0 “” 20 20 “Arial” “0,0,0” 8 500 “version 3.3.2” 20 40 “Arial” “0,0,0” 8 500 -1 -DopenfireHome=$app_home -Dopenfire.lib.dir=$app_home/lib >…/logs/STDOUT.log 2>…/logs/STDERR.log &

-----

Restart or run the following command to start Openfire

  1. /opt/openfire/bin/openfire start*

Now setup the rest of Openfire through your browser.

http://localhost:9090

Hi!

I followed exacty this HowTo but still cant start openfire. i still get the nohup: appending output to `nohup.out’ !!

I tried this a thousand times:

Fix the nohup error.
Run the following command or you will get the following error: nohup: appending output to `nohup.out’
# nohup ls >ls.log 2>&1 &
Restart or run the following command to start Openfire
# /opt/openfire/bin/openfire start

Pls help a lost Noob!
Thanks,
mapero

You should not run openfire as root. The script /opt/openfire/bin/extra/openfired will do this for you. Just start this script as root, it will start openfire as user “jive”. (below in my guide I changed this to ‘openfire’)

Here my small guide

extract openfire_x_x_x.tar.gz to /opt/openfire

shell> cd /opt

shell> tar -xzf openfire_x_x_x.tar.gz

create new user ‘openfire’ and group

shell> useradd openfire

appending to your operating system, you will have to create a group to (some systems, e.g. Cent-OS will do this automatically if you create an user)

shell> groupadd openfire

shell> usermod -g openfire openfire

set rights for user ‘openfire’ for openfire directory

shell> chown -R openfire /opt/openfire/

shell> chgrp -R openfire /opt/openfire/

protect some special files

shell> chmod -R g-rwx /opt/openfire/conf

shell> chmod -R o-rwx /opt/openfire/conf

shell> chmod -R g-rwx /opt/openfire/resources/security

shell> chmod -R o-rwx /opt/openfire/resources/security

set execution rights for scripts

shell> chmod u+x /opt/openfire/bin/extra/openfired

shell> chmod u+x /opt/openfire/bin/openfire

workaround for small bug in openfired script

shell> ln -s /opt/openfire/bin/openfire /opt/openfire/bin/openfire.sh

Open file ‘/opt/openfire/bin/extra/openfired’ with your favorite editor and set used user to ‘openfire’

export OPENFIRE_USER=openfire

Open file ‘/opt/openfire/bin/openfire’ and set some extra VM parameters. This will extends your memory from 64 to 128 MB.

INSTALL4J_ADD_VM_PARAMS="-Xms128m -Xmx128m"

If necessary you can config the path to your JavaVM in the same file:

INSTALL4J_JAVA_HOME_OVERRIDE=/usr/java/jdk1.6.0_02

Setup your database

Login to mysql

shell> mysql -p -u root

create database

mysql> CREATE DATABASE openfire;

create new user ‘openfire’ (MySQL 5.1)

mysql> CREATE USER openfire IDENTIFIED BY ‘newpwd’;

config rights for user ‘openfire’

mysql> REVOKE ALL ON . FROM openfire;

mysql> GRANT ALL ON openfire.* TO openfire;

logout

mysql> exit

import necessary tables

shell> mysql -p -u openfire openfire </opt/openfire/resources/database/openfire_mysql.sql

Message was edited by: Coolcat

Message was edited by: Coolcat

Hi Mapero,

“nohup: appending output to `nohup.out’” is not an error - it is the normal output of “nohup” if STDOUT and STDERR are not redirected to a file. So if you want to fix this error you should edit the openfire start script and add there to the start command which looks like

“nohup … &” the redirection parameters so it will look like

“nohup … >…/logs/STDOUT.log 2>…/logs/STDERR.log &”

If you run “nohup ls &” you’ll get the same “error” which can be hidden by running “nohup ls >ls.log 2>&1 &”.

In the first case you’ll find the output of ‘ls’ in nohup.out, in the second case it’s in ls.log.

LG

Hi,

I see little need in describing how to setup a MySQL database or how to install Java for Ubuntu, one should know how to manage it’s server and the database of one’s choice.

You run too much commands as root, this looks a lot like how M$-administrators behave. Except for the start scripts there’s no need to have a root account.

LG

Small note, if you are looking for Java 6 on Ubuntu 6.06 LTS…

Java 6 is available for 6.06 LTS via the “backports” repository. If this is a fresh install of Ubuntu, you will need to edit your SOURCES.LIST to enable this repository.

$ sudo vi /etc/apt/sources.list

Uncomment the following line(s):

  1. deb http://us.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse*

  2. deb-src http://us.archive.ubuntu.com/ubuntu/ dapper-backports main restricted universe multiverse*

$ sudo apt-get update

$ sudo apt-get install sun-java6-bin

This guide has been a great help. However, when I run “/opt/openfire/bin/extra/openfired” it returns an error:

openfired: 50: Syntax error: “(” unexpected

I didn’t change that line in the script; everything is default except for changing the “openfire” user. I’m running Ubuntu server 7.10. Could that be the problem?

Hi there,

thanks for this great how-to. a month ago i made a fresh install of openfire 3.4.5 on a ubuntu dapper drake box using your guide. everthing worked perfectly, but today i became a serious problem. after stopping the openfire deamon it does not start again.

/opt/openfire/bin/openfire.sh start

Starting openfire

root@my-ip:~# nohup: appending output to `nohup.out’

/opt/openfire/bin/openfire.sh status

The daemon is stopped.

I also tried this:

/opt/openfire/bin/extra/openfired start

testing JVM in /usr …

./openfire.sh: line 63: /home/openfire/.install4j: No such file or directory

Starting openfire

/opt/openfire/bin/extra/openfired status

openfire is not running

But the deamon did not start !?

Openfire was running for a month and today i liked to restart the openfire server but i can`t start it. i also followed the small guide from Coolcat to “fix” the openfire.sh. As i sad before - it worked until today ?!

What shall i do?

Ok, here is the solution. Openfire changed openfire.xml into openfire.xml.tmp - don`t ask me why ?! After i figured this out everything is working as normal. Thanks