在 Ubuntu Lucid Lynx (10.4) 上安装 OTRS

From OtterHub - OTRS Community Wiki
Jump to: navigation, search

简介

本文描述如何在Ubuntu Lucid Lynx (version 10.04 LTS)安装OTRS 3.0.x。对于其他版本的Ubuntu,此安装方法可能也是相似的。我们建议您最好能在LTS (Long Term Support)版本的Ubuntu上安装,应为这样你将可以获得最长时间的操作系统安全补丁更新。目前可用的LTS版本是10.04,下一个版本将会是12.04,它将在2012年四月发布出来。想了解更多关于Ubuntu的版本发布信息,详见: Release information on Ubuntu Wiki.

关于OTRS 2.4.x的安装说明,请查看Installation of OTRS 2.4.x。如果你能把本文修改的更好,那就请你一起来编辑本文吧!

安装

我们将把OTRS安装在 /opt 目录里;我们来手工的安装所有的应用,而不是使用操作系统软件包管理器安装,那么从下面的步骤开始把。

  • http://otrs.org/downloadsDownload 下载OTRS的.tar.gz '源'文件
  • 打开一个root的shell 或者 'sudo su -'
  • 解压缩下载的文件,并把解开的文件夹移动到 /opt 里
tar xf otrs-3.0.x.tar.gz 
mv otrs-3.0.* /opt/otrs

下一步是安装必要的Perl模块、Web服务器和数据库。

aptitude install libapache2-mod-perl2 libdbd-mysql-perl libnet-dns-perl libnet-ldap-perl libio-socket-ssl-perl libpdf-api2-perl libsoap-lite-perl libgd-text-perl libgd-graph-perl libapache-dbi-perl mysql-server

你当然能运行数据库在另外一台服务器上,或者使用PostgreSQL作为后台数据库。那样的安装依然是很方便的,但并不在本文档的范围之内。

现在你需要创建一个用来运行OTRS cron计划任务的帐号。用户将被加入webserver用户组中,并以/opt/otrs作为主目录。

useradd -r -d /opt/otrs/ -c 'OTRS user' otrs
usermod -g www-data otrs

现在你需要准备一下OTRS的配置文件。复制 /opt/otrs/Kernel/Config.pm.dist 文件为 Config.pm ,这样你就有了一个属于你自己的新的拷贝,对/opt/otrs/Kernel/Config/GenericAgent.pm.dist文件也做同样操作:

cd /opt/otrs/Kernel
cp Config.pm.dist Config.pm
cp Config/GenericAgent.pm.dist Config/GenericAgent.pm

现在你需要来配置目录的权限,让web服务器用户和OTRS用户对此目录都有权限。为此你可以使用OTRS所提供的脚本:

cd /opt/otrs
bin/otrs.SetPermissions.pl --otrs-user=otrs --otrs-group=otrs --web-user=www-data --web-group=www-data /opt/otrs

Web服务器配置

OTRS has a bundled default configuration file for Apache. You should add this to the Apache configuration directory, and then restart the server in order to get going:

cp /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/conf.d/otrs.conf 
service apache2 restart

高级: 用OTRS用户来运行apache服务

You'd only want to do this if apache is not serving other applications, i.e. if you have a 'dedicated' system for OTRS. It eases administration because you don't have to worry about two 'owners' for the files in OTRS.

Modify this file: /etc/apache2/envvars

Comment out these lines by adding a # in front of it.

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

and add these two lines:

export APACHE_RUN_USER=otrs
export APACHE_RUN_GROUP=otrs

now restart Apache.

Web 安装界面

Go to http://127.0.0.1/otrs/installer.pl with your web browser. In case you don't have installed a web browser on your Ubuntu server (which would be quite common) you can also access the web installer from your local workstation. In that case simply replace 127.0.0.1 with the address of your Ubuntu server in the URL. In the web installer you can create the database to be used for OTRS (use the MySQL root password you set earlier), as well as do some other basic configuration. After this, you can log in to OTRS with the default account root@localhost and password root.

Now you have created the database, edit the file /opt/otrs/scripts/apache2-perl-startup.pl - we need that in order to configure Apache::DBI. Apache::DBI is not a module that is really needed for OTRS but it will pre-establish database connections, which will be better for performance. Therefore it' s recommended to set it up. Besides that, it's really easy to set up, so why not..?

Just simply remove the pound signs (#) before the lines for Apache::DBI and fill in the password you just created for the OTRS database using the web installer. If you forgot what it was, please just look up the value for $Self->{'DatabasePw'} in the file /opt/otrs/Kernel/Config.pm.

use Apache::DBI ();
Apache::DBI->connect_on_init('DBI:mysql:otrs', 'otrs', 'my-secret-pass');
use DBI ();

OTRS计划任务

OTRS uses several cron jobs for time-based actions, such as escalating tickets, sending out reminders, fetching emails from POP and IMAP boxes, and so on. You'll have to prepare these cronjobs so they are run by the OTRS user.

cd /opt/otrs/var/cron
for foo in *.dist; do cp $foo `basename $foo .dist`; done # copies all files with .dist extension to regular name

Now we have to add them to the otrs user's crontab:

cd /opt/otrs
bin/Cron.sh start otrs

Now the cron jobs are scheduled and will be executed on pre-defined intervals.

You can check with the command crontab -l -u otrs if the entries for the OTRS user are set up correctly.

After this, you can log in to OTRS via http://yourserver.example.com/otrs/index.pl with the default account root@localhost and password root. Now, you can log in to OTRS, create users, configure incoming and outgoing email, and the like. As they say... ((享受吧))!