Simple setup of Jabber Local Area Network Instant Messaging Server

Source: Internet
Author: User
Article Title: Simple setup of the Jabber LAN Instant Messaging Server. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Directory

1. What is the jabber server;

    1.1. Can we set up our own jabber server;
    1.2. Application Scope of jabber;

2. Simple setup and installation of jabber server;

    2.1 Jabber Server test and setup environment and user authentication environment;
    2.2. Select the Jabber Server version;
    2.3 Add a system user for the Jabber Server to manage Server startup;
    2.4 compile and install the software environment required by Jabber Server;
    2.5 decompress, compile, and install the Jabber Server;

3. simple configuration of jabber server;

    3.1 create a directory for storing the Jabber Server process pid and log;
    3.2. Mysql database operations;
    3.3 modify the configuration file of the Jabber Server;

      3.31. c2s. xml file
      3.32. resolver. xml file
      3.33 router-users.xml documents
      3.34. router. xml file
      3.35. s2s. xml file
      3.36 sm. xml file

4. Start and manage the Jabber Server;

5. Application of the Jabber Client;

    5.1 select the Jabber Client;
    5.2. Client DNS configuration;
    5.3 use of Gaim, one of the clients of Jabber;

6. Some questions;

    6.1. Can jabberd2 chat with users like MSN, Yahoo Messager, and ICQ;
    6.2. Can jabberd2 support file transfer from the client;
    6.3. Can jabberd2 support voice or telephone functions;

7. About this article;
8. references;
9. related documents;

1. What is the jabber server;

Jabber is a famous Linux Instant Messaging Service server. It is a free and open source software. What is an instant messaging server? It is a server similar to AIM, ICQ, MSN or Yahoo Message. But Jabber allows us to build our own Instant Messaging Server, which can be applied on the Internet or on the LAN;

Jabber's most advantageous communication protocol. He can connect to multiple types of instant messaging. For example, a third-party plug-in allows jabber users to chat with MSN, Yahoo Messager, ICQ;

Below is the original official document from jabber.org.

Jabber is best known as "the Linux of instant messaging" -- an open, secure, ad-free alternative to consumer IM services like AIM, ICQ, MSN, and Yahoo (see the IM quickstart ). under the hood, Jabber is a set of streaming XML protocols and technologies that enable any two entities on the Internet to exchange messages, presence, and other structured information in close to real time. jabber technologies offer several key advantages:

1.1. Can we set up our own jabber server;

We can mount the Jabber server on our own. jabber.org provides almost all documents, servers, and clients. If you want to have your own instant messaging server, let's do it on your own; jabber can satisfy your own Instant Messaging Server; if you are a master, you may also get a similar TT company;

1.2. Application Scope of jabber;

The jabber server can be used in the LAN. Of course, an internet jabber server is also used to serve your own users. The server supports almost all operating systems, from Linux, MACOS to Unix, Windows platforms are also supported. The same is true for clients ......

Server:Jabber Servers

Client:Jabber Clients

2. Simple setup and installation of jabber server;

I set up and tested it in the LAN, and the features are extremely simple, and the security is not evaluated (or there is no security), that is, simple registration and mutual communication (CHAT );

2.1 Jabber Server test and setup environment and user authentication environment;

Slackware 10.1, in fact, is the same in which release, as long as according to the official document above, generally will succeed; it seems that it is not successful; I use mysql certification, that is to say, users register and authenticate database calls. Of course, jabber supports multiple types of authentication, such as PostgreSQL, Berkeley DB ......

Because I do not understand other authentication methods, I only know a little about Mysql, so I used the Mysql method;

In addition, if you have a Jabber Server in the LAN, you must have a DNS Server. That is to say, machines in the LAN can access each other through hostname. If you do not know what DNS is, or do not set up DNS. I don't think there is anything. Now almost all routers have this function, and you can get it up with a few clicks. If you only have one machine, I have no need to view the Jabber Server;

Therefore, the prerequisite for setting up a Jabber Server in this article is that you know DNS (at least you have a vro and you can specify dns on the vro to resolve the hostname of each machine ); in addition, you need to understand the setup and simple application of Mysql servers;

