OTRS 3.3.8. を Ubunbu 14.04 へインストール

この記事は公開されてから時間が経っています

前回、Ubuntu + OTRS の同じ環境を用意した
だが、再構成してみようと思い、備忘録を参照したががよく解らないという結果になってしまった
それと、環境も新しくなったしね ^^..

データベースを PostgreSQL にしてみようと思っているが、さて…
 

1. Ubuntu 14.04

これは、別段普通で良いと思う
OpenSSH server + LAMP server + PostgreSQL database で準備した

それに、VMware Tools も入れておこう
 

別の記事の KVM とかについての備忘が中途のまま….

ちょっと、別の案件で仕様考えたりしてて、手が上手く付かないまま頓挫しそう…

で、ここで、その案件をまとめるにあたり、OTRS を使っていってみよう…
どうせ、総受けで全部こっちに来るんだし…
電話とか Skype でちくちく個別に来られると面倒なんだよねぇ…こう言う場合…

と思って、こっちが継続する事になった

どうせなら、運営方法まで書いておける程度まで使って見たいなぁ…

 

2.OTRS 3.3.8

この前は見落としていたが、OTRS の同梱物にいろいろなチェックツールがあり、便利そうなので使って見ようと思う…

それと、14.04 は HGFS が上手く動かないようなので、ファイルの入手は scp とか使うと便利…

otrs-3.3.8.tar.gz を持ってきて解凍すると INSTALL.md と言うファイルがあるので、ここの手順に沿っていってみる事にする

1.
ファイルを解凍して /opt へ移動

user@ubuntuOTRS:~/otrs-3.3.8$ cd
user@ubuntuOTRS:~$ sudo mv otrs-3.3.8 /opt/otrs
[sudo] password for user:
user@ubuntuOTRS:~$

2.
最初に パールモジュールの追加 を確認しながら出来る方法が書いてある
解凍直後のチェック結果..
user@ubuntuOTRS:~$ perl /opt/otrs/bin/otrs.CheckModules.pl
  o Archive::Tar.....................ok (v1.90)
  o Crypt::Eksblowfish::Bcrypt.......Not installed! (optional - For strong password hashing.)
  o Crypt::SSLeay....................Not installed! (optional - Required for Generic Interface SOAP SSL connections.)
  o Date::Format.....................ok (v2.24)
  o DBI..............................ok (v1.630)
  o DBD::mysql.......................ok (v4.025)
  o DBD::ODBC........................Not installed! (optional - Required to connect to a MS-SQL database.)
  o DBD::Oracle......................Not installed! (optional - Required to connect to a Oracle database.)
  o DBD::Pg..........................Not installed! (optional - Required to connect to a PostgreSQL database.)
  o Encode::HanExtra.................Not installed! (optional - Required to handle mails with several Chinese character sets.)
  o GD...............................Not installed! (optional - Required for stats.)
    o GD::Text.......................Not installed! (optional - Required for stats.)
    o GD::Graph......................Not installed! (optional - Required for stats.)
  o IO::Socket::SSL..................Not installed! (optional - Required for SSL connections to web and mail servers.)
  o JSON::XS.........................Not installed! (optional - Recommended for faster AJAX/JavaScript handling.)
  o List::Util::XS...................ok (v1.27)
  o LWP::UserAgent...................ok (v6.05)
  o Mail::IMAPClient.................Not installed! (optional - Required for IMAP TLS connections.)
    o IO::Socket::SSL................Not installed! (optional - Required for IMAP TLS connections.)
  o ModPerl::Util....................Not installed! (optional - Improves Performance on Apache webservers dramatically.)
  o Net::DNS.........................Not installed! (required - Please install this module - )
  o Net::LDAP........................Not installed! (optional - Required for directory authentication.)
  o Net::SSL.........................Not installed! (optional - Required for Generic Interface SOAP SSL connections.)
  o PDF::API2........................Not installed! (optional - Required for PDF output.)
    o Compress::Zlib.................ok (v2.060)
  o Text::CSV_XS.....................Not installed! (optional - Recommended for faster CSV handling.)
  o Time::HiRes......................ok (v1.9725)
  o XML::Parser......................Not installed! (optional - Recommended for faster xml handling.)
  o YAML::XS.........................Not installed! (required - Please install this module - )
