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

Install rssLounge feed reader on Debian

by Pierre-Yves Landuré last modified Apr 22, 2013 02:46

rssLounge is a RSS feed reader writen in PHP. It is known for its lightness. Its main downside is to be mono-user.

This howto is tested on :

  • Debian 6.0 Squeeze

This howto is tested with these versions of rssLounge :

  • 1.7

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 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/rsslounge/${DOMAIN}"

Make sure that the parent folder exists :

PARENT_PATH="$(command dirname "${INSTALL_PATH}")"
if [ ! -e "${PARENT_PATH}" ]; then
command mkdir --parent "${PARENT_PATH}"
fi

Environment preparation

Install the needed software :

command apt-get install php5-mysql unzip 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

Fetch the latest sources using the sf-downloader script :

command mkdir --parent '/opt/bin'
command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/sf-downloader' \
--quiet --no-check-certificate --output-document='/opt/bin/sf-downloader'
command chmod +x '/opt/bin/sf-downloader'
SOURCE="$(/opt/bin/sf-downloader --googlecode --zip rsslounge rsslounge-VERSION.zip)"

Move the source folder to the install path :

command mv "${SOURCE}" "${INSTALL_PATH}"

Allow the configuration file creation :

command chown www-data:www-data "${INSTALL_PATH}/config"

Conformity with LSB

Move cache, logs and data folders to fit Linux Standard Base :

unset DATA_PATHS
declare -a DATA_PATHS
DATA_PATHS[0]="data/favicons"
DATA_PATHS[1]="data/thumbnails"
DATA_PATHS[2]="public/javascript"
DATA_PATHS[3]="public/stylesheets"
command mkdir --parent "/var/lib/rsslounge/${DOMAIN}/data"
command mkdir --parent "/var/lib/rsslounge/${DOMAIN}/public"
for DATA_PATH in ${DATA_PATHS[@]}; do
COMPLETE_PATH="${INSTALL_PATH}/${DATA_PATH}"
LSB_PATH="/var/lib/rsslounge/${DOMAIN}/${DATA_PATH}"
if [ -e "${COMPLETE_PATH}" -a ! -h "${COMPLETE_PATH}" ]; then
command mv "${COMPLETE_PATH}" "${LSB_PATH}"
command ln -s "${LSB_PATH}" "${COMPLETE_PATH}"
command chown -R www-data:www-data "${LSB_PATH}"
fi
done
command mkdir --parent "/var/cache/rsslounge"
command mkdir --parent "/var/log/rsslounge"
if [ -d "${INSTALL_PATH}/data/cache" ]; then
command mv "${INSTALL_PATH}/data/cache" "/var/cache/rsslounge/${DOMAIN}"
command ln -s "/var/cache/rsslounge/${DOMAIN}" "${INSTALL_PATH}/data/cache"
command chown -R www-data:www-data "/var/cache/rsslounge/${DOMAIN}"
fi
if [ -d "${INSTALL_PATH}/data/logs" ]; then
command mv "${INSTALL_PATH}/data/logs" "/var/log/rsslounge/${DOMAIN}"
command ln -s "/var/log/rsslounge/${DOMAIN}" "${INSTALL_PATH}/data/logs"
command chown -R www-data:www-data "/var/log/rsslounge/${DOMAIN}"
fi

Logs rotation

Setup the logs rotation for the software :

echo '# Logrotate configuration file for rsslounge

"/var/log/rsslounge/*/*" {
    weekly
    missingok
    rotate 12
    copytruncate
    compress                                                      
    delaycompress
    create 644 www-data www-data
}
' > '/etc/logrotate.d/rsslounge'

Virtualhost setup

Create the HTTP server virtual host for the domain :

if [ -x "/usr/bin/a2tools" ]; then
command a2enmod rewrite headers expires deflate
command a2tools --overrides="All" "${DOMAIN}" "${INSTALL_PATH}" fi if [ -x "/usr/bin/lighty-tools" ]; then command lighty-tools add-vhost "${DOMAIN}" "${INSTALL_PATH}" fi

Regular feeds fetch

Setup the regular fetch of feeds contents :

command echo "# Update rssLounge contents
*/15 * * * * test -x '/usr/bin/wget' -a -e '${INSTALL_PATH}' && /usr/bin/wget --quiet --output-document='/dev/null' 'http://${DOMAIN}/update/silent'" \
> "/etc/cron.d/rsslounge-${DOMAIN}"

Database creation

Create the database with mysql-tools :

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

Write down the database connection parameters, you'll need them during the software setup :

echo "${MYSQL_PARAMS}"

Harden the software security by using a random table prefix :

echo "Préfixe des noms des tables sécurisé: $(command apg -q -a 0 -n 1 -M NCL)_"

Configuration

Setup the software by browsing the URL displayed by :

echo "http://${DOMAIN}/"

Once the software configured, protect the configuration file from changes :

command chown -R root:root "${INSTALL_PATH}/config"

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/rsslounge/${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/rsslounge/${DOMAIN}"

Fetch the latest sources using the sf-downloader script :

command mkdir --parent '/opt/bin'
command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/sf-downloader' \
--quiet --no-check-certificate --output-document='/opt/bin/sf-downloader'
command chmod +x '/opt/bin/sf-downloader'
SOURCE="$(/opt/bin/sf-downloader --googlecode --zip rsslounge rsslounge-VERSION.zip)"

Fetch the data from the outdated install :

unset DATA_PATHS
declare -a DATA_PATHS
DATA_PATHS[0]="data/favicons"
DATA_PATHS[1]="data/thumbnails"
DATA_PATHS[2]="data/cache"
DATA_PATHS[3]="data/logs"
DATA_PATHS[4]="public/javascript"
DATA_PATHS[5]="public/stylesheets"
DATA_PATHS[6]="config"
for DATA_PATH in ${DATA_PATHS[@]}; do
COMPLETE_PATH="${INSTALL_PATH}/${DATA_PATH}"
TARGET_PATH="${SOURCE}/${DATA_PATH}"
if [ -e "${TARGET_PATH}" ]; then
command rm -r "${TARGET_PATH}"
fi
if [ -e "${COMPLETE_PATH}" -a ! -e "${TARGET_PATH}" ]; then
command cp -a "${COMPLETE_PATH}" "${TARGET_PATH}"
fi
done

Backup the outdated install :

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

Install the latest version :

command mv "${SOURCE}" "${INSTALL_PATH}"

Check that everything work.

Delete the outdated install backup :

command rm -r "${INSTALL_PATH}.old"

Thanks