2.2. Select the Jabber Server version;

The version of the Jabber Server I use is the jabberd-2.0s10.tar.gz;

Http://jabberd.jabberstudio.org/2/#download


2.3 Add a system user for the Jabber Server to manage Server startup;

Generally, the root Super User can manage all the server programs, but this is a bit insecure. Therefore, the root permission should be used as little as possible to start a server;

[Root @ localhost ~] # Groupadd jabber Note: Add a jabber user group;
[Root @ localhost ~] # Useradd jabber Note: Add a jabber user;

If you do not set the password for the jabber user, you can check it out. If you want to use the su command to switch to the root user and then use su jabber, you do not need a password; if you think it is a bit difficult to switch between them, set the password of the jabber user;

[Root @ localhost ~] # Passwd jabber Note: Set the password of the jabber user;

2.4 compile and install the software environment required by Jabber Server;

Compiling and installing the Jabber Server in Linux requires compilation tools. For example, if you do not have a compilation environment, you need to find the CD of your release version and install it;

Jabber Server depends on openssl, and you must install it. It should also be available in the installation disk of your Linux release;
Jabber Server depends on Mysql because we need to use Mysql to store user data. This is indispensable. It is also available on the CD of the release version;
The libidn package is also available in various major releases; you can find it yourself; you can also compile and install it yourself;

Reference:Jabberd 2 Installation and Administration Guide

2.5 decompress, compile, and install the Jabber Server;

[root@localhost ~]# tar zxvf jabberd-2.0s10.tar.gz
[root@localhost ~]# cd jabberd-2.0s10
[root@localhost jabberd-2.0s10] # ./configure --enable-ssl --enable-mysql --enable-idn \
      --with-extra-include-path=/usr/include/mysql \
      --with-extra-library-path=/usr/lib/mysql \
      --prefix=/opt/jabberd2
[root@localhost jabberd-2.0s10] # make
[root@localhost jabberd-2.0s10] # make install

Note:In. /In configure, specify the location of your Mysql include and the location of mysql lib. You should know where these items are; my mysql include and lib are/usr/include/mysql and/usr/lib/mysql respectively.

-- Prefix is used to specify the location where the jabberd is installed. I installed it in the/opt/jabberd2 directory. This setting is more convenient. When we do not need jabberd, we can simply delete the/opt/jabberd2 directory. That is, it is convenient to reinstall; it is more convenient to uninstall;

3. simple configuration of jabber server;

3.1 create the Jabber Server process storage directory pid and log storage directory log

[root@localhost ~]# mkdir -p /opt/jabberd2/var/jabberd/pid
[root@localhost ~]# mkdir -p /opt/jabberd2/var/jabberd/log

[root@localhost ~]# chown -R jabber:jabber /opt/jabberd2/var
Note:Change the/opt/jabberd2/var permission so that the user can write data to/opt/jabberd2/var and sub-directories;

3.2. Mysql database operations;

Jabberd-2.0s10 in our decompress compiled Jabber Server directory, there is a directory tools, there is a file db-setup.mysql, is to create the database script;

First, we need to start the Mysql server; this process is omitted;

Then we import db-setup.mysql;

[Root @ localhost jabberd-2.0s10] # cd tools
[Root @ localhost tools] # mysql-uroot-p <db-setup.mysql
Enter password: Enter the management password of the Mysql database.


After the previous step, we have imported a database of jabberd2. Next, we need to authorize the database, so that the database of jabberd2 has a dedicated management user;

[Root @ localhost tools] # mysql-uroot-p
Enter password: Enter the management password of the Mysql database.

Then run the following command in the mysql database;

mysql>GRANT select,insert,delete,update ON jabberd2.* \
to jabberd2beinan@localhost IDENTIFIED by '123456';

Note:Here, jabberd2beinan is the administrator of the jabberd2 database, which can be defined by yourself and defined as your favorite. 123456 of them are the password of the user jabberd2beinan;

