MacにOTRSインストール方法まとめ

# OTRSとは

* OSSのヘルプデスクシステムhttps://www.otrs.com/
* 顧客とのやりとりをチケット化する有名なOSS
* 手順：
https://otrs.github.io/doc/manual/admin/3.2/en/html/manual-installation-of-otrs.html

# インストール環境

* OSX 10.9.5

# Install MySQL

brew経由でインストールします

     brew update
     brew install mysql

MySql mysql-5.6.24 はイスントールされました。

起動してみると

     $ mysql.server start

      Starting MySQL
      . SUCCESS! 

入ってみると

     $ mysql -uroot

# OTRSインストール

ソースからインストール方針で進める！
https://www.otrs.com/download-open-source-help-desk-software-otrs-free/
ここからtar.gzファイルをダウンロードする。

$ sudo mkdir /opt
$ sudo mv ~/Downloads/otrs-3.2.9 /opt/otrs

Move the configuration files in place:

$ sudo cp /opt/otrs/Kernel/Config.pm.dist /opt/otrs/Kernel/Config.pm

# Perl モージュルインストール

       $ perl /opt/otrs/bin/otrs.CheckModules.pl

結果

```
  o Apache::DBI......................ok (v1.12)
  o Apache2::Reload..................ok (v0.13)
  o Archive::Tar.....................ok (v1.82)
  o Archive::Zip.....................ok (v1.30)
  o Crypt::Eksblowfish::Bcrypt.......Not installed! Use: 'cpan Crypt::Eksblowfish::Bcrypt' (optional - For strong password hashing.)
  o Crypt::SSLeay....................Not installed! Use: 'cpan Crypt::SSLeay' (optional - Required for Generic Interface REST transport and SOAP SSL connections.)
  o Date::Format.....................ok (v2.24)
  o DBI..............................ok (v1.622)
  o DBD::mysql.......................Not installed! Use: 'cpan DBD::mysql' (optional - Required to connect to a MySQL database.)
  o DBD::ODBC........................Not installed! Use: 'cpan DBD::ODBC' (optional - Required to connect to a MS-SQL database.)
  o DBD::Oracle......................Not installed! Use: 'cpan DBD::Oracle' (optional - Required to connect to a Oracle database.)
  o DBD::Pg..........................Not installed! Use: 'cpan DBD::Pg' (optional - Required to connect to a PostgreSQL database.)
  o Encode::HanExtra.................Not installed! Use: 'cpan Encode::HanExtra' (optional - Required to handle mails with several Chinese character sets.)
  o IO::Socket::SSL..................ok (v1.77)
  o JSON::XS.........................Not installed! Use: 'cpan JSON::XS' (optional - Recommended for faster AJAX/JavaScript handling.)
  o List::Util::XS...................ok (v1.25)
  o LWP::UserAgent...................ok (v6.13)
  o Mail::IMAPClient.................Not installed! Use: 'cpan Mail::IMAPClient' (optional - Required for IMAP TLS connections.)
    o IO::Socket::SSL................ok (v1.77)
  o ModPerl::Util....................ok (v2.000007)
  o Net::DNS.........................ok (v0.68)
  o Net::LDAP........................ok (v0.49)
  o Template.........................Not installed! Use: 'cpan Template' (required - Template::Toolkit, the rendering engine of OTRS.)
  o Template::Stash::XS..............Not installed! Use: 'cpan Template::Stash::XS' (required - The fast data stash for Template::Toolkit.)
  o Text::CSV_XS.....................Not installed! Use: 'cpan Text::CSV_XS' (optional - Recommended for faster CSV handling.)
  o Time::HiRes......................ok (v1.9725)
  o Time::Piece......................ok (v1.20_01)
  o XML::LibXML......................ok (v2.0008)
  o XML::LibXSLT.....................ok (v1.78)
  o XML::Parser......................ok (v2.41)
  o YAML::XS.........................Not installed! Use: 'cpan YAML::XS' (required - Very important)
```

'cpan module_name'コマンドで足りていないモジュールをインストールします。
インストールが終わったら、以下のようになります。

