otrs安装mysql_安装配置otrs客服系统

本文档详细介绍了如何在Linux环境中安装OTRS客服系统,包括安装前的准备工作、安装OTRS所需模块、解决安装过程中的问题、配置Apache、设置文件权限、系统测试和数据导入。遇到的常见问题如找不到mysql_config文件、libmysql.so.15共享对象文件缺失等,通过调整环境变量和添加库文件路径得以解决。最后,文章提到了数据的导入和数据库的同步步骤。
摘要由CSDN通过智能技术生成

7eb3e0672a919999a084342368b079a6.png

0cc6569450afffd4f975b5309e397c0a.png

0cc6569450afffd4f975b5309e397c0a.png

0cc6569450afffd4f975b5309e397c0a.png

0cc6569450afffd4f975b5309e397c0a.png

0cc6569450afffd4f975b5309e397c0a.png

0cc6569450afffd4f975b5309e397c0a.png

ed8fc638cd806b02029203b45a148a24.png

安装配置otrs客服系统

2011-10-20

一、安装OTRS步骤和问题解决方法二、OTRS-Kernel文件移动三、OTRS文件权限四、OTRS测试五、数据导入六、同步数据库

(先要安装apache和mysql,mysql在安装前要启动好)

一、安装OTRS步骤和问题解决方法

把otrs压缩包放在/opt下后解压

linux:/opt# useradd -d /opt/otrs/ -c 'OTRS user' otrs

linux:/opt# usermod -G nogroup otrs

linux:/opt#

linux:/opt# cd otrs/Kernel/

linux:/opt/otrs/Kernel# cp Config.pm.dist Config.pm

linux:/opt/otrs/Kernel# cd Config

linux:/opt/otrs/Kernel/Config# for foo in *.dist; do cp $foo `basename $foo .dist`; done

linux:/opt/otrs/Kernel/Config# cd /opt/otrs/bin/

以下步骤安装时出现过很多问题.

linux:/opt/otrs/bin# ./otrs.checkModules

CGI ... ok

Date::Pcalc ... ok

Date::Format ... not installed! (required - use "perl -MCPAN -e shell:")

DBI ... not installed! (required - use "perl -MCPAN -e shell:")

DBD::mysql ... not installed! (required - use "perl -MCPAN -e shell:")

Digest::MD5 ... ok

Crypt::PasswdMD5 ... ok

LWP::UserAgent ... ok

IO::Scalar ... ok

IO::Wrap ... ok

MIME::Base64 ... ok

MIME::Tools ... ok

Mail::Internet ... ok

Net::DNS ... ok

Net::POP3 ... ok

Net::LDAP ... ok

Net::SMTP ... ok

Authen::SASL ... ok

GD ... not installed! (for PDF output - not required)

GD::Text ... not installed! (for PDF output - not required)

GD::Graph ... not installed! (for PDF output - not required)

GD::Graph::lines ... not installed! (for PDF output - not required)

GD::Text::Align ... not installed! (for PDF output - not required)

XML::Parser ... ok

linux:/opt/otrs/bin#

出现not installed! (required - use "perl -MCPAN -e shell:")的情况

我们根据他的给提示 use "perl -MCPAN -e shell:" 来解决问题

linux:/opt/otrs/bin# perl -MCPAN -e shell

刚开始他会提示你安装cpan 和安装的路径 全部默认就可以了

在选国家的时候,选2.再选中国china,接着选1. 装好之后 会出现:cpan[1]>的字样

cpan[1]> install Date::Format

.....

cpan[2]> install DBI

.....

以上都可以一次过装好,如果没能一次装好,按以下提示操作

提示:    如果没办法装上,那就自己到网上找到相应的安装包.安装就可以了

在装100这台机时.我的CPAN用不了,也就是它没能够把安装包下载下来.

还好我们在测试机上已经安装好了这些MODULES,把它们复制过来后安装

就好了.由于我是在测试机上把安装包复制过来的,所以没办法提供相关

的网站地址.I just to say sorry.