If there is no problem, we need to use the jabberd2beinan user to connect to the mysql server after exiting Mysql;
[Root @ localhost tools] # mysql-ujabberd2beinan-p
Enter password: Enter the password of jabberd2 Database Administrator jabberd2beinan;
Mysql> show databases; Note: View databases;
+ ---------- +
| Database |
+ ---------- +
| Jabberd2 |
| Test |
+ ---------- +
2 rows in set (0.00 sec)
Mysql> quit


3.3 modify the configuration file of the Jabber Server;

Take my installation and configuration environment as standard. I installed the Jabber Server in the/opt/jabberd2 directory; the configuration file is in the/opt/jabberd2/etc/directory; we need to modify the following files;

C2s. xml resolver. xml router-users.xml router. xml s2s. xml sm. xml

I just briefly talk about my configuration, which is not necessarily correct, but can be used;

Note:All the IP addresses of 192.168.1.4 are the IP addresses of the Jabber Server. You must modify the IP addresses based on your own situation;

3.31. c2s. xml file

77th rows;
Localhost
Change
Linuxsir

Important: this is extremely important. linuxsir is the hostname of the server and can be identified by each machine on the LAN. That is, we have to make our own DNS, or use a vro for resolution. Generally, vrouters have this function. You need to do this yourself;
81st rows;

0.0.0.0
Change
192.168.1.4

Lines 277 and 278 are authenticated by the Mysql server;

Jabberd2
Secret
Change to: the following changes are based on the username and password you have granted to you in the Mysql database jabberd2;

Jabberd2beinan
123456

3.32. resolver. xml file

If this parameter is not modified, the default value is enough;

3.33 router-users.xml documents

Do not change the file. If you want to change the file, change the file to another one. This document is simple. Too much is not considered; most are default configurations;

I suggest you change the user name and password to ensure security;

     jabberd
     secret

It is better to make the above changes safer. The following is a simple example;

     jabberd1234
     654321

If the router-users.xml has made changes to the following content in other files also need to change;


    
     127.0.0.1
     5347
    
     jabberd
     secret

That is to change

    
     jabberd1234
     654321

3.34. router. xml file

If no changes are made, the default setting is good;

3.35. s2s. xml file

77th rows;
0.0.0.0
Change
192.168.1.4

3.36 sm. xml file

7th rows;

This is the Server hostname setting. The hostname you use must be identified in the LAN. This involves DNS. Currently, most routers have the DNS function specified. You need to do this by yourself; my machine is resolved to linuxsir after DNS is performed on the router;

Localhost
Change
Linuxsir

88th and 89 rows;

These two rows are also connected to the Mysql database server; also need to be modified;
Jabberd2
Secret
Change
Jabberd2beinan
123456

4. Start and manage the Jabber Server;

We have already added the jabber user to ensure service security and allow this user to add and start the Jabber Server;

Of course, we need to switch to the user jabber, and then let the user jabber start the jabberd server;

[root@localhost ~] #su jabber
[jabber@localhost ~] $ /opt/jabberd2/bin/jabberd -D

This Debug mode can be displayed if any errors occur. If not, press the Enter key to see if any errors have occurred. If not, press Ctrl + C to stop running and convert it to background running;

[jabber@localhost ~] $ /opt/jabberd2/bin/jabberd&
[jabber@localhost ~] $ ps -aux |grep jabberd
jabber 7048 12.3 1.2 5072 3184 pts/0 R 05:33 0:00 perl -w -x /opt/jabberd2/bin/jabberd
jabber 7049 2.3 0.5 4656 1452 pts/0 S 05:33 0:00 /opt/jabberd2/bin/router -c /opt/jabberd2/etc/jabberd/router.xml
jabber 7050 0.6 0.4 4552 1252 pts/0 S 05:33 0:00 /opt/jabberd2/bin/resolver -c /opt/jabberd2/etc/jabberd/resolver.xml
jabber 7051 2.0 0.6 4796 1716 pts/0 S 05:33 0:00 /opt/jabberd2/bin/sm -c /opt/jabberd2/etc/jabberd/sm.xml
jabber 7052 0.6 0.5 4644 1340 pts/0 S 05:33 0:00 /opt/jabberd2/bin/s2s -c /opt/jabberd2/etc/jabberd/s2s.xml
jabber 7053 1.6 0.6 4752 1672 pts/0 S 05:33 0:00 /opt/jabberd2/bin/c2s -c /opt/jabberd2/etc/jabberd/c2s.xml
jabber 7055 0.0 0.2 2256 732 pts/0 R+ 05:33 0:00 grep jabberd