user@ubuntuOTRS:~$

ここで、required と書いてあるのは Net::DNS と YAML::XS だけのようだ
結構、作業は地道で、apt-cache でモジュールを探して aptitude で追加する..

user@ubuntuOTRS:~$ apt-cache search YAML::XS perl
libyaml-libyaml-perl - Perl interface to libyaml, a YAML implementation
user@ubuntuOTRS:~$ sudo aptitude install libyaml-libyaml-perl
The following NEW packages will be installed:
  libyaml-libyaml-perl
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 63.8 kB of archives. After unpacking 231 kB will be used.
Get: 1 http://jp.archive.ubuntu.com/ubuntu/ trusty/main libyaml-libyaml-perl amd64 0.41-5 [63.8 kB]
Fetched 63.8 kB in 1s (56.9 kB/s)
Selecting previously unselected package libyaml-libyaml-perl.
(Reading database ... 91219 files and directories currently installed.)
Preparing to unpack .../libyaml-libyaml-perl_0.41-5_amd64.deb ...
Unpacking libyaml-libyaml-perl (0.41-5) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libyaml-libyaml-perl (0.41-5) ...
user@ubuntuOTRS:~$

こんな感じ..

DBD::Pg ってのは PostgreSQL を使おうと思っているので必要かな…
後は便利そうなののを適当に入れて見たので、後で総括出来れば良いなぁ…

user@ubuntuOTRS:~$ perl /opt/otrs/bin/otrs.CheckModules.pl
  o Archive::Tar.....................ok (v1.90)
  o Crypt::Eksblowfish::Bcrypt.......Not installed! (optional - For strong password hashing.)
  o Crypt::SSLeay....................Not installed! (optional - Required for Generic Interface SOAP SSL connections.)
  o Date::Format.....................ok (v2.24)
  o DBI..............................ok (v1.630)
  o DBD::mysql.......................ok (v4.025)
  o DBD::ODBC........................Not installed! (optional - Required to connect to a MS-SQL database.)
  o DBD::Oracle......................Not installed! (optional - Required to connect to a Oracle database.)
  o DBD::Pg..........................ok (v2.19.3)
  o Encode::HanExtra.................Not installed! (optional - Required to handle mails with several Chinese character sets.)
  o GD...............................ok (v2.46)
    o GD::Text.......................ok (v0.86)
    o GD::Graph......................ok (v1.44)
  o IO::Socket::SSL..................ok (v1.965)
  o JSON::XS.........................ok (v2.34)
  o List::Util::XS...................ok (v1.27)
  o LWP::UserAgent...................ok (v6.05)
  o Mail::IMAPClient.................Not installed! (optional - Required for IMAP TLS connections.)
    o IO::Socket::SSL................ok (v1.965)
  o ModPerl::Util....................Not installed! (optional - Improves Performance on Apache webservers dramatically.)
  o Net::DNS.........................ok (v0.68)
  o Net::LDAP........................Not installed! (optional - Required for directory authentication.)
  o Net::SSL.........................Not installed! (optional - Required for Generic Interface SOAP SSL connections.)
  o PDF::API2........................ok (v2.020)
    o Compress::Zlib.................ok (v2.060)
  o Text::CSV_XS.....................ok (v1.02)
  o Time::HiRes......................ok (v1.9725)
  o XML::Parser......................ok (v2.41)
  o YAML::XS.........................ok (v0.41)
user@ubuntuOTRS:~$

3.
次にユーザーの追加

