Deploy your own chat application on network
We have been roaming here and there to find a way to implement a chat application on our own network. Finally, figured out a way to implement the same on our network. The solutions which we described below can be used over the internet and it can be used within the network/intranet.
Prerequisites:
- Linux Machine – Would be good if its Centos. Personally, I love to play with Centos server 😛
- Mysql Server – Any version would be fine. Though, latest version 5.6 would be good which is latest at time of this post(Sep 2016)
- Open ports – 9090, 5222,5223,5269.
Chat Application (Server Side) – Openfire:
We will be using openfire application on the server. Let’s install the openfire application on the server.
Download the application on to the server. At the time of the post, the latest version of openfire is 4.0.3.
wget http://download.igniterealtime.org/openfire/openfire-4.0.3-1.i386.rpm
Install the application using rpm.
rpm -ivh openfire-4.0.3-1.i386.rpm
Now, its time to create a database. This post assumes that mysql is already installed. Incase, if mysql is not installed, install mysql on the server. There are various articles available and we have also dealt the mysql installation on our various posts.
Access mysql prompt and create the database and user.
create database openfire;
grant all privileges on openfire.* to <dbusername>@'localhost' identified by '<dbpassword>';
flush privileges;
Start the openfire application.
/etc/init.d/openfire start
chkconfig openfire start
Incase if the application failed to start, check the file /opt/openfire/logs/nohub.out. If you get any error related with java(may be sometime issue with OS version/java compatibility). Remove the openfire installed java version and create a symlink to system installed java.
cd /opt/openfire/jre/bin
mv java java.bak
ln -s /usr/bin/java java
Now, we have completed the setup on server side.
Openfire Configuration:
Its time to complete the openfire setup. Access the IP address in the browser.
http://IPaddress:9090
Select the language as English and Click on Proceed.
Enter the Server Settings as per your requirement. If you follow the document, please give the follow details.
Domain:chatapp.domain.tld
Admin Console Port:9090
Server Admin Console Port:9091
Select the Driver as Mysql and modify connection URL with the database details which you created.
jdbc:mysql://localhost:3306/openfire?rewriteBatchedStatements=true
Mention the DB username and DB password.
Setup Administrator account.
Admin Email Address:<your-email@domain.tld>
New Password:
Current Password:
You are done 🙂 Complete the setup.
Account Creation:
So, far we have completed the openfire setup. Now, we will create a user and configure user on client side.
Access the openfire on the browser
http://IPaddress:9090
Move the pointer to Users/Groups > Create User
Enter the User details.
Username:
Name:
Email:
Password:
Confirm Password:
Click on Create User
Client Configuration:
Lot of articles suggested to go with spark client which may be compatible with openfire. However, we are not comfortable with spark client and there are multiple issues which we are facing with spark client. So, we decided to go with Pidgin instance messanger.
Depends on the client machine, the pidgin can be installed on most of the OS. In this article, we are gonna explain on how to configure pidgin on windows machine.
Download the pidgin from pidgin official website.
https://www.pidgin.im/download/
Click on the installer and complete the installation.
Open pidgin and move the pointer Accounts > Manage Accounts
Click on Add and mention the follow details.
Protocol:XMPP
Username:<your name which you created>
Domain:IP address or Domain name of the server
Password: <password>
Click on Add to complete the installation.
Welcome to the chat world 🙂 🙂 🙂