# How To: Install OTRS 5.x.x Beta from Source on FreeBSD 10.2



## TzunTzai (Sep 18, 2015)

Hello again everyone! Back with another FreeBSD / OTRS How-To. OTRS is about to release version 5! I'm looking forward to some of the new features and I know you are too. My previous How-To was written for FreeBSD 10.1 and OTRS4. There have been a few changes since my previous post, so I've decided to create a new one that'll help all you FreeBSD / OTRS users get OTRS up and running on a fresh installation of FreeBSD 10.2.

As root, do the following...

Install required packages in FreeBSD:
`# pkg install apache24 mysql56-server`

Edit /etc/rc.conf to add the following

```
apache24_enable="YES"
mysql_enable="YES"
```

Create OTRS directory via zfs
`# zfs create zroot/opt
# zfs set mountpoint=/opt zroot/opt`
Or if not using ZFS, do the following
`# mkdir /opt`

Create Perl symlink to avoid OTRS installation errors.
`ln -s /usr/local/bin/perl /usr/bin/perl`

Create OTRS user
`adduser`

```
UserName = otrs
FullName = otrs
Home Directory = /opt/otrs
Password = otrs
```

Download the latest version of OTRS and extract
`# cd /opt
# fetch ftp://ftp.otrs.org/pub/otrs/otrs-5.x.x.tar.gz
# tar -xf otrs-5.x.x.tar.gz
# mv otrs-5.x.x otrs`

Copy configs
`# cd /opt/otrs/Kernel
# cp Config.pm.dist Config.pm`

Set OTRS permissions/access rights:
`# perl /opt/otrs/bin/otrs.SetPermissions.pl --otrs-user=otrs --web-group=www --admin-group=otrs`

See which Perl modules are needed to run OTRS on FreeBSD

```
# perl /opt/otrs/bin/otrs.CheckModules.pl
```

Install required modules and others you might need:
Example:

```
# cpan Archive::Zip
```
Here's a list of the modules I'm using.


```
o Apache::DBI
  o Apache2::Reload
  o Archive::Tar
  o Archive::Zip
  o Crypt::SSLeay
  o Date::Format
  o DBI
  o DBD::mysql
  o IO::Socket::SSL
  o JSON::XS
  o List::Util::XS
  o LWP::UserAgent
  o IO::Socket::SSL
  o ModPerl::Util
  o Net::DNS
  o Template
  o Template::Stash::XS
  o Text::CSV_XS
  o Time::HiRes
  o Time::Piece
  o YAML::XS
```

Verify Perl has been properly set up:
`# perl -cw /opt/otrs/bin/cgi-bin/index.pl`

```
/opt/otrs/bin/cgi-bin/installer.pl syntax OK
```
`# perl -cw /opt/otrs/bin/cgi-bin/customer.pl`

```
/opt/otrs/bin/cgi-bin/customer.pl syntax OK
```
`> perl -cw /opt/otrs/bin/otrs.PostMaster.pl`

```
/opt/otrs/bin/otrs.PostMaster.pl syntax OK
```

Start the Apache24 service to verify if the base install is working
`# service apache24 start`

Open a browser window to the IP address of your FreeBSD server.  In my case, http://192.168.1.20/
If you see "It works!" in the browser, your Apache24 installation was successful

Start MySQL Server

```
service mysql-server start
```

Set the root password for MySQL:
`# mysql -u root`

```
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('rootpass');
mysql> quit
```

Modify MySQL config file to reflect the following changes.
`# vi /usr/local/etc/my.cnf`

(Add the 3 lines below to my.cnf)

```
[mysqld]
max_allowed_packet=4M
innodb_log_file_size=256MB
```

Copy the OTRS configuration file to the Apache24 directory
`# cp /opt/otrs/scripts/apache2-httpd.include.conf /usr/local/etc/apache24/Includes/otrs.conf`