user@ubuntuOTRS:~$ sudo useradd -d /opt/otrs/ -c 'OTRS user' otrs
user@ubuntuOTRS:~$ sudo usermod -G www-data otrs
user@ubuntuOTRS:~$

4.
次に設定ファイルを有効化
まだ、コピー先のファイルの属性などは換わっていないので、解凍したディレクトリでそのまま作業出来る

user@ubuntuOTRS:~$ cd /opt/otrs/
user@ubuntuOTRS:/opt/otrs$ cp Kernel/Config.pm.dist Kernel/Config.pm
user@ubuntuOTRS:/opt/otrs$ cp Kernel/Config/GenericAgent.pm.dist Kernel/Config/GenericAgent.pm
user@ubuntuOTRS:/opt/otrs$

5.
必要なモジュールなどのチェック

user@ubuntuOTRS:~$ perl -cw /opt/otrs/bin/cgi-bin/index.pl
/opt/otrs/bin/cgi-bin/index.pl syntax OK
user@ubuntuOTRS:~$ perl -cw /opt/otrs/bin/cgi-bin/customer.pl
/opt/otrs/bin/cgi-bin/customer.pl syntax OK
user@ubuntuOTRS:~$ perl -cw /opt/otrs/bin/otrs.PostMaster.pl
/opt/otrs/bin/otrs.PostMaster.pl syntax OK
user@ubuntuOTRS:~$

良い様で、お許しを頂いた

6.
Web サーバーは README.webserver.md を確認する
Apache の設定ファイルを仕込む..

user@ubuntuOTRS:/opt/otrs/scripts$ less apache2-httpd.include.conf
user@ubuntuOTRS:/opt/otrs/scripts$ sudo cp apache2-httpd.include.conf /etc/apache2/otrs.conf
user@ubuntuOTRS:/opt/otrs/scripts$ sudo apachectl configtest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
user@ubuntuOTRS:/opt/otrs/scripts$

こんな感じで良いんじゃないかと思う…
あぁ、ServerName を書いておかないと ^^;
コピー先は conf-enabled の方が良いかな..

ここで apache に設定を行ったので何かしらの表示が出来ると思ってブラウザーで開いてみると、エラーする…
(まだ、データーベースに何もしていないので、ブラウザーで表示しても、もちろんここではエラーの表示がされる
 だけど、apache の設定が完了しているので何かしらの表示が出来るはず…
 ※ この後、データベースの初期化が、少し手間が掛かるので留意して実行する様に !)

肝心の apache の mod_perl に相当するものがインストールされていないので追加する

user@ubuntuOTRS:~$ apt-cache search mod_perl perl2
libapache2-mod-perl2 - Integration of perl with the Apache2 web server
libapache2-mod-perl2-dev - Integration of perl with the Apache2 web server - development files
libapache2-mod-perl2-doc - Integration of perl with the Apache2 web server - documentation
libapache2-authcassimple-perl - Apache2 module to authenticate trough a CAS server
user@ubuntuOTRS:~$ sudo aptitude install libapache2-mod-perl2
<<snip>>

7.
ファイル属性の設定

user@ubuntuOTRS:~$ sudo /opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=otrs --web-user=www-data --otrs-group=www-data --web-group=www-data /opt/otrs/
bin/otrs.SetPermissions.pl - set OTRS file permissions
Copyright (C) 2001-2014 OTRS AG, http://otrs.com/
Setting permissions on /opt/otrs/
Setting permissions on /opt/otrs//var
Setting permissions on /opt/otrs//bin/*
Setting permissions on /opt/otrs//scripts/
Setting permissions on /opt/otrs//Kernel/Config.pm
user@ubuntuOTRS:~$

取り敢えず成功..

基本的に PostgreSQL は、OS に potgres ユーザーを追加し、このユーザーでは管理者権限などが実行できるようになっている
しかし、Ubuntu 等は sudo が基本なので、 ログインユーザーでは無い postgres での作業がとても面倒…

$ sudo su –
$ sudo postgres –