安装DBD::mysql时会出现以下的问题.

cpan[3]> install DBD::mysql

问题1: "找不到mysql_config文件或者目录"

解决方法:

退出CPAN后在

到cpan的目录下找到 DBD-mysql-4.001文件

# cd /root/.cpan/build/

# ls

# cd DBD-mysql-4.001

# PATH="$PATH:/usr/local/mysql/bin"

# export PATH

把他的路径指定到usr/local/mysql/bin下让其找到mysql_config这个文件

便可以解决此问题.

我们在此文件夹下安装DBD::mysql

# perl Makefile.PL

# make install

问题2: 出现"......libmysql.so.15:无法打开共享对象文件:没有那个文件或目录"

解决方法

# vi /etc/ld.so.conf

加入下面的命令,用于指定libmysql.so.15的路径

# /usr/local/mysql/lib/mysql

#

保存退出 执行:

# sbin/ldconfig  /etc/ld.so.conf

然后我们在test一下

到/root/.cpan/bulid/DBD-mysql-4.001下面

# perl Makefile.PL

# make install

# ...

如果还装不上,到http://search.cpan.org/dist/DBD-mysql/下载过一个DBD-mysql

解压后perl Makefile.Pl

make install

一般都可以了

安装后之后我们到OTRS中再checkmodules一下,以保证所需要的模块都显示为ok

# cd /opt/otrs/bin

# ./otrs.checkModules

CGI ... ok

Date::Pcalc ... ok

Date::Format ... ok

DBI ... ok

DBD::mysql ... ok

Digest::MD5 ... ok

Crypt::PasswdMD5 ... ok

LWP::UserAgent ... ok

IO::Scalar ... ok

IO::Wrap ... ok

MIME::Base64 ... ok

MIME::Tools ... ok

Mail::Internet ... ok

Net::DNS ... ok

Net::POP3 ... ok

Net::LDAP ... ok

Net::SMTP ... ok

Authen::SASL ... ok

GD ... not installed! (for PDF output - not required)

GD::Text ... not installed! (for PDF output - not required)

GD::Graph ... not installed! (for PDF output - not required)

GD::Graph::lines ... not installed! (for PDF output - not required)

GD::Text::Align ... not installed! (for PDF output - not required)

XML::Parser ... ok

安装GD时我们出现了同样的的找不到文件或目录的错误!

GD装不上,则显示不了图片.

我们可以参照安装 DBD::mysql 时的做法,

# cd /root/.cpan/build/GD-2.35

#

# LD_LIBRARY_PATH="/usr/local/lib"

# export LD_LIBRARY_PATH

# perl Makefile.PL

# make install

然后再用/opt/otrs/bin/otrs.checkmodules.sh检查一下是不是ok了

实在不行用perl Makefile.PL --ignore具体我忘了,系统会给出提示,注意看屏幕输出

perl安装模块有些麻烦,经过安装这么多遍,总结了条经验就是如果在perl -MCPAN -e shell里安装不成功就到/root/.cpan/build/目录下找到模块的目录,再运行

perl Makefile.PL ;make ; make install

再不行就去下载过一个,比如上面的DBD-mysql

已经安装的差不多了!

现在我们还差 用cgi图形界面来导入数据库

***** 这里要设置apache的httpd.conf文件 *******

# vi /usr/local/apache2/conf/httpd.conf

# ...

AddHandler cgi-script. .cgi .pl

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

AddType application/x-httpd-php .php .phtm

AddType application/x-httpd-php-source .phps

DirectoryIndex index.html index.pl index.php

Options Indexes ExecCGI  FollowSymLinks

NameVirtualHost *:80

Options Indexes FollowSymlinks

AllowOverride None

Allow from all

ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/"

Options +ExecCGI -Includes

AddHandler cgi-script. .cgi .pl

AllowOverride None

Allow from All

Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs"

AllowOverride None

Allow from all

DocumentRoot /usr/local/apache2/htdocs/

Alias /otrsdownload/ "/opt/otrs/var/log/otrsdownload/"# OTRS下载