Also, verify that the CGI module is loaded. Locate and un-comment this line (remove the #) within httpd.conf

```
LoadModule cgi_module"
libexec/apache22/mod_cgi.so
```
Save and exit.

Restart the Apache24 service:
`# service apache24 restart`

Rename OTRS cron .dist files
`# cd /opt/otrs/var/cron
# mv aaa_base.dist aaa_base
# mv otrs_daemon.dist otrs_daemon`

Make sure OTRS cron jobs are running as the OTRS user:
`# su otrs
# /opt/otrs/bin/Cron.sh start`

You're ready to go!

Open your web browser and navigate to the URL http://ServerIPAddress/otrs/installer.pl

*** NOTE ***

I've done a full update from FreeBSD 10.1 w/ OTRS 4 to FreeBSD 10.2 w/ OTRS 5
If you need help with this update, feel free to PM me.

~kuan


----------



## junovitch@ (Sep 19, 2015)

Hi!
It may be easier to have a one liner `pw useradd <options>` command rather than having to use `adduser`.


----------



## TzunTzai (Sep 19, 2015)

junovitch@ said:


> Hi!
> It may be easier to have a one liner `pw useradd <options>` command rather than having to use `adduser`.



Thanks for the tip!


----------



## Jimlad (Nov 8, 2016)

Great post. I have OTRS 5 running on 10.3 from the package. The issue I seem to have is that although the OTRS daemon is showing as running, the web interface continues to notify that it is not. Any idea how to resolve this? I'm assume its a permissions issue somewhere.


----------



## TzunTzai (Nov 9, 2016)

Hi Jimlad,

I experienced the same issue. If the configurations are correct, after about 5 minutes it the warning went away. If this doesn't work, check the permissions (via the commands above), then reboot the server. Again, wait 5 minutes and the warning should go away. Also, make sure you didn't forget the following...

```
Rename OTRS cron .dist files
# cd /opt/otrs/var/cron
# mv aaa_base.dist aaa_base
# mv otrs_daemon.dist otrs_daemon
```


----------



## Jimlad (Nov 9, 2016)

Thanks TzunTzai,

Yes both cron files are present and permissions correct from what I can tell.

```
otrs@OTRS-SRV-02:/usr/local/otrs/var/cron # ls -lh
total 1
-rw-rw----  1 otrs  www    52B Nov  3 22:26 aaa_base
-rw-rw----  1 otrs  www    87B Nov  3 22:26 otrs_daemon
```
It's been a few days, so 5 minutes has most certainly elapsed and have rebooted.

After rebooting I actually have 5 instances of the OTRS daemon running

```
otrs 41211 31.4  1.7  87476 36100  -  RJ    1:15PM 0:04.16 /usr/local/bin/perl -X /usr/local/otrs/bin/otrs.Daemon.pl start
otrs 41360 10.8  1.7  87476 34392  -  RJ    1:15PM 0:01.28 /usr/local/bin/perl -X /usr/local/otrs/bin/otrs.Daemon.pl start
otrs 41359 10.6  1.7  87476 34392  -  RJ    1:15PM 0:01.30 /usr/local/bin/perl -X /usr/local/otrs/bin/otrs.Daemon.pl start
root 39833  0.0  0.1  14528  2040  -  SsJ   1:14PM 0:00.00 /usr/sbin/syslogd -c -ss
root 39911  0.0  0.2  81972  5080  -  SsJ   1:14PM 0:00.01 /usr/local/sbin/httpd -DNOHTTPACCEPT
www  39914  0.0  0.2  81972  5148  -  IJ    1:14PM 0:00.01 /usr/local/sbin/httpd -DNOHTTPACCEPT
www  39915  0.0  0.2  81972  5048  -  IJ    1:14PM 0:00.00 /usr/local/sbin/httpd -DNOHTTPACCEPT
www  39916  0.0  0.2  81972  5048  -  IJ    1:14PM 0:00.00 /usr/local/sbin/httpd -DNOHTTPACCEPT
www  39917  0.0  0.2  81972  5048  -  IJ    1:14PM 0:00.00 /usr/local/sbin/httpd -DNOHTTPACCEPT
www  39918  0.0  0.2  81972  5048  -  IJ    1:14PM 0:00.00 /usr/local/sbin/httpd -DNOHTTPACCEPT
root 39925  0.0  0.1  16624  2224  -  SsJ   1:14PM 0:00.01 /usr/sbin/cron -J 15 -s
root 39996  0.0  0.1  16624  2300  -  IJ    1:15PM 0:00.00 cron: running job (cron)
otrs 40008  0.0  0.0      0     0  -  ZJ    1:15PM 0:00.43 <defunct>
otrs 40146  0.0  1.2  77156 25736  -  SJ    1:15PM 0:00.12 /usr/local/bin/perl -X /usr/local/otrs/bin/otrs.Daemon.pl start
otrs 40150  0.0  1.9 104828 38828  -  SJ    1:15PM 0:03.87 /usr/local/bin/perl -X /usr/local/otrs/bin/otrs.Daemon.pl start
www  40385  0.0  0.2  81972  5140  -  IJ    1:15PM 0:00.01 /usr/local/sbin/httpd -DNOHTTPACCEPT
root 41131  0.0  0.2  23600  3268  2  SJ    1:15PM 0:00.03 csh
```


----------



## TzunTzai (Nov 9, 2016)

Understood. We currently do not use OTRS any longer, but let me check my notes too see if I can remember anything.




Jimlad said:


> Thanks TzunTzai,
> 
> Yes both cron files are present and permissions correct from what I can tell.
> 
> ...


----------



## TzunTzai (Nov 9, 2016)

Just a shot in the dark, did you verify that all perl modules were installed (even the optional ones)?

Also, can you copy/paste the system error logs from within OTRS ?




Jimlad said:


> Thanks TzunTzai,
> 
> Yes both cron files are present and permissions correct from what I can tell.
> 
> ...


----------



## Jimlad (Nov 9, 2016)

Thanks TzunTzai, out of interest why did you stop using OTRS, did you replace it with something else?

The only modules showing as no installed are for the alternative DBMS. 

o Apache:BI......................ok (v1.12)
  o Apache2::Reload..................ok (v0.13)
  o Archive::Tar.....................ok (v1.96)
  o Archive::Zip.....................ok (v1.59)
  o Crypt::Eksblowfish::Bcrypt.......ok (v0.009)
  o Crypt::SSLeay....................ok (v0.72)
  o Date::Format.....................ok (v2.24)
  o DBI..............................ok (v1.636)
  o DBD::mysql.......................ok (v4.038)
  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:g..........................Not installed! Use: 'cpan DBD:g' (optional - Required to connect to a PostgreSQL database.)
  o Encode::HanExtra.................ok (v0.23)
  o IO::Socket::SSL..................ok (v2.038)
  o JSON::XS.........................ok (v3.02)
  o List::Util::XS...................ok (v1.45)
  o LWP::UserAgent...................ok (v6.15)
  o Mail::IMAPClient.................ok (v3.38)
    o IO::Socket::SSL................ok (v2.038)
  o ModPerl::Util....................ok (v2.000009)
  o Net:NS.........................ok (v1.06)
  o Net::LDAP........................Not installed! Use: 'cpan Net::LDAP' (optional - Required for directory authentication.)
  o Template.........................ok (v2.26)
  o Template::Stash::XS..............ok (undef)
  o Text::CSV_XS.....................ok (v1.18)
  o Time::HiRes......................ok (v1.9726)
  o Time:iece......................ok (v1.27)
  o XML::LibXML......................ok (v2.0126)
  o XML::LibXSLT.....................ok (v1.95)
  o XML:arser......................ok (v2.44)
  o YAML::XS.........................ok (v0.63)


----------



## TzunTzai (Nov 11, 2016)

Jimlad, can you show me a copy of the OTRS SystemLog under the Admin section? I think that'll get us pointed in the right direction.






Jimlad said:


> Thanks TzunTzai, out of interest why did you stop using OTRS, did you replace it with something else?
> 
> The only modules showing as no installed are for the alternative DBMS.
> 
> ...


----------



## TzunTzai (Nov 11, 2016)

Jimlad said:


> Thanks TzunTzai, out of interest why did you stop using OTRS, did you replace it with something else?



My company was using OTRS because it was free. We moved over to an online hosted service this year called FreshDesk. Less work, less upkeep. Its a very nice paid service, but sometimes I miss OTRS.


----------

