Opnefire installation guide in Linux (Red Hat)

Opnefire installation guide in Linux (Red Hat)

Opnefire installation guide in Linux (Red Hat)Let me show you step by step installation guide for openfire in Red hat Linux 6.2 using Postgresql database.
Make sure you have postgresql database and openfire rpm installed in your machine

You can get openfire rpm package from the official site of openfire as shown below
http://www.igniterealtime.org/downloads/

Installaing Pre-requisites

Install the following packages for Postgresql database
postgresql-server-8.4.13-1.el6_3.i686
postgresql-libs-8.4.13-1.el6_3.i686
postgresql-8.4.13-1.el6_3.i686
# yum install postgresql postgresql-server postgresql-libs
Install openfire rpm
# rpm -ivh openfire-3.8.2-1.i386.rpm

Configure postgresql database for openfire

Now as soon as you install the rpm file of postgresql, a user "postgres" is created by default which you can verify by using the below command

# cat /etc/passwd | grep postgres
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash

So, as you can see above the default values for user postgres are
Home Directory: /var/lib/pgsql
Default Shell: /bin/bash
Default Password: None
You need to manually assign a password to user "postgres" by using below command
# passwd postgres
Before starting the services database has to be initialized. Login as postgres user
# su - postgres
-bash-4.1$ initdb --pgdata=/var/lib/pgsql/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UTF8.
The default text search configuration will be set to "english".

creating directory /var/lib/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    postgres -D /var/lib/pgsql/data
or
    pg_ctl -D /var/lib/pgsql/data -l logfile start
Now once your database is initialized start postgresql service as root

$ su - root

# /etc/init.d/postgresql start
Starting postgresql service:                               [  OK  ]

Creating a user and database for openfire

# useradd deepak
# passwd deepak
Assign a password for user "deepak"
Now login as postgres user
# su - postgres
-bash-4.1$ createdb openfire
-bash-4.1$ psql openfire
psql (8.4.13)
Type "help" for help.

openfire=# CREATE USER deepak WITH PASSWORD 'example123';
CREATE ROLE
openfire=# GRANT ALL PRIVILEGES ON DATABASE openfire to deepak;
GRANT

Now verify from command line if you can login to openfire database using user deepak. To quit from the postgres console
openfire=# q
Login as deepak
-bash-4.1$ su - deepak
Password:

[deepak@test ~]$ psql -d openfire -U deepak
psql (8.4.13)
Type "help" for help.

openfire=>

So we have sucessfully connected to our database using deepak user.

Configuring openfire

NOTE: For this tutorial I have disabled my firewall and selinux.
Open a browser on a client machine or localhost using GUI and go to the below mentioned url
http://(your_machine_ip):9090
Follow the below screenshots

Opnefire installation guide in Linux (Red Hat)
Opnefire installation guide in Linux (Red Hat)

Opnefire installation guide in Linux (Red Hat)

Opnefire installation guide in Linux (Red Hat)

I got few error while connecting to the openfire database. I have created separate post for them. Please follow the below links if you get the same error messages in your /opt/openfire/logs/error.log file

FATAL: no pg_hba.conf entry for host "localhost", user "myuser", database "openfire", SSL off

Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections

Opnefire installation guide in Linux (Red Hat)

Opnefire installation guide in Linux (Red Hat)

Click on Finish complete the setup.

Now go to the CLI of your openfire server to start the chat services
# cd /opt/openfire/bin
# ./openfire.sh
Openfire 3.8.2 [Sep 21, 2013 6:09:18 PM]
Admin console listening at:
 http://10.10.20.26:9090
 https://10.10.20.26:9091

Run the above given script

NOTE: Make sure you don't close this terminal as it will close the running services of your chat server

Follow the below links for more tutorials

Leave a Comment