You are here: Home / Debian GNU/Linux / Web applications / Monitoring / Install Intaro Pinboard on Debian

Install Intaro Pinboard on Debian

by Pierre-Yves Landuré last modified Aug 16, 2018 11:09

Intaro Pinboard is a Web application that display statistics generated by Pinba. It ease the identification of PHP code consuming a high amount of resources.

This how-to is tested on:

  • Debian 7.0 Wheezy

This how-to is tested with theses versions of Intaro Pinboard:

  • 1.1


This how-to needs:

This how-to recommends:


Provide the domain name where will be available the software:


Provide the MySQL server host:


If the MySQL server is not local, the mysql-tools script will try to connect with MySQL client, or in case of connection failure, through SSH.

Provide the name of the SSL certificate to use (created by following Create a SSL / TLS certificate on Debian) (optionnal, recommended):


Security parameters

Provide a username to protect the application access (optional, recommended):



Compute the installation path:


Make sure that the parent folder exists:

command mkdir -p "$(command dirname "${INSTALL_PATH}")"

Environment preparation

Install the needed software:

command apt-get install php5-mysql php5-gd php5-cli git apg

Reload PHP configuration:

test -x /etc/init.d/php5-fpm && /etc/init.d/php5-fpm force-reload
test -x /etc/init.d/apache2 && /etc/init.d/apache2 force-reload
test -x /etc/init.d/lighttpd && /etc/init.d/lighttpd force-reload
test -x /etc/init.d/nginx && /etc/init.d/nginx force-reload

Application installation

Download application latest version:

command git clone '' "${INSTALL_PATH}"

Enter the source folder:

command pushd "${INSTALL_PATH}"

Install Composer:

command wget --quiet --output-document=- --no-check-certificate \
'' \
| command php

Install the PHP libraries needed by the application:

command php "${INSTALL_PATH}/composer.phar" install

Exit the source folder:

command popd

Database access configuration

Use mysql-tools to create the MySQL user allowed to access the "pinba" database:

MYSQL_PARAMS="$(command mysql-tools --server="${MYSQL_HOST}" --with-ssh \
--auto-hosts --database="pinba" --user-prefix="p" --adduser="${DOMAIN}")"

Fetch the created user parameters:

MYSQL_DB="$(echo "${MYSQL_PARAMS}" | command grep -e "^MYSQL_DB" \
    | cut --delimiter="=" --fields="2-")"
MYSQL_USER="$(echo "${MYSQL_PARAMS}" | command grep -e "^MYSQL_USER" \
    | cut --delimiter="=" --fields="2-")"
MYSQL_PASSWORD="$(echo "${MYSQL_PARAMS}" | command grep -e "^MYSQL_PASSWORD" \
    | cut --delimiter="=" --fields="2-")"
echo "${MYSQL_PARAMS}"

Application setup

Create the application configuration file:

command cp "${INSTALL_PATH}/config/parameters.yml.dist" "${INSTALL_PATH}/config/parameters.yml"

Adjust the Command folder permissions:

command chown www-data:www-data "${INSTALL_PATH}/src/Pinboard/Command"

Setup the database access:

command sed -i \
    -e "s/host:.*$/host: ${MYSQL_HOST}/" \
    -e "s/user:.*$/user: ${MYSQL_USER}/" \
    -e "s/pass:.*$/pass: ${MYSQL_PASSWORD}/" \

Initialize the database:

"${INSTALL_PATH}/console" migrations:migrate

Setup the data aggregation (the aggregation frequency must be the same as the "pinba_stats_history" option (15 minutes by default)):

command echo "*/15 * * * *     www-data    test -x '${INSTALL_PATH}/console' && ${INSTALL_PATH}/console aggregate > '/dev/null'" \
    > "/etc/cron.d/pinboard-${DOMAIN//./-}"

Reload cron:

/etc/init.d/cron reload

Launch a first data aggregation:

command su www-data -c "${INSTALL_PATH}/console aggregate"

Hardening security

Create a random password for the user:

USER_PASSWORD="$(command apg -q -a 0 -n 1 -M NCL)"

Add the user, if needed:

if [ -n "${USER_NAME}" ]; then
  command sed -i \
      -e '/secure:/,/enable:/{s/enable:.*$/enable: true/}' \
"${INSTALL_PATH}/console" add-user "${USER_NAME}" "${USER_PASSWORD}"

If the system use PHP-FPM, install the needed fix:

if [ -x '/etc/init.d/php5-fpm' -a -n "${USER_NAME}" ]; then
   command sed -i -e '/<\/IfModule>/i\
  RewriteCond %{HTTP:Authorization} ^(.*)\
  RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]' \

Print the connection parameters:

if [ -n "${USER_NAME}" ]; then
echo "URL: http://${DOMAIN}/
Username : ${USER_NAME}
Password : ${USER_PASSWORD}"

Take note of the displayed informations.

Virtual Host setup

Setup the HTTP server virtual host :

if [ -n "${SSL_KEY_NAME}" -a -e "/etc/ssl/private/${SSL_KEY_NAME}.key" ]; then
  command a2tools --overrides="All" --ssl="${SSL_KEY_NAME}" "${DOMAIN}" "${INSTALL_PATH}/web"
command a2tools --template='redirect' "${DOMAIN}" "https://${DOMAIN}/"
command a2tools --overrides="All" "${DOMAIN}" "${INSTALL_PATH}/web"

The application is now available on the specified domain name with HTTP and HTTPS protocols if possible.

Automatic update

Install the daily automatic update script:

echo "#"'!'"/bin/bash
# Update ${DOMAIN} source code from Git.
test -x '/usr/bin/git' -a -d '${INSTALL_PATH}' && {
pushd '${INSTALL_PATH}' > '/dev/null'
command git pull --quiet > '/dev/null'
  command chown www-data:www-data '${INSTALL_PATH}/src/Pinboard/Command'
command php '${INSTALL_PATH}/composer.phar' self-update > '/dev/null'
command php '${INSTALL_PATH}/composer.phar' update > '/dev/null'
  command php '${INSTALL_PATH}/console' migrations:migrate <<< 'y' > '/dev/null'
popd > '/dev/null'
}" \
  > "/etc/cron.daily/${DOMAIN}-update"
command chmod +x "/etc/cron.daily/${DOMAIN}-update"


Backup the installation with Backup Manager (see Install and setup Backup Manager on Debian) :

command backup-manager-tools add "${INSTALL_PATH}"

Don't forget to backup the database (see Install and setup MySQL on Debian).