You are here: Home / Debian GNU/Linux / Web applications / Content syndication / Install Tiny Tiny RSS feed reader on Debian

Install Tiny Tiny RSS feed reader on Debian

by Pierre-Yves Landuré last modified Aug 16, 2017 03:16

Tiny Tiny RSS is a syndication feed reader written in PHP and AJAX. It is a good alternative to Google Reader if you want to read RSS feeds from multiple clients.

This howto is tested on :

  • Debian 6.0 Squeeze

This howto is tested with these versions of Tiny Tiny RSS :

  • 1.6.1

Prerequisites

This howto needs :

This howto needs one of these tools, according to the installed HTTP server :

Parameters

Provide the domain name where will be available the software :

DOMAIN="rss.example-domain.com"

Provide the e-mail address used by the software to send e-mails :

FROM_EMAIL="no-reply@domaine-exemple.fr"

Provide the e-mail address notified of new users subscription :

NOTIFY_EMAIL="firstname.lastname@google.com"

Provide the MySQL server host :

MYSQL_HOST="localhost"

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.

Installation

Compute the installation path :

INSTALL_PATH="/opt/tt-rss/${DOMAIN}"

Make sure of the folder existance :

command mkdir --parent "${INSTALL_PATH}"

Environment preparation

Install the needed software :

command apt-get install php5-mysql php5-xmlrpc mysql-client \
  php5-curl php5-cli patch

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

Detect the URL of the application last version :

SOURCE_URL=$(command wget --quiet --output-document=- "http://tt-rss.org/redmine/projects/tt-rss/wiki" \
    | command grep -e "https://github.com/gothfox/Tiny-Tiny-RSS/archive/.*.tar.gz" \
    | command sed -e 's|.*"\(https://github.com/gothfox/Tiny-Tiny-RSS/archive/.*.tar.gz\)".*|\1|')
VERSION=$(command echo "${SOURCE_URL}" | command sed -e 's|.*Tiny-Tiny-RSS/archive/\(.*\).tar.gz|\1|')

Download the sources :

command wget --no-check-certificate "${SOURCE_URL}" \
    --output-document="/tmp/tt-rss-${VERSION}.tar.gz"

Extract the archive :

command tar --strip-components=1 --directory="${INSTALL_PATH}" -xzf "/tmp/tt-rss-${VERSION}.tar.gz"

Delete download file :

command rm "/tmp/tt-rss-${VERSION}.tar.gz"

Database creation

Create the database with mysql-tools :

MYSQL_PARAMS="$(command mysql-tools --server="${MYSQL_HOST}" --with-ssh \
--auto-hosts --db-prefix="tt-rss" --create "${DOMAIN}")"

Parse the database connection 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}"

Initialize database contents :

command mysql --user="${MYSQL_USER}" --password="${MYSQL_PASSWORD}" \
    --host="${MYSQL_HOST}" "${MYSQL_DB}" \
      < "${INSTALL_PATH}/schema/ttrss_schema_mysql.sql"

Create the configuration file from template :

command cp "${INSTALL_PATH}/config.php-dist" "${INSTALL_PATH}/config.php"

Update the configuration :

command sed -i \
    -e "s/\(define('DB_TYPE', \).*/\1'mysql');/" \
    -e "s/\(define('DB_HOST', \).*/\1'${MYSQL_HOST}');/" \
    -e "s/\(define('DB_NAME', \).*/\1'${MYSQL_DB}');/" \
    -e "s/\(define('DB_USER', \).*/\1'${MYSQL_USER}');/" \
    -e "s/\(define('DB_PASS', \).*/\1'${MYSQL_PASSWORD}');/" \
    "${INSTALL_PATH}/config.php"

Conformity with LSB

Move cache, feed-icons and lock folders to fit Linux Standard Base :

command mkdir --parent "/var/cache/tt-rss/${DOMAIN}"
command mv "${INSTALL_PATH}/cache" "/var/cache/tt-rss/${DOMAIN}/cache"
command ln -s "/var/cache/tt-rss/${DOMAIN}/cache" "${INSTALL_PATH}/cache"
command chown -R www-data:www-data "/var/cache/tt-rss/${DOMAIN}"
command mkdir --parent "/var/lock/tt-rss/"
command mv "${INSTALL_PATH}/lock" "/var/lock/tt-rss/${DOMAIN}"
command chown -R www-data:www-data "/var/lock/tt-rss/${DOMAIN}"
command ln -s "/var/lock/tt-rss/${DOMAIN}" "${INSTALL_PATH}/lock"
command mkdir --parent "/var/lib/tt-rss/${DOMAIN}/"
command mv "${INSTALL_PATH}/feed-icons" "/var/lib/tt-rss/${DOMAIN}/feed-icons"
command chown -R www-data:www-data "/var/lib/tt-rss/${DOMAIN}/feed-icons"
command ln -s "/var/lib/tt-rss/${DOMAIN}/feed-icons" "${INSTALL_PATH}/feed-icons"

Feed update daemon

Adjust the location of daemon lock files :

command sed -i \
    -e "s|\(define('LOCK_DIRECTORY', \).*|\1'/var/lock/tt-rss/${DOMAIN}');|" \
    "${INSTALL_PATH}/config.php"

Install daemon init.d script configuration file :

command wget "https://raw.github.com/biapy/howto.biapy.com/master/web-applications/tiny-tiny-rss/tt-rss.default" \
    --quiet --no-check-certificate --output-document="/etc/default/tt-rss-${DOMAIN}"
