LinuxMint 17 安装 jabberd2 服务器与web客户端

2024-02-11 23:18

本文主要是介绍LinuxMint 17 安装 jabberd2 服务器与web客户端,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

说明:1-5步为安装web聊天服务,如不需要可跳过1-5步。


1. 安装nginx

sudo apt-get install nginx


2. 安装php5-fpm

sudo apt-get install php5-fpm


3. 安装jappix的文件

下载jappix。

 下载地址:http://jappix.org

将jappix的php源码拷贝到/usr/share/nginx/html下,完成文件安装。


4.  为jappix 配置nginx 

 nginx配置文件路径/etc/nginx/sites-enabled/default

配置文件添加修改:

server中:

inex index.php

locaation - /(app|i18n|log|test|tmp|tools)/ {

    deny all;

}

location / {

    try_files $uri $uri/ =404;

    index index.php;

}

location - \.php$ {

    fastcgi_pass unix:/var/run/php5-fpm.sock;

    fastcgi_index index.php;

    include fastcgi_params;

}

重启nginx.

sudo service nginx restart

5. 安装jappix 

a.安装前设置:

sudo kate /etc/php5/fpm/php.ini

修改:

post_max_size=100M

upload_max_size=100M

memory_limit=160M


b.在浏览器输入http://localhost.进入初次使用安装。

照提示一步一步安成设置,完成安装。


6. 安装 jabberd2 

 下载jabber2  源码备用。

下载地址:http://jabberd2.org

非编译安装:sudo apt-get install jabberd2 

非编译安装就完成了。

编译安装如下:

sudo apt-get install libpq-dev openssl libssl-dev libexpat-dev libidn11-dev libudns-dev libgsasl7-dev

./configure --enable-pgsql --enable-ssl --with-extra-include-path=./c2s/:usr/include/postgresql/

make

make install

 jabber用户

安装好后应是自动创建好了jabber用户与jabber用户组。

如没有添加:groupad jabber

userad -g jabber jabber

为jabber的 PID's和Logs新建目录

mkdir -p /usr/local/var/jabberd/pid/

chown R jabber:jabber /usr/local/var/jabberd/pid/


mkdir -p /usr/local/var/jabberd/log/

chown -R jabber:jabber /usr/local/var/jabberd/log/

jabberd 2 安装的缺少位置

/usr/local/etc/jabberd

设置配置文件的所有权

