fluffos连接mysql_【转】ffluos编译

FluffOS是在MUDOS基础上更新完成的。进行了许多新功能和bug修复。 针对LPC有很好的兼容性,如果你的MUD运行MUDOS V22+版本,可以很容易运行在fluffos上。

系统环境:

CnetOS7.x mini 最小化安装

安装 mysql-community-devel 需要先安装mysql的源

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm

安装编译环境

yum install git

yum install gcc-c++yum install bison-devel

yum install libevent-devel

yum install zlib-devel

yum install pcre-devel

yum install autoconf

yum install dos2unix

yum install golang

yum install mysql-community-devel

yum install unzip

yum install pam-devel

Git获取FluffOS最新源码

git clone https://github.com/fluffos/fluffos.git

这个是fluffos3.o.x 设置好的 local_options ,兼容旧 Mudlib ( 后面有时间再补充每条设置的说明 )

注意:#undef SENSIBLE_MODIFIERS 如果关注支持(static模式),如果打开将不支持(static模式)

需要修改mudlib的部分代码,关健词(static、array),static改为 nosave, array改为 mixed/** local_options.h: compile-time configuration of the driver*/#ifndef _LOCAL_OPTIONS_H_#define _LOCAL_OPTIONS_H_

/****************************************************************************

* COMPAT *

****************************************************************************/

#undef NO_ADD_ACTION

#undef NO_SNOOP

#undef NO_ENVIRONMENT

#undef NO_WIZARDS

#undef NO_LIGHT

#define OLD_ED

#undef ED_INDENT_CASE

#define ED_INDENT_SPACES 4

#undef ED_USE_TABS

#define ED_TAB_WIDTH 8

#undef RECEIVE_ED

#define RESTRICTED_ED

#define SENSIBLE_MODIFIERS

#define ARRAY_RESERVED_WORD

/****************************************************************************

* MISCELLANEOUS *

****************************************************************************/

#define CUSTOM_CRYPT

#undef COMPAT_32

#define DEFAULT_PRAGMAS PRAGMA_SAVE_TYPES + PRAGMA_ERROR_CONTEXT + PRAGMA_OPTIMIZE

#define SAVE_EXTENSION ".o"

#undef PRIVS

#undef NO_SHADOWS

#undef USE_ICONV

#undef IPV6

#undef DTRACE

/****************************************************************************

* PACKAGES *

****************************************************************************/

#define PACKAGE_OPS

#define PACKAGE_CORE

#define PACKAGE_CONTRIB

#define PACKAGE_DEVELOP

#define PACKAGE_MATH

#undef PACKAGE_MATRIX

#define PACKAGE_MUDLIB_STATS

#define PACKAGE_SOCKETS

#undef PACKAGE_PARSER

#define PACKAGE_EXTERNAL#ifdef PACKAGE_DB#define USE_MYSQL 1

#undef USE_MSQL

#undef USE_POSTGRES

#undef USE_SQLITE3

#define DEFAULT_DB USE_MYSQL

#endif

#define PACKAGE_ASYNC

#define PACKAGE_SHA1

#undef PACKAGE_CRYPTO

#define PACKAGE_TRIM

#define PACKAGE_PCRE

#undef PACKAGE_DWLIB

#define PACKAGE_UIDS#ifdef PACKAGE_UIDS#define AUTO_SETEUID

#undef AUTO_TRUST_BACKBONE

#endif

#define PACKAGE_COMPRESS

#define SAVE_GZ_EXTENSION ".o.gz"

#undef PACKAGE_THREAD

#undef DEBUGMALLOC

#undef DEBUGMALLOC_EXTENSIONS

#undef CHECK_MEMORY

#endif /* _LOCAL_OPTIONS_H_ */编译FluffOS过程

$ cd fluffos

$ ./build.FluffOS #如果你编译环境缺少依赖包会在这个过程提醒,通过 yum search xxx 查找,安装再继续build

$ make #上面build这一步通过,这一步基本没什么问题,很顺利

$ make install

部署你的 FluffOS+MudLib

#假设你的fluffos编译目录在/home/fluffos/#假如你的mudlib运行目录在/home/xxxmud/

/home/fluffos/src/编译成功后的驱动(driver、dtrace_compile)

|--src/|---driver/home/xxxmud/#mud布署目录||------ bin/

||--driver #刚编译好的驱动移到这里||-- config.ini #mud配置文件( 要参考/home/fluffos/src/Config.example 修改 )|

|------ mudlib/#把你的mudlib整个打包解压放到这里|--adm|--binaries|--.............

有关mud配置文件 参考/home/fluffos/src/Config.example 进行修改

下面放一个config.ini 样例:

vi/home/xxxmud/bin/config.ini

name : HY-JHFY

mud ip :0.0.0.0# all ip

external_port_1 : telnet8888external_port_2 : binary6666mudlib directory :/home/xxxmud/code

binary directory :/home/xxxmud/bin

log directory :/log

include directories :/include

master file :/adm/single/master

simulated efun file :/adm/single/simul_efun

swap file :/adm/single/swapfile

debug log file : debug.logglobal include file : "/include/globals.h"

default fail message : What?

defaulterror message :

time to clean up :900time to reset :1800time to swap :900compiler stack size :600evaluator stack size :6000inherit chain size :30maximum evaluation cost :30000000maximum local variables :200maximum call depth :150maximum array size :25000maximum buffer size :400000maximum mapping size :150000maximumstring length : 320000maximum bitsin a bitfield : 12000maximumbyte transfer : 200000maximum read file size :320000hash table size :7001