Options Indexes MultiViews

AllowOverride None

Allow from all

保存退出后重启apache

# /usr/local/apache2/bin/httpd -k restart

接下来打开安装页面

http://localhost/otrs/installer.pl

(提示:在安装之前您还需要把文件权限给打开

chmod 777 /opt/otrs/Kernel/*.*

)

设置好之后按照他给的图形提示,安装好就可以了!

二、OTRS-Kernel文件移动

把otrs上的Kernel文件夹复制到linux下.

因为我们是从WINDOWS上转移过来的,所以原有的路径需要相应的做些更改

配置路径的主要文件在Kernel文件夹下

主要的目的是把原来的C:/OTRS/otrs改为/opt/otrs你的OTRS目录路径就可以了.

需要更改路径的地方有:

********* ******      修改文件路径    ****** **********

"opt/otrs/Kernel/Config.pm"(61,22):    $Self-> = 'C:/OTRS/otrs';

"opt/otrs/Kernel/Config.pm"(76,38):    $Self-> = 'C:/OTRS/otrs/var/log/otrs.log';

"opt/otrs/Kernel/Config_backup_email_module.pm"(61,22):    $Self-> = 'C:/OTRS/otrs';

"opt/otrs/Kernel/Config_backup_email_module.pm"(76,38):    $Self-> = 'C:/OTRS/otrs/var/log/otrs.log';

"opt/otrs/Kernel/Config/Files/ZZZAuto.pm"(9,35):$Self-> =  'C:/OTRS/otrs/var/log/otrs.log';

更改方法如下::

# vi /opt/otrs/Kernel/Config.pm

找到

# ---------------------------------------------------- #

# fs root directory

# ---------------------------------------------------- #

$Self-> = 'C:/OTRS/otrs';

把$Self-> = 'C:/OTRS/otrs';修改为:$Self-> = '/opt/otrs';

找到

# ---------------------------------------------------- #

# data inserted by installer                           #

# ---------------------------------------------------- #

$Self-> = 'Kernel::System::Log::File';

$Self-> = 'C:/OTRS/otrs/var/log/otrs.log';

把$Self-> = 'C:/OTRS/otrs/var/log/otrs.log';

修改为:$Self-> = '/opt/otrs/var/log/otrs.log';

保存退出.

还需要更改的文件有CRONw文件夹的crontab.txt文件中

*/10 * * * * C:/OTRS/Perl/bin/perl.exe C:/OTRS/otrs/bin/GenericAgent.pl -c db

*/20 * * * * C:/OTRS/Perl/bin/perl.exe C:/OTRS/otrs/bin/GenericAgent.pl

45 */2 * * * C:/OTRS/Perl/bin/perl.exe C:/OTRS/otrs/bin/PendingJobs.pl

10 0 * * * C:/OTRS/Perl/bin/perl.exe C:/OTRS/otrs/bin/otrs.cleanup

*/10 * * * * C:/OTRS/Perl/bin/perl.exe C:/OTRS/otrs/bin/PostMasterPOP3.pl

01 01 * * * C:/OTRS/Perl/bin/perl.exe C:/OTRS/otrs/bin/RebuildTicketIndex.pl

55 */2 * * * C:/OTRS/Perl/bin/perl.exe C:/OTRS/otrs/bin/DeleteSessionIDs.pl --expired

35 * * * * C:/OTRS/Perl/bin/perl.exe C:/OTRS/otrs/bin/UnlockTickets.pl --timeout

C:/OTRS/Perl/bin/perl.exe改为/usr/bin/perl

C:/OTRS/otrs改为 /opt/otrs

如下:

*/10 * * * * root /usr/bin/perl /opt/otrs/bin/GenericAgent.pl -c db

*/20 * * * * root /usr/bin/perl /opt/otrs/bin/GenericAgent.pl

45 */2 * * * root /usr/bin/perl /opt/otrs/bin/PendingJobs.pl

10 0 * * * root /usr/bin/perl   /opt/otrs/bin/otrs.cleanup

*/10 * * * * root /usr/bin/perl /opt/otrs/bin/PostMasterPOP3.pl

01 01 * * * root /usr/bin/perl  /opt/otrs/bin/RebuildTicketIndex.pl

55 */2 * * * root /usr/bin/perl /opt/otrs/bin/DeleteSessionIDs.pl --expired

35 * * * * root /usr/bin/perl   /opt/otrs/bin/UnlockTickets.pl --timeout

如果是php文件的话用:/usr/local/php  /opt/otrs/...... 这个格式就可以了

三、OTRS文件权限

在安装完OTRS系统之后我们还需要修改一些文件的权限,以保证系统功能的运行。

可以用命令( #chmod 777 [文件名] )来把文件的权限设置可读写.在创建数据库时

也有设置,不同的是现在的这些文件是从windows上移过来的,所以还需要设置一次,

以保证OTRS的正常运作.

# chmod 777 /opt/otrs/Kernel/Config.pm

# chmod 777 /opt/otrs/var/log/TicketCounter.log

把/opt/otrs/Kernel/Config/Files的全部文件都更改为777

# chmod 777 /opt/otrs/Kernel/Config/Files/*.*

查看文件夹的所有文件都已更改权限

# ls -l /opt/otrs/Kernel/Config/Files/

#

四、OTRS测试

上述操作都已做完现在安装otrs

http://localhost/otrs/installer.pl

安装完后用http://localhost/otrs/index.pl

otrs初始登陆用户名和密码是root@localhost  root

1.以高级管理员身份进入OTRS系统。

2.进入Admin界面

1).设置用户名(User) 密码 用户权限.修改/添加/删除:用户名 密码 用户权限.

2).设置用户组(Groups).修改/添加/删除:用户组