chown -R root:jabber /usr/local/etc/jabberd/*

chmod -R 640 /usr/local/etc/jabberd/*

7.配置domain

更改/etc/hostname:

更改为localhost



更改/etc/hosts:(注:localhost这个名字要与/etc/hostname中的名字一样,就是要改成电脑名。)

添加127.0.0.1   localhost.localdomain  localhost



完成后执行:

sudo service network-manager restart

sudo service networking restart


8. jabberd2 的一些设置

 主机名设置

在sm.xml

<sm>

         <local>

                       <id>computer_name(或localhost).localdomain</id>

在c2s.xml

<c2s>

           <local>

                        <id> computer_name(或localhost).localdomain</id>


9. 安装 postgresql

sudo apt-get install postgresql


10.给jabberd2 配置postgresql

注:如产生错误:

a. PostgreSql:createdb -U postgres mydb 错误:createdb: could not connect to database postgres: FATAL: P

b. psql -U myusername mydb 错误:psql: FATAL: Ident authentication failed for user "mypguser"
则:
sudo editor /etc/postgresql/9.3/main/pg_hba.conf
将其中的peer改成trust,完成上述错误的解决。
然后重启:sudo service postgresql restart

提供和配置PostgreSQL

PostgreSQL 和MySQL一样,提供一个非常易于管理的后端用于存储和验证. 和MySQL不同的是, PostgreSQL提供了更好的 unicode支持.

提供PostgreSQL

如果你使用PostgreSQL存储 和/或 验证请完成本节. 为了给Jabberd配置PostgreSQL, 你必须新建一个数据库,新建一个PostgreSQL用户并运行Jabberd 2分发包里带的PostgreSQL脚本.

为Jabberd新建数据库. (PostgreSQL服务器应该已经在运行):

      createdb -U postgres jabberd2

以上命令讲新建一个数据库,你可以在那个数据库运行接哦本来安装Jabberd PostgreSQL数据库.

N 注意: Unicode支持

如果你希望为你的PostgreSQL数据库激活Unicode支持, 把以上命令修改如下:
      createdb -U postgres -E UNICODE jabberd2

P 参数: PostgreSQL用户名和密码

新建你的Jabberd数据库用户, 输入以下命令:
      createuser -P -U postgres jabberd2

这个命令将初始化一个交互用户创建脚本. 当看到提示, 输入将来用于连接到你的PostgreSQL数据库的Jabberd的密码:

      Enter password for user "jabberd2":Enter it again:Shall the new user be allowed to create databases? (y/n) nShall the new user be allowed to create more new users? (y/n) nCREATE USER

CREATE USER 信息表示命令执行成功.

在你的jabberd用户创建之后, 你已经准备好运行PostgreSQL安装脚本了. 这个脚本位于 '\[Jabberd Source Files\]\/tools'. 切换到 tools 目录并以jabberd2用户身份启动PostgreSQL控制台:

      psql -U jabberd2 jabberd2

然后, 从PostgreSQL控制台运行 db-setup.pgsql 脚本:

      jabberd2=>\i db-setup.pgsql

PostgreSQL现在准备好用于Jabberd了.

等下一步后可重启一下postgresql。

然后可用下面语句测试查入一个用户,但我查入后发现不能使用这个用户:

insert into authreg(username,realm,password) values('testuser1','localhost.localdomain','passowrd');

配置存储使用PostgreSQL(sm.xml)

如果你使用PostgreSQL存储,请完成本节. 大多数使用PostgreSQL存储的安装只需要设置驱动, 用户和密码.

在 sm.xml 里标为 Storage database configuration 的段落下, 确保 driver 是用 pgsql (PostgreSQL):

<sm><!-- Storage database configuration --><storage><!-- By default, we use the MySQL driver for all storage --><driver>pgsql</driver>

P 参数: PostgreSQL用户名和密码

在  sm.xml 里标为  PostgreSQL driver configuration 的段落下, 把  secret 替换成你的PostgreSQL密码. 如果你不使用缺省用户(jabberd2)则还要修改用户名 :
      <!-- PostgreSQL driver configuration --><pgsql><!-- PostgreSQL connection info.For the rest of the options seehttp://www.postgresql.org/docs/8.0/interactive/libpq.html --><conninfo>dbname=jabberd2 user=jabberd2 password=secret</conninfo> <!-- Database server host and port --><host>localhost</host><port>5432</port><!-- Database name --><dbname>jabberd2</dbname><!-- Database username and password --><user>jabberd2</user><pass>secret</pass><!-- Transaction support. If this is commented out, transactionswill be disabled. This might make database accesses faster,but data may be lost if jabberd crashes. --><transactions/></pgsql>

注意只有你的PostgreSQL服务器运行在另一个主机上你才应该修改host设置. 只有你的PostgreSQL服务器运行在一个非标准端口(5432是PostgreSQL安装后的缺省端口)你才应该修改port设置. transaction support 段落则是不言自明的了.

现在Jabberd 2已经配置成使用PostgreSQL来存储了.

如果你希望使用一个不同于PostgreSQL的验证包, 跳到你选择的验证包:

  • 提供和配置PAM
  • 提供和配置OpenLDAP

否则, 继续到 4.5.3. 直接往下完成你的Jabberd 2配置.

配置验证使用PostgreSQL(c2s.xml)

如果你使用PostgreSQL来验证,请完成本节. Jabberd 2对于PostgreSQL验证配置的要求同上,除了包含在 c2s.xml 的信息.

在 c2s.xml 的 Authentication/registration database configuration (验证/注册 数据库配置)段落, 确保 driver 使用pgsql (PostgreSQL):

<c2s><!-- Authentication/registration database configuration --><authreg><!-- Backend module to use --><module>pgsql</module>

P 参数: PostgreSQL用户名和密码

在  c2s.xml 的  PostgreSQL module configuration 段落, 把  secret 替换成你的PostgreSQL密码. 如果你不使用缺省用户(jabberd2)则还要修改用户名 :
<c2s><pgsql><!-- PostgreSQL connection info.For the rest of the options seehttp://www.postgresql.org/docs/8.0/interactive/libpq.html --><conninfo>dbname=jabberd2 user=jabberd2 password=secret</conninfo><!-- Alternatively you may set connection settings separately.These are used only in absence of 'conninfo' --><!-- Database server host and port --><host>localhost</host><port>5432</port><!-- Database name --><dbname>jabberd2</dbname><!-- Database username and password --><user>jabberd2</user><pass>secret</pass></pgsql>

注意只有你的PostgreSQL服务器运行在另一个主机上你才应该修改host设置. 只有你的PostgreSQL服务器运行在一个非标准端口(5432是PostgreSQL安装后的缺省端口)你才应该修改port设置.

你的Jabberd 2的存储和验证配置现在完成了. 在转移到其他配置任务(例如 第五章 的配置SSL)之前,跳到 测试服务器 去开始测试你的服务器.


 

jabberd2 的postgresql的配置完成。

再重启服务:

sudo service postgresql restart

sudo service jabberd2 restart


11. 用gajim 创建测试用户

a. 安装GAJIM: sudo apt-get install GAJIM

b. 在GAJIM中的用户管理中,选择添加用户,选择创建一个新用户为添加用户。

c. 在弹出的对话框中输入服务器:localhost.localdomain(localhost 是本地主机名在/etc/hostname中修改),在自定主机名端口中输入127.0.0.1(或服务器IP) 与端口5222,点击forward.

d.输入username 与 password ,点击forward.

e.完成新用户注册


可照上面方法再添加一个用户,这样就可以完成消息发送测试。



jabberd2设置iptables防火墙:
sudo iptables -P INPUT DROP
sudo iptables -P OUTPUT ACCEPT
sudo iptables -P FORWARD DROP

sudo iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 443 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT

sudo iptables -A OUTPUT -p tcp --sport 21 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 21 -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 20 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 20 -j ACCEPT
sudo iptables -A INPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

sudo iptables -A OUTPUT -p icmp -j ACCEPT
sudo iptables -A INPUT -p icmp -j ACCEPT
sudo iptables -A INPUT -i lo -p all -j ACCEPT
sudo iptables -A OUTPUT -o lo -p all -j ACCEPT

sudo iptables -A OUTPUT -p tcp --sport 5432 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 5432 -j ACCEPT


sudo iptables -A INPUT -p tcp -m tcp --dport 5222 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 5222 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport 5223 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 5223 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport 5269 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 5269 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport 5280 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 5280 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport 4369 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 4369 -j ACCET
sudo iptables -A INPUT -p udp -m udp --dport 4369 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport 53873 -j ACCEPT







这篇关于LinuxMint 17 安装 jabberd2 服务器与web客户端的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/701078

相关文章

一文详解如何查看本地MySQL的安装路径

《一文详解如何查看本地MySQL的安装路径》本地安装MySQL对于初学者或者开发人员来说是一项基础技能,但在安装过程中可能会遇到各种问题,:本文主要介绍如何查看本地MySQL安装路径的相关资料,需... 目录1. 如何查看本地mysql的安装路径1.1. 方法1:通过查询本地服务1.2. 方法2:通过MyS

电脑软件不能安装到C盘? 真相颠覆你的认知!

《电脑软件不能安装到C盘?真相颠覆你的认知!》很多人习惯把软件装到D盘、E盘,刻意绕开C盘,这种习惯从哪来?让我们用数据和案例,拆解背后的3大原因... 我身边不少朋友,在使用电脑安装软件的时候,总是习惯性的把软件安装到D盘或者E盘等位置,刻意避开C盘。如果你也有这样的习惯,或者不明白为什么要这么做,那么我

Nginx使用Keepalived部署web集群(高可用高性能负载均衡)实战案例

《Nginx使用Keepalived部署web集群(高可用高性能负载均衡)实战案例》本文介绍Nginx+Keepalived实现Web集群高可用负载均衡的部署与测试,涵盖架构设计、环境配置、健康检查、... 目录前言一、架构设计二、环境准备三、案例部署配置 前端 Keepalived配置 前端 Nginx

ubuntu20.0.4系统中安装Anaconda的超详细图文教程

《ubuntu20.0.4系统中安装Anaconda的超详细图文教程》:本文主要介绍了在Ubuntu系统中如何下载和安装Anaconda,提供了两种方法,详细内容请阅读本文,希望能对你有所帮助... 本文介绍了在Ubuntu系统中如何下载和安装Anaconda。提供了两种方法,包括通过网页手动下载和使用wg

ubuntu如何部署Dify以及安装Docker? Dify安装部署指南

《ubuntu如何部署Dify以及安装Docker?Dify安装部署指南》Dify是一个开源的大模型应用开发平台,允许用户快速构建和部署基于大语言模型的应用,ubuntu如何部署Dify呢?详细请... Dify是个不错的开源LLM应用开发平台,提供从 Agent 构建到 AI workflow 编排、RA

如何在Ubuntu上安装NVIDIA显卡驱动? Ubuntu安装英伟达显卡驱动教程

《如何在Ubuntu上安装NVIDIA显卡驱动?Ubuntu安装英伟达显卡驱动教程》Windows系统不同,Linux系统通常不会自动安装专有显卡驱动,今天我们就来看看Ubuntu系统安装英伟达显卡... 对于使用NVIDIA显卡的Ubuntu用户来说,正确安装显卡驱动是获得最佳图形性能的关键。与Windo

ubuntu16.04如何部署dify? 在Linux上安装部署Dify的技巧

《ubuntu16.04如何部署dify?在Linux上安装部署Dify的技巧》随着云计算和容器技术的快速发展,Docker已经成为现代软件开发和部署的重要工具之一,Dify作为一款优秀的云原生应用... Dify 是一个基于 docker 的工作流管理工具,旨在简化机器学习和数据科学领域的多步骤工作流。它

SpringBoot快速搭建TCP服务端和客户端全过程

《SpringBoot快速搭建TCP服务端和客户端全过程》:本文主要介绍SpringBoot快速搭建TCP服务端和客户端全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,... 目录TCPServerTCPClient总结由于工作需要,研究了SpringBoot搭建TCP通信的过程

Docker安装MySQL镜像的详细步骤(适合新手小白)

《Docker安装MySQL镜像的详细步骤(适合新手小白)》本文详细介绍了如何在Ubuntu环境下使用Docker安装MySQL5.7版本,包括从官网拉取镜像、配置MySQL容器、设置权限及内网部署,... 目录前言安装1.访问docker镜像仓库官网2.找到对应的版本,复制右侧的命令即可3.查看镜像4.启

debian12安装docker的实现步骤

《debian12安装docker的实现步骤》本文主要介绍了debian12安装docker的实现步骤,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着... 目录步骤 1:更新你的系统步骤 2:安装依赖项步骤 3:添加 docker 的官方 GPG 密钥步骤