Note:The first line is running in the background; the second line is to check whether the jabberd has been started; if a prompt similar to the above appears, it indicates that the jabberd has been running;

5. Application of the Jabber Client;

5.1 select the Jabber Client;

You can use gaim for client selection or other options. I use gaim. Please goJabber Client:Jabber Clients;

If you want to use gaim, you can go to the http://gaim.sourceforge.net to download; Windows and Linux versions are available; if you are using Linux, all the major releases have this package; just install it;

5.2. Client DNS configuration;

If you are using Linux, you have to set/etc/resolv. conf as a DNS host. For example, my setting is

nameserver 192.168.1.1

192.168.1.1 this line is the DNS server. I use a vro. This address is used when I configure the DNS;

If you are using Windows, you also need to write this on the interface where the IP address is set for the NIC; do it yourself;

5.3 use of Gaim, one of the clients of Jabber;

Gaim is easy to use. We can use Gaim to apply for an ID from the Jabber Server on the LAN;

Step 1: add an account;

Click [account] => Add =

Protocol:Select Jabber
User name:First, write your favorite one. For example, if I write beinan
Server:That is, the hostname of the Jabber Server we set earlier; my host is linuxsir;
Resource:Ignore him;
Password:Write one by yourself; because there is no registration; this is not important;
Alias:It is a nickname, such as a big gray wolf;

Click [show main options]

Jabber options

If it is available, select TLS. The other two are [force old SSL] and [Allow plain text verification on non-encrypted streams]. Do not select the two. l

Port 5222

Connect to the Server: the IP address of the machine where the Jabber Server is located. My machine is 192.168.1.4.

Proxy type: you do not need to change it to keep the original status. [Use global proxy settings]

Step 2 register an account;

These are all added, and then click [register];

Then write the user name and password. The user will prompt that the registration is successful;

Step 3 modify the account

We have to start from scratch, click [account], and then select the account that you just registered successfully; click Modify, and modify it as mentioned above; you only need to change the connection server in [display main options. This is because it is empty. You just need to change it to the IP address of your own server. My server is 192.168.1.4. I changed it to 192.168.1.4;

The same applies to Gaim for Windows users;

6. Some questions;

6.1. Can jabberd2 chat with users like MSN, Yahoo Messager, and ICQ;

Yes, but some plug-ins need to be installed. In my opinion, these plug-ins are a little difficult. Because I have tested some plug-ins, but cannot solve some dependencies. When the dependency is solved, it cannot be applied. The error is yes.

http://www.jabber.org/software/components.shtml

6.2. Can jabberd2 support file transfer from the client;

Third-party plug-ins are required if the default installation is not supported. Currently, there are three methods. On the jabber homepage, if you want to implement the file transfer function, it is related to the client; I have tested many types, but I still cannot. Psi is said to work, and I cannot do it after testing. It may be difficult to transmit files on the client. Maybe it will be solved soon?

What if it is solved through the server? It is also possible that there are two ways; proxy65 and the way to define the apache dav module; the apache dav module is said to be relatively simple. But I have not tried it. According to foreigners, it is not safe; the proxy65 method is also difficult. He relies on too many things, such as python, zope, twist, pyopenssl ...... many; although it can solve the dependency, proxy65 still cannot run the same way;

Let's test it by yourself. writing these things is not just about letting new users go too far;

6.3. Can jabberd2 support voice or telephone functions;

I have not carefully read this success case. But I have not seen it through the jabberd2 document. It may be difficult to find a third-party plug-in;

7. About this article

This article is the most simple setup of the Jabber instant messaging server. There are not many features, of course, the security mechanism is not taken into account. High-level documents are not something I can write, of course, I am also trying to write a high-level document, but I still don't have this ability, so I can only look forward to the appearance of experts, or look forward to becoming masters one day;

This document is intended for beginners;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.