Install iTop on Odroid C2 Running Arch
I saw a mention of iTop on Mastodon, and not having heard of it before, I thought I would give installing it a go and see how it compares to the various ticketing solutions I have used at work. As I had an under used Odroid C2 which is just running a base install of Arch Linux, that was the target I chose for the install. As usual I wanted to do as much of the install and configuration via Salt as possible. This post documents the experience, and what I came up with.
LAMP Stack
Like many web applications, iTop runs on top of the Lamp stack. Despite the ubiquity of this base requirement and many a Salt tutorial focused on installing LAMP, I have not as yet come up with Salt state files of my own to do this. I also have never installed LAMP on Arch before, so I am really starting from scratch.
Apache
I decided to start out simply following the guidance on installing Apache provided on the Arch Linux Wiki. I figured additional adjustments required to support iTop would make themselves clear as I progressed or failed to progress.
To install Apache and associated dependencies, su -c 'pacman -S apache'
seemed to suffice. Once insalled, su -c 'systemctl enable --now httpd'
was all it took to get the web running and set to run on restarts of the device.
Easy to do manually, but now I need to replicate those Salt state file because automation and future use. This is what I came up with to install software Apache if it is missing and make sure service is running now and in the future.
File system layout for Apache state
init.sls file for Apache
Apache Arch Notes:
- Main apache config file is
/etc/httpd/conf/httpd.conf
- ServerAdmin should be updated from
ServerAdmin you@example.com
- Document root for webserver is
DocumentRoot "/srv/http"
- Server signature should be turned off,
ServerSignature Off
- Server tokens should be surpressed,
ServerTokens Prod
- Check Apache configuration file,
apachectl configtest
- Apache runs as
httpd.service
on Arch, as user and grouphttp
.
Apache Fast CGI Interface Module
After some research I decided to use the Fast CGI module (mod_fcgid) in order to increase CGI performance. Additional Apache and PHP configuration is needed to take advanage of this module, as follows.
- Install the module.
su -c 'pacman -S mod_fcgid'
is sufficent to install the module.
- Create a fcgid-bin directory in the document root of the web server to house wrappers needed for applications to use module.
su -c 'mkdir /srv/http/fcgid-bin'
is the command I used.
- Modify Apache configuration file
/etc/httpd/conf/httpd.conf
:- Remove leading # to uncomment the loading of the actions module, should look like this:
LoadModule actions_module modules/mod_actions.so
- The FCGID module needs to be loaded after the unixd module on which it dependends. I placed this within the existing
<IfModule unixd_module>
block, where I tucked the neededLoadModule fcgid_module modules/mod_fcgid.so
entry in right above the closing</IfModule>
.
The block wound up looking like this:
- Remove leading # to uncomment the loading of the actions module, should look like this:
-
Ensure that the inclusion of the MPM module configuration is uncommented (no leading #), and looks like this:
Include conf/extra/httpd-mpm.conf
-
Restart Apache to enable changes made in
/etc/httpd/conf/httpd.conf
.su -c 'systemctl restart httpd.service
This is the Salt solution I came up with to do the same.
File system layout for app_apache_mod_fcgid
init.sls file for mod_fcgid
PHP
By virtue of being a rolling release, Arch defaults to installing the current version of PHP in the 8.x familly. Since iTop does not support PHP 8.x yet, I need to make sure PHP 7.x is installed. There are multiple ways to optimize PHP for use with Apache. Above, I opted to make use of apache2-mpm-worker and mod_fcgid, so I need to also install and configure PHP to make use of thos modules.
pacman -S php7
is enough to get PHP v7 installed manually. The following is an equivalent Salt state that does the same.
File system layout for app_php7
init.sls file for app_php7
PHP CGI Optimization
In a similar manner su -c 'pacman -S mod_fcgid php7-cgi'
takes care of installation of the php-cgi optimization wrapper. A bit of configuration required to get the PHP optimization wrapper set up and working. Again most of the guidance was found here on the Arch Linux Wiki
- Create symlink for the PHP wrapper:
- Create /etc/httpd/conf/extra/php-fcgid.conf with the following content:
- Append inclusion of FCGID configuration for PHP by appending the following line to the end of the file:
Include conf/extra/php-fcgid.conf
- Restart httpd.service.
su -c systemctl restart httpd
- Restart httpd.service.
Here is the Salt solution to do all of the above I came up with:
File system structure for php7-cgi
init.sls for php7-cgi
php-fcgid.conf
MariaDB
While ultimately I intend to run the database for iTop off an existing database server I did go through the steps of installing MariaDB locally so that I could create a Salt state file to do the needful in the future. While the steps are fairly straight forward, install the software, initialize the database server, set the service running and then to restart, I ran in to an hardware related setting that kept causing the software to crash during database initialization. After some searching on the world wide web, I found an Odroid C2 specific setting to change, and when I did chane it things began working as expected. I will note the setting in the Opportunities section below, and did create a state file to fix, I am not going to include it in my Salt state file for MariaDB, as it is unlikely something that I will run into again.
As should be expected, I for the most part stuck with the installation guidance for MariaDB on the Arch Wiki.
Install the Software
su -c 'pacman -S mariadb'
Initialize the Database Server for Use
su -c 'mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql'
Enable and Start Service
su -c 'systemctl enable --now mariadb.service'
Finally, here is the Salt state I came up with to do the installation and activation:
File system layout for app_mariadb
init.sls file for Mariadb
iTop
With with the needed support staxk in place (Apache, MariaDB and PHP) and working, all that remains is to install iTop. For the installation I relied heavilly on the documentation from iTop. For purposes of this document, I am installing iTop version 2.7.5-1 which I downloaded as a zipped archive file from SourceForge.
iTop Prerequisites
In addition to the prerequisites noted in the iTop documentation, I identified a couple of additional requirements that resulted from deciding to make use of an unused machine with little more installed than the base operating system. For example the iTop software I am using is distributed as a Zip archive, and the server had no Unzip utility installed. The PHP install outlined above is also pretty bare bones and it did not surprise me that I wound up having to enable some additional PHP modules to support iTop.
Unzip
Instalation of unzip utility is straight forward, just a su -c 'pacman -S unzip'
. The state file to install iTop has an include stanza which calls the state file to install unzip and other dependencies from their own individual install state files. This is the approach I took for the rest of the prerequisites as well. Ultimately the Apache, MariaDB and PHP installations could be treated in the same manner where each of the state files is ‘included’ into the iTop state file.
File System Layout for app_unzip
init.sls file for unzip
Graphviz
Since iTop makes use of Graphviz as a run-time dependency, I opted to include the state file to install as part of the iTop statefile like was done for Unzip. su -c 'pacman -S graphviz'
did the trick for this host.
File System Layout for app_graphviz
init.sls file for graphviz
Additional PHP Modules for iTop
When running the iTop wizard the first time it raised errors for missing PHP modules GD, MYSQLI, ICONV, SOAP, LDAP and the ability to save sessions.
File system layout for php7-gd, php7-mysqli, php7-iconv, php7-soap, php7-ldap and php7-session_save_
init.sls for GD
init.sls for MYSQLI
init.sls for ICONV
init.sls for SOAP
init.sls for LDAP
init.sls for save_sessions
Putting every thing together, this is the Salt state file I came up with to install the iTop software:
File System Layout for app_itop
init.sls file for itop
With the above I was successfully able to automatically install the iTop software and all supporting dependencies on the Arch based Odroid C2 by simply issuing the single command su -c 'salt bob-c2 state.apply app_iftop'
. Issuing that command and then waiting a few minutes is all it takes to install iTop and all of the dependencies on which it relies.
There are a few more steps to complete before the application can be configured and made available for use.
iTop Database and Database User
I created the database and database user for iTop to use with the forllowing commands. I should tuck these commands into a Salt state, but have not done so as yet, simply executing them directly through the mysql
commnad line interface.
User Create / Acces Grant
iTop Wizard
With the software installes, and database user and database created, all thet remains is to visit the index page of of the iTop software in a web browser and complete the first time use wizard to complete initial configuration. For me, this was a matter of browsing to http://bob-c2/itop/index.php
.
Initial Landing Page
Install or Upgrade Choice
iTop License Acceptance Dialog
iTop Database Configuration Dialog
Administrator Account Setup Dialog
Miscellaneous Parameters Setting Dialog
Configuration Management Options Dialog
Service Management Options Dialog
Tickets Management Options Dialog
Change Management Options Dialog
Additional ITIL Tickets Dialog
Ready to Install Dialog
Installation in Progress
Installation Done Dialog
Welcome to iTop Dialog
Opportunities / Lessons Learned
- A new version 3.0.0 of iTop should soon be out of Beta, so there will be a chance to revisit and perhaps improve things as a result of upgrading.
- php-fcgid.conf
- Had to increase the fcgid IO timeout from default of 40s to 2 minutes in order to get iTop to install.
- Had to increase the fcgid IO timeout from default of 40s to 2 minutes in order to get iTop to install.
- /boot/boot.ini
- Had alter mesontime setting from default of “1” to “0” in ordert to get MariaDB initializaed on the Odroid C2 hardware. This will diminish video performance, but is not an issue for me as I am running the device headless. A reboot is necessary for the change to take effect, so needs to be done before MariaDB is initialized as part of the install process.
- setenv mesontimer “0”
- Here is a Salt file to apply this fix.
- Had alter mesontime setting from default of “1” to “0” in ordert to get MariaDB initializaed on the Odroid C2 hardware. This will diminish video performance, but is not an issue for me as I am running the device headless. A reboot is necessary for the change to take effect, so needs to be done before MariaDB is initialized as part of the install process.