```
  o Apache::DBI......................ok (v1.12)
  o Apache2::Reload..................ok (v0.13)
  o Archive::Tar.....................ok (v1.82)
  o Archive::Zip.....................ok (v1.30)
  o Crypt::Eksblowfish::Bcrypt.......ok (v0.009)
  o Crypt::SSLeay....................ok (v0.72)
  o Date::Format.....................ok (v2.24)
  o DBI..............................ok (v1.622)
  o DBD::mysql.......................ok (v4.033)
  o DBD::ODBC........................Not installed! Use: 'cpan DBD::ODBC' (optional - Required to connect to a MS-SQL database.)
  o DBD::Oracle......................Not installed! Use: 'cpan DBD::Oracle' (optional - Required to connect to a Oracle database.)
  o DBD::Pg..........................Not installed! Use: 'cpan DBD::Pg' (optional - Required to connect to a PostgreSQL database.)
  o Encode::HanExtra.................ok (v0.23)
  o IO::Socket::SSL..................ok (v1.77)
  o JSON::XS.........................ok (v3.02)
  o List::Util::XS...................ok (v1.25)
  o LWP::UserAgent...................ok (v6.13)
  o Mail::IMAPClient.................ok (v3.38)
    o IO::Socket::SSL................ok (v1.77)
  o ModPerl::Util....................ok (v2.000007)
  o Net::DNS.........................ok (v0.68)
  o Net::LDAP........................ok (v0.49)
  o Template.........................ok (v2.26)
  o Template::Stash::XS..............ok (undef)
  o Text::CSV_XS.....................ok (v1.23)
  o Time::HiRes......................ok (v1.9725)
  o Time::Piece......................ok (v1.20_01)
  o XML::LibXML......................ok (v2.0008)
  o XML::LibXSLT.....................ok (v1.78)
  o XML::Parser......................ok (v2.41)
  o YAML::XS.........................ok (v0.62)
```

# MACのApache start


     $ sudo apachectl start
     $ sudo apachectl stop

Apacheサーバーの設定
Allow the apache web user to access the OTRS directory:

     $ sudo chown -R _www:_www /opt/otrs

Move OTRS’ configuration file in place:

     $ sudo cp /opt/otrs/scripts/apache2-httpd.include.conf /etc/apache2/other/otrs.conf

Open up Apache configuration file with your favorite command line text editor:

      $ sudo vi /etc/apache2/httpd.conf

変更のところ：

```
Un-comment line 116 and 117:

LoadModule perl_module libexec/apache2/mod_perl.so
LoadModule php5_module libexec/apache2/libphp5.so

Change line 169 to:

DocumentRoot "/opt/otrs/var/httpd/htdocs"

Change line 196 to:

<Directory "/opt/otrs/var/httpd/htdocs">

Change line 209 to:

Options Indexes FollowSymLinks MultiViews Includes ExecCGI

Add the following on line 210:

DirectoryIndex index.html index.pl

Change line 216 to:

AllowOverride all

Un-comment line 397 and add .pl as a file type:

AddHandler cgi-script .cgi .pl

Un-comment line 408 and 409:

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
```

# Install mySQL manually

First, let’s create a database and an user:

```
$ /usr/local/mysql/bin/mysql -u root -p
mysql> CREATE DATABASE otrs;
mysql> GRANT ALL ON otrs.* TO 'otrs'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';
mysql> exit
```

Execute the following 3 scripts (they must be executed in this order):

```
$ mysql -u otrs -p otrs < /opt/otrs/scripts/database/otrs-schema.mysql.sql
$ mysql -u otrs -p otrs < /opt/otrs/scripts/database/otrs-initial_insert.mysql.sql
$ mysql -u otrs -p otrs < /opt/otrs/scripts/database/otrs-schema-post.mysql.sql
```

設定ファイルを変更します

     $ sudo vi /opt/otrs/Kernel/Config.pm

And fill out the information according to what you did with MySQL

```
# The database host
$Self->{DatabaseHost} = 'localhost';

# The database name
$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} = 'some-pass';
```

よいよい開いてみよう！
http://localhost/otrs/index.pl

![ログイン_-_OTRS_5.png](https://qiita-image-store.s3.amazonaws.com/0/18698/511e002d-3e22-6bcc-81e3-c7ace006b844.png)

初期ログイン
Username: root@localhost
Password: root

![ログイン_-_OTRS_5_2.png](https://qiita-image-store.s3.amazonaws.com/0/18698/8bef05bb-a629-9e49-a23a-f119a955ac53.png)

# 参考

https://otrs.github.io/doc/manual/admin/3.2/en/html/manual-installation-of-otrs.html
https://houseofmac.wordpress.com/2013/07/17/how-to-install-otrs-help-desk-on-mac-os-x-10-8-mountain-lion/