So, google reader is dead. and the old reader went private. What’s a RSS Fiend to do….

I used to be a google reader user before they shuttered. I then switched to the old reader – they had one hell of a site, but had scaling issues, the poor dears, and decided that they couldn’t handle us refugees. Lets be honest here. I could move again, but at this point of time, I have trust issues. I want a reasonable amount of control, the option to move to another server, taking my feeds with me, and the knowledge that I won’t have to switch providers for reasons I can’t control.

The alternative thats currently the best loved, and maintained is ttrss. While it will run on a standard LAMP stack, apparently it works better on postgres – so I figured I’d go with ubuntu, lighttpd, postgres and php. I also decided to document the whole process. The web stack setup is based off howtoforge’s guide on setting up a lighttpd/myql/php stackĀ  I’ve modified the instructions to use the things I use, and streamlined it a bit. I *do* assume you’re building off a barebones VM – you’ll need to adjust the instructions if you’re running or planning to run something like Apache or Ngnix.

Firstly, the packages you’ll need

sudo apt-get install lighttpd php5-fpm php5 php5-pgsql php5-curl php5-cli postgresql

Lets break this up into what these packages are for. You have your web server, and the varient of php its running – in this case lighttpd and php5-fpm, with php5 being a prerequisite for pgp. You have the postgres related packages postgresql and php5-pgsql, and finally you have php5-curl and php5-cli – the latter is a suggested prerequisite for ttrss and the latter is needed to run the update script for ttrss. Naturally, if you’re running another web browser, switch the appropriate group of packages for alternatives.

The default configuration for lighttpd assumes you use spawnfgi rather than fpm for php. You will need to make two changes to the config files to make sure things work fine. These are identical to what is done on howtoforge’s tutorial.

First, you need to enable cgi.fix_pathinfo in /etc/php5/fpm/php.ini. To do this, open up /etc/php5/fpm/php.ini with your favourite editor, find a line that says

;cgi.fix_pathinfo

and remove the semicolon to enable it.

Next, to set up php-fpm

sudo su
cd /etc/lighttpd/conf-available/
mv 15-fastcgi-php.conf 15-fastcgi-php-spawnfcgi.conf
nano 15-fastcgi-php.conf

Then paste in – for ubuntu 12.04. Annoyingly this will fail horribly for ubuntu 13.04 and you need to look up the appropriate, sockets based alternative here

The rest of the instructions are identical, so meh, do your homework ;p

# /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi

## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" =>
        ((
                "host" => "127.0.0.1",
                "port" => "9000",
                "broken-scriptfilename" => "enable"
        ))
)

Now that the configuration is done, we need to enable our new configurations and reload lighttpd and php-fpm

lighttpd-enable-mod fastcgi fastcgi-php 
/etc/init.d/lighttpd force-reload
/etc/init.d/php5-fpm force-reload

at this point, our environment should be ready for the install to start. A good way to check is to create a php information script, and take a peek

Create a file in /var/www/ called info.php and paste in

<?php
phpinfo();
?

Go to your webserver and check if it works – if it does, check for entries saying ‘pgsql’. If they are there, we’re ready to create the database.

sudo -u postgres psql postgres

should throw you into the postgres shell
It looks something like

postgres-#

You need to create a new user

postgres-# CREATE ROLE ttrss WITH LOGIN ENCRYPTED PASSWORD 'password' CREATEDB;

then create a new database with the new user as an owner

postgres-# CREATE DATABASE ttrss WITH OWNER ttrss;

and just to play it safe

postgres-# GRANT ALL PRIVILEGES ON DATABASE ttrss TO ttrss;

Download and unpack ttrss from http://tt-rss.org/redmine/projects/tt-rss/wiki
I tend to do this using sudo wget url, since I have had little luck doing it any other way. Probably not best practice. You’ll likely also want to change the folder name to something friendlier, and change ownership to www-data (so you can automatically have ttrss set the config file it generates)

At this point, go to the website, set some sane defaults and get cracking – you can pretty much coast through the rest of this.

Leave a Comment