object table size : 1501living hash table size :256gametick msec :1000heartbeat interval msec :1000sane explodestring : 1reversible explodestring : 0sane sorting :1warn tab :0wombles :0call other type check :0call other warn :0mudlib error handler :1no resets :0lazy resets :0randomized resets :1no ansi :1strip before process input :1

this player in call_out : 1trace :1trace code :0interactivecatch tell : 0receive snoop :1snoop shadowed :0reverse defer :0has console :1noninteractive stderr write :0trap crashes :1old type behavior :0old range behavior :0warn old range behavior :1supress argument warnings :1enable_commands call init :1sprintf add_justified ignore ANSI colors :1apply cache bits :22call_out(0) next level : 1000maximum users :5000好了下面我们开始启动mud服务吧,继续往下看介绍将mud加为centos服务自动启动。

[root@mud]#/home/hymud/bin/driver /home/hymud/bin/config.conf&在部署过程中会遇到的一些问题1、Linux (*.h *.c )乱码及回车符号问题

由于大多人编码在windows下编码,在Linux上需要转换一下(或者通过ftp上传时会可自动转码)

使用下面的命令进行转码操作

[root@mud mud]# cd/home/xxxmud

[root@mud mud]# find .-name "*.h" -exec dos2unix {} \;

[root@mud mud]# find .-name "*.c" -exec dos2unix {} \;

[root@mud mud]# find .-name "*.o" -exec dos2unix {} \;2、迁移后用户密码错误登陆不了

因为FluffOS 默认使用md5加密,不过 FluffOS 同样兼容 crypt 加密

修改 vi/home/xxxmud/mudlib/include/globals.h 不同的mudlib 可能位置不一样

加入#define crypt oldcrypt 即可。

//globals.h//this file will be automatically included by the driver

#define SAVE_EXTENSION __SAVE_EXTENSION__

#define save_binary

#pragma optimize

#pragma save_binary

#define crypt oldcrypt

3、服务器端出现很多警告信息

出现这个问题,一般是因为你编译时的 local_options 设置问题,去掉 PRAGMA_WARNINGS 重新编译。

修改:#define DEFAULT_PRAGMAS PRAGMA_WARNINGS + PRAGMA_SAVE_TYPES + PRAGMA_ERROR_CONTEXT + PRAGMA_OPTIMIZE改为:#define DEFAULT_PRAGMAS PRAGMA_SAVE_TYPES + PRAGMA_ERROR_CONTEXT + PRAGMA_OPTIMIZE

4、将你的mud 加入到 centos 的自动启动服务的教程及脚本

编译启动脚本

记得要修改脚本内的以下配置为你的实际配置

########## Mud Start Config ############

DIR=/home/xxxmud/bin #你实际的mud fluffos驱动地址

MUDCONFIG=${DIR}/config.ini #你mud的配置文件名字

MUDNAME=HY6 #你mud的名字,用于存放进程pid号

MUDSTARTNAME=xxxmud #你mud这个启动脚本的名字

########################################

vi/etc/rc.d/init.d/xxxmud

#!/bin/bash

#chkconfig:2345 80 90#description:hymud

########## Mud Start Config ############

DIR=/home/xxxmud/bin

MUDCONFIG=${DIR}/config.ini

MUDNAME=HY6

MUDSTARTNAME=xxxmud

########################################

RETVAL=0NUM=0ulimit-n 65535echo999999999 > /proc/sys/vm/max_map_count

usage ()

{

echo $"Usage: $0 {start|stop|restart|status}" 1>&2RETVAL=2}

start ()

{while(( $NUM < 1))dosn=`ps -ef | grep driver | grep -v grep |awk '{print $2}'`if [ !$sn ]; then

sn=0fi

function ck_pid() {if [[ -f $1]]; thenif [[ ${sn} = `cat $1` ]]; then

echo"${MUDSTARTNAME} Service Runing PID: ${sn}"

else${DIR}/driver ${MUDCONFIG} &echo $! > ${DIR}/${MUDNAME}.pid

fielse${DIR}/driver ${MUDCONFIG} &echo $! > ${DIR}/${MUDNAME}.pid

fi

}

ck_pid ${DIR}/${MUDNAME}.pid

sleep5done

}

stop ()

{

function kill_pid() {if [[ -f $1]]; then

kill -9 `cat $1`

rm $1fi

}

kill_pid ${DIR}/${MUDNAME}.pid

["$?" != "0" ] && RETVAL=1}

status ()

{

sn=`ps -ef | grep driver | grep -v grep |awk '{print $2}'`if [ !$sn ]; then

sn=0fi

function ck_pid() {if [[ -f $1]]; thenif [[ ${sn} = `cat $1` ]]; then

echo"${MUDSTARTNAME} Service Runing PID: ${sn}"

elseecho"${MUDSTARTNAME} Service Not Run"fi

fi

}

ck_pid ${DIR}/${MUDNAME}.pid

}

restart ()

{

stop

start

}case "$1" instop) stop ;;

status) status ;;

start|restart) restart ;;*) usage ;;

esac

exit $RETVAL

然后加入系统服务来启动

#改变权限

chown root.root/etc/rc.d/init.d/xxxmud #所有用户都可以执行,单只有root可以修改

chmod+x /etc/rc.d/init.d/xxxmud #将mysqld 放入linux启动管理体系中

chkconfig--add xxxmud #打开自启动

chkconfig xxxmud on

#相关使用命令

service xxxmud start #启动mud服务

service xxxmud restart #重启mud服务

service xxxmud stop #停止mud服务

service xxxmud status #查看mud运行状态

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值