3).设置队列(Queue).修改/添加/删除:队列

4).设置邮件地址(Email Addresses) 添加/修改

5).设置系统配置(sysConfig) 查找:SearchOageShown 修改:Ticket::Frontend::SearchPageShown: 为25

6).设置POP3邮件接受(PostMaster POP3 Account) 添加/修改/删除

7).设置POP3邮件过滤(PostMaster Filter) 添加/修改/删除

8).设置自动回复(Auto Responses) 添加/修改

9).设置需自动回复的队列(Auto Responses Queue )

3.进入Email-Ticke界面

检查是否可以发送和接受邮件

4.功能检测

找到CRONw文件夹中的crontab.txt.运行其中的命令

/usr/bin/perl /opt/otrs/bin/PostMasterPOP3.pl

如果有些功能还不可以执行,根据系统给出的错误信息做出处理

五、数据导入.

1.在原来的机子上备份数据.

windows环境下:

mysqldump.exe -uroot otrs > otrs_200701271225.sql

大概需要时间为7-15分钟左右.

2.还原数据

Linux环境下:

mysqldump -uroot otrs < otrs_200701271225.sql

大概需要时间为5-6分钟左右.

注意:如果是测试用的数据,我们还需要把邮件地址给删掉,不然它会抢邮件信息

C:\OTRS\mysql\bin>mysql -uroot

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

Your MySQL connection id is 62 to server version: 4.0.24-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use otrs

Database changed

mysql> delete from pop3_account;

.... OK

六、同步数据库

************ 在windows上: ************

1.  停止windows的Apache、CronW服务。并且设定Cronw为禁止。

2.  备份mysql中的otrs数据库。

Win> mysqldump –uroot otrs > c:/otrs_db_200701252256.sql

3.  将备份的文件otrs_db_200701252256.sql 拷贝到linux上。

因为windows2003与linux互访存在问题,所以笔者是在apache上发布了一个可以下载的目录,让linux下载过去的。

4.  停止mysql,停止apache 。禁止mysql,禁止apache。并且将本机的IP更改为其他值。

************ 在linux上: ************

5.  确保Crontab中没有自动执行任何相关otrs的内容,比如收发邮件。这一点很重要,否则会影响后面的同步的制作。

6.  进入mysql ,删除数据库otrs(如果有),创建一个新的otrs,并且开始导入数据。

Mysql> drop database otrs;

Mysql> create database otrs;

Mysql> use otrs;

Mysql> source /root/otrs_db_200701252256.sql

笔者下载otrs_db_200701252256.sql之后放在/root下

7.  接着开始制作设置同步。

修改mysql的配置文件,分配设置同步权限,并且记录下日志信息,备份数据库。

1)修改配置文件

#> vi /etc/my.cnf

添加:

Log-bin =/var/log/mysql/mysql-bin.log # 如果已经有log-bin就可以了,具体指向哪个文件不重要。

Binlog-do-db=otrs # 这一句是新增的。

Server-id = 1 # 与101上的不一样就好。

2)重启并且设定同步权限。

/usr/local/mysql/share/mysql/mysql.server restart  #重启mysql

/usr/local/mysql/bin/mysql

进入mysql

mysql >grant replication slave on *.* to ‘salve_user’@’192.168.10.101’ identified by ‘123456’;

mysql >flush privileges;

3)显示日志信息,并且记录,接着马上进行数据库备份。

mysql >use otrs;

mysql> flush tables with read lock;

mysql> show master status;

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

| File             | Position | Binlog_do_db | Binlog_ignore_db

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

| mysql-bin.000013 |  98      | otrs         |

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

注意:需要把 mysql-bin.000013 |  98  这两个值抄下来.用于数据的同步

mysql> unlock tables;

#> mysqldump otrs > /opt/otrs_db_200701252320_onlinux.sql

8.  将/opt/otrs_db_200701252320_onlinux.sql文件copy到101上。

笔者使用的是scp,也可以使用sftp

#> sftp 192.168.10.101

Sftp> put /opt/otrs_db_200701252320_onlinux.sql

************ 在同步数据库的服务器上: ************

9.  最后,将相应的cron任务放置到/etc/crontab中,并且本机的IP更改为100,因为windows的IP已经更改,所以不会冲突。

下面我们到101上,

10.101 上主要是设置同步从机,必须要确认的是windows中的mysql一定要停止。

11.进入mysql,停止同步,删除原来的otrs,新建一个,并且还原

#> mysql –uroot –host=127.0.0.1 –port=3313 # 注意,笔者是用3313开启的mysql同步原来的windows的

Mysql> slave stop;

Mysql> drop database otrs;

Mysql> create database otrs;

Mysql> use otrs;

Mysql> source /opt/otrs_db_200701252320_onlinux.sql

12.更改同步参数。

Mysql> change master to master_host=’192.168.10.100’, master_user=’slave_user’, master_password=’123456’, master_log_file=’mysql-bin.000013’, master_log_pos=98;

注意:192.168.10.100是linux的IP,salve_user就是linux上分配权限是的用户,

Master_log_file,master_log_pos分别是linux上show master status;的信息。

可以使用slave status\G;查看设置是否正确,如果确认无误,那么就可以开启同步了。

Mysql>slave start;

好了,就这样基本上可以结束了。可以测试一下是否运行正常,

附录 Perl GD.pm模块的安装

add the lib path (Red Hat/Fedora specific I think)

----------------

add /usr/local/lib to /etc/ld.so.conf

run ldconfig -v

install libpng

--------------

cp over scripts/makefile.linux to ../makefile

make && make install

install jpeg libs

-----------------

../configure --enable-shared

make && make install

install freetype2

-----------------

../configure

make && make install

install gd

----------

../configure --enable-shared

make && make install

install GD.pm

-------------

LD_LIBRARY_PATH="/usr/local/lib"

export LD_LIBRARY_PATH

perl Makefile.PL

make && make test && make install

赞赏

f1f51b96aec10983863b826c21c20ae3.png

f1f51b96aec10983863b826c21c20ae3.png

f1f51b96aec10983863b826c21c20ae3.png

f1f51b96aec10983863b826c21c20ae3.png

共11人赞赏

本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值