linux聊天服务器搭建,Linux搭建Openfire服务器

### 1. 安装java环境

下载jdk-8u51-linux-x64.rpm,用sftp命令上传到服务器

```

//连接sftp

sftp root@xxx.xxx.xxx.xxx

//上传

sftp put 本地文件路径 目标服务器路径

```

ssh登录服务器

```

ssh root@xxx.xxx.xxx.xx

```

cd到文件所在目录,使用rpm命令安装

```

rpm -ivh jdk-8u51-linux-x64.rpm

```

安装完成以后,查看一下java版本,如果有信息就是安装成功了

```

[root@iZ2550br7l7Z usr]# java -version

java version "1.8.0_51"

Java(TM) SE Runtime Environment (build 1.8.0_51-b16)

Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

```

### 2. 安装MySQL

2.1、添加mysql rpm到你的rpm仓库

```

yum install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

```

![Alt text](./1439957495999.png)

2.2、安装 mysql

```

yum install mysql-community-server

```

![Alt text](./1439957531761.png)

2.3、开启 mysql

```

systemctl start mysqld

```

```

[root@localhost ~]# ps aux | grep mysql

mysql 2925 0.0 0.1 115216 1672 ? Ss 04:05 0:00 /bin/sh /usr/bin/mysqld_safe

mysql 3076 0.6 10.8 696716 109480 ? Sl 04:05 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --pl=/var/lib/mysql/mysql.sock

root 3102 0.0 0.0 112640 976 pts/0 R+ 04:06 0:00 grep --color=auto mysql

```

修改mysql root密码

```

mysqladmin -u root password 123456

```

如果有必要,可以修改my.cnf

```

[root@localhost ~]# vi /etc/my.cnf

```

2.4、重启mysql服务

```

systemctl restart mysqld

```

2.5、设置自启动

```

chkconfig mysqld on

```

如果忘记了root密码:

2.6、编辑/etc/my.cnf

在[mysqld] 配置部分添加一行

```

skip-grant-tables

```

2.7、保存后重启mysql

```

[root@localhost etc]# service mysqld restart

Shutting down MySQL. [ OK ]

Starting MySQL. [ OK ]

```

2.8、登录数据库重新设置root密码

```

[root@localhost ~]# mysql -uroot -p mysql

Enter password:

```

直接回车进入

```

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.1.47-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

This software comes with ABSOLUTELY NO WARRANTY. This is free software,

and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| test |

+--------------------+

3 rows in set (0.00 sec)

```

执行下列语句

```

mysql> update user set password=password("yourpassword") where user='root';

Query OK, 4 rows affected (0.00 sec)

Rows matched: 4 Changed: 4 Warnings: 0

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

```

2.9、删除/etc/my.cnf文件中添加的“skip-grant-tables”行,重启mysql;

用新设的密码就能正常登录了;

### 3. 安装Openfire

3.1 下载安装openfire

```

wget http://igniterealtime.org/downloads/download-landing.jsp?file=openfire/openfire-3.10.0-1.i386.rpm

rpm -ivh openfire-3.10.0-1.i386.rpm

```

3.2、设置openfire数据库

```

# mysql -p

mysql> CREATE DATABASE openfire CHARACTER SET utf8 COLLATE utf8_general_ci;

mysql> GRANT ALL ON openfire.* TO 'openfire'@'localhost' IDENTIFIED BY 'yourpassword';

mysql> flush privileges;

mysql> use openfire;

mysql> source /opt/openfire/resources/database/openfire_mysql.sql;

mysql> exit

```

3.3、开启openfire

```

# service openfire start

# chkconfig openfire on

```

如果开启失败,安装libstdc++库

```

yum install libstdc++.i686

```

然后重新执行开启openfire的命令。

如果还开启失败,再安装以下依赖库,我第一次安装了第一个依赖库就可以了,第二次装了下面这个才运行起来。

运行起来之后,就可以用浏览器访问http://服务器IP:9090打开openfire的后台了,接下来按着提示步骤设置即可。

```

yum install -y glibc.i686

```

### 4. XMPP服务器集群搭建 - ejabberd插件

待续。。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值