とかやっても、結局、スクリプトなどにアクセス権が無いので読めず、結構難儀します
そこで、思いついたのが、先に入手した tar.gz ファイルからスクリプトを取り出して利用すれば良いに違いない ^^b

8.
データーベースの設定

これは、README.database.md に続く..
パーミッションを変更してしまったので、再度解凍したドキュメントを確認する
スクリプトだけの参照なので、再解凍したディレクトリの scripts 以下を、ユーザー postgres でも参照できるようにして利用してみる

user@ubuntuOTRS:~/otrs-3.3.8/scripts$ sudo su -
root@ubuntuOTRS:~# su postgres -
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
postgres@ubuntuOTRS:/root$ cd /home/user/otrs-3.3.8/
ARCHIVE              COPYING              .fetchmailrc.dist    .procmailrc.dist     RELEASE
AUTHORS.md           COPYING-Third-Party  INSTALL.md           README.database.md   scripts/
bin/                 Custom/              Kernel/              README.md            UPGRADING.md
CHANGES.md           doc/                 .mailfilter.dist     README.webserver.md  var/
postgres@ubuntuOTRS:/root$ cd /home/user/otrs-3.3.8/scripts/
postgres@ubuntuOTRS:/home/user/otrs-3.3.8/scripts$

どうだ!?

postgres@ubuntuOTRS:/home/user/otrs-3.3.8/scripts$ createuser -D -P -S -R otrs
Enter password for new role:
Enter it again:
postgres@ubuntuOTRS:/home/user/otrs-3.3.8/scripts$ createdb --owner=otrs otrs
postgres@ubuntuOTRS:/home/user/otrs-3.3.8/scripts$ psql otrs < database/otrs-schema.postgresql.sql

postgres@ubuntuOTRS:/home/user/otrs-3.3.8/scripts$ psql otrs < database/otrs-initial_insert.postgresql.sql
postgres@ubuntuOTRS:/home/user/otrs-3.3.8/scripts$ psql otrs < database/otrs-schema-post.postgresql.sql

エラー表示されずに実行された様子
追記:  このままじゃ動かないので下記参照
 
postgres@ubuntuOTRS:/home/user/otrs-3.3.8/scripts$ psql -U otrs -W -d otrs -h 127.0.0.1
Password for user otrs:
psql (9.3.4)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

otrs=> \d
otrs=> \q

何とかなった..

次に、いま設定したデーターベースの状態を、設定ファイルに書き込む

user@ubuntuOTRS:~$ sudo emacs /opt/otrs/Kernel/Config.pm

    $Self->{Database} = 'otrs';

    # The database user
    $Self->{DatabaseUser} = 'otrs';

    # The password of database user. You also can use bin/otrs.CryptPassword.pl
    # for crypted passwords
    $Self->{DatabasePw} = 'XXXXXXX';

    # The database DSN for MySQL ==> more: "perldoc DBD::mysql"
    $Self->{DatabaseDSN} = "DBI:mysql:database=$Self->{Database};host=$Self->{DatabaseHost};";
    # The database DSN for PostgreSQL ==> more: "perldoc DBD::Pg"
    # if you want to use a local socket connection
#    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};";
    # if you want to use a TCP/IP connection
    $Self->{DatabaseDSN} = "DBI:Pg:dbname=$Self->{Database};host=$Self->{DatabaseHost};";

パスワードの設定とデータベースネームの # を外す
で、otrs.CheckDB.pl を実行すると、接続出来るけど、初期設定されないよ?ミタイな事をいってくれる..

root@ubuntuOTRS:/opt/otrs/bin# ./otrs.CheckDB.pl
Trying to connect to database
DSN: DBI:Pg:dbname=otrs;host=127.0.0.1;
DatabaseUser: otrs

DBD::Pg::st execute failed: ERROR:  permission denied for relation valid at /opt/otrs/Kernel/System/DB.pm line 639.
ERROR: OTRS-otrs.CheckDB.pl-10 Perl: 5.18.2 OS: linux Time: Wed Jun 25 16:44:09 2014