command sed -i -e "s|^TTRSS_PATH=.*|TTRSS_PATH=\"${INSTALL_PATH}\"|" "/etc/default/tt-rss-${DOMAIN}"

Install daemon init.d script :

 

command wget "https://raw.github.com/biapy/howto.biapy.com/master/web-applications/tiny-tiny-rss/tt-rss.init-d" \
    --quiet --no-check-certificate --output-document="/etc/init.d/tt-rss-${DOMAIN}"
command sed -i -e "s/DOMAIN/${DOMAIN}/g" "/etc/init.d/tt-rss-${DOMAIN}"
command test "${MYSQL_HOST}" != 'localhost' && command sed -i -e 's/ mysql//' "/etc/init.d/tt-rss-${DOMAIN}" command chmod +x "/etc/init.d/tt-rss-${DOMAIN}"

Create the folder for the PID file:

command mkdir --parent "/var/run/tt-rss/${DOMAIN}"

Add the daemon launch to system start-up :

command update-rc.d "tt-rss-${DOMAIN}" defaults

Final configuration

Enable the use of SimplePie, multi-users and declare the configuration done :

command sed -i \
-e "s|\(define('SELF_URL_PATH', \).*|\1'http://${DOMAIN}/');|" \
 -e "s/\(define('DEFAULT_UPDATE_METHOD', \).*/\11);/" \
-e "s/\(define('SINGLE_USER_MODE', \).*/\1false);/" \
-e "s/\(define('REG_NOTIFY_ADDRESS', \).*/\1'${NOTIFY_EMAIL}');/" \
"${INSTALL_PATH}/config.php"

Launch the feed update daemon :

/etc/init.d/tt-rss-${DOMAIN} start

Setup the HTTP server for the application :

if [ -x "/usr/bin/a2tools" ]; then
  command a2tools "${DOMAIN}" "${INSTALL_PATH}"
fi
if [ -x "/usr/bin/lighty-tools" ]; then
  command lighty-tools add-vhost "${DOMAIN}" "${INSTALL_PATH}"
fi

The software should now be available on the domain name.

Use these to log-in :

  • Username : admin
  • Password : password

Daily use

User settings

Here are the options I've changed to fit my needs :

  • Purge old posts after this number of days (0 - disables) : 0 (disable deletion of old feed items)
  • Confirm marking feed as read : No (disable the alert dialog before marking all items of a feed as read)

Integration with Mozilla Firefox

You can use Tiny Tiny RSS as RSS feed manager in Mozilla Firefox. This can be set up from Tiny Tiny RSS feeds settings.

Backup

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

command backup-manager-tools add "${INSTALL_PATH}"
command backup-manager-tools add "/var/lib/tt-rss/${DOMAIN}"

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

Software upgrade

Provide the application domain name :

DOMAIN="rss.example-domain.com"

Compute the installation path :

INSTALL_PATH="/opt/tt-rss/${DOMAIN}"

Create a patch of the configuration changes :

command pushd "${INSTALL_PATH}"
command diff -Nru config.php-dist config.php > "/tmp/tt-rss-config-diff.patch"
command popd

Backup the current install :

if [ -e "${INSTALL_PATH}.old" ]; then
command rm -r "${INSTALL_PATH}.old"
fi
command cp -a "${INSTALL_PATH}" "${INSTALL_PATH}.old"

Detect the URL of the application last version :

SOURCE_URL=$(command wget --quiet --output-document=- "http://tt-rss.org/redmine/projects/tt-rss/wiki" \
    | command grep -e "https://github.com/gothfox/Tiny-Tiny-RSS/archive/.*.tar.gz" \
    | command sed -e 's|.*"\(https://github.com/gothfox/Tiny-Tiny-RSS/archive/.*.tar.gz\)".*|\1|')
VERSION=$(command echo "${SOURCE_URL}" | command sed -e 's|.*Tiny-Tiny-RSS/archive/\(.*\).tar.gz|\1|')

Download the sources :

command wget --no-check-certificate "${SOURCE_URL}" \
    --output-document="/tmp/tt-rss-${VERSION}.tar.gz"

Extract the archive :

command tar --strip-components=1 --directory="${INSTALL_PATH}" -xzf "/tmp/tt-rss-${VERSION}.tar.gz"

Reset the files permissions :

command chown -R www-data:www-data "/var/cache/tt-rss/${DOMAIN}"
command chown -R www-data:www-data "/var/lock/tt-rss/${DOMAIN}"
command chown -R www-data:www-data "/var/lib/tt-rss/${DOMAIN}/feed-icons"

Reset the configuration file :

command cp "${INSTALL_PATH}/config.php-dist" "${INSTALL_PATH}/config.php"

Apply the configuration path (make sure to fix the eventual errors) :

command patch --directory="${INSTALL_PATH}" --strip=0 < "/tmp/tt-rss-config-diff.patch"

Log in as admin in order to upgrade the database, if necessary. Check that everything work as expected. The site URL is given by :

echo "# Please log in as admin on :
http://${DOMAIN}/"

Restart feed update daemon :

/etc/init.d/tt-rss-${DOMAIN} restart

Delete downloaded file and backup data :

command rm "/tmp/tt-rss-${VERSION}.tar.gz"
command rm -r "${INSTALL_PATH}.old"

Thanks

  • Thanks to Tiny Tiny RSS (en) developers.
  • Thanks to Mdrolo who made me discover this tool.