Message: ERROR:  permission denied for relation valid, SQL: 'SELECT * FROM valid'

Traceback (2757):
   Module: ./otrs.CheckDB.pl (unknown version) Line: 57

DBD::Pg::st fetchrow_array failed: no statement executing at /opt/otrs/Kernel/System/DB.pm line 706.
Connection successful, but no initial inserts are found!
root@ubuntuOTRS:/opt/otrs/bin#

一抹の不安を抱えつつ、データーベースの設定を完了して、INSTALL.md の手順に戻ります ^^

9.
最初のログイン
snap01

うーん…
ログイン出来ない… ^^;

試しに MySQL にデーターベースを作成して Config.pm を MySQL に切り替えたところ上手く行った…
データベースの設定周りだね…

8. の手順を再検討してみた
テーブルのステータスを眺めていたら、テーブルのオーナーが postgres になってる…
そりゃそうか…

で、テーブル作成のあたりの作戦を変更してみる

postgres@ubuntuOTRS:/home/user/otrs-3.3.8/scripts/database$ psql -U otrs -W otrs -h 127.0.0.1
Password for user otrs:
psql (9.3.4)
SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)
Type "help" for help.

otrs=> \i otrs-schema.postgresql.sql
otrs=> \i otrs-initial_insert.postgresql.sql
otrs=> \i otrs-schema-post.postgresql.sql
otrs=> commit;
WARNING:  there is no transaction in progress
COMMIT
otrs=> \q

root@ubuntuOTRS:/opt/otrs# emacs Kernel/Config.pm
root@ubuntuOTRS:/opt/otrs# ./bin/otrs.CheckDB.pl
Trying to connect to database
DSN: DBI:Pg:dbname=otrs;host=127.0.0.1;
DatabaseUser: otrs

Connected.
root@ubuntuOTRS:/opt/otrs#

あぁ…
動いたぁ.. ^^/

3.ITSM 3.3.8

ITEM は、OTRS への機能追加モジュールのようなもので、必要なものをダウンロードして、
必要なだけアップロードすれば良いので、ヘルプディスクのインストールより簡単かな?

前のドキュメントの通り、ログインして、「管理」-「パッケージ管理」 へ進むと、"セキュアモードを有効にしてください。" と表示される..?

snap02

インストールが完了していないという事か?…
取り敢えず、セキュアモードに設定出来れば良いらしい…
オレンジ色の部分をクリックすると 「システムコンフィグ」が表示された..

snap03

先頭の項目が「セキュアモード」の設定の様なので、これを変更して、ページの一番下にある「更新」を選択して見た..
再度、「管理」-「パッケージ管理」を選択すると、今度は見知った表示になった ^^..

snap04

別に、OTRS を入手したページと同じページに有った OTRS::ITSM 3.3.8 をダウンロードしてあるので、それをインストールしてみる
左上の「操作」 の「参照」 で、ITSM-3.3.8.opm を指定して「パッケージをインストール」を選択する

snap05 snap06

確認表示されるので「続ける」を選択する..

snap07

少し時間が掛かったけど、全部導入出来た様子 ^^b
ついでに、OTRS 、ITSM と同じページにあるパッケージをインストールした

最後に、セキュアモードを元に戻して完了

今回は導入編なので、ここまで….
運用に関しても報告出来れば良いけど….

2014-09-18 追記:
 

OTRS は 3.3.9 に成っても、基本的なインストール方法は同じで大丈夫なようです

ただ、otrs.conf を apache2 ディレクトリーに格納しても動作しなくなったようです ( Ubuntu 14.04.1)

cp apache2-httpd.include.conf /etc/apache2/otrs.conf

この otrs.conf のコピー先を sites-available にして、sites-enabled へシンボリックリンクを貼った方が良いようです

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です


The reCAPTCHA verification period has expired. Please reload the page.