Easily set up open-source software Planet to consolidate your favorite RSS news feeds into one local news source.
Do you get tired of visiting dozens of Web site feeds to get your daily IT news? Do you receive too many email messages from mailing lists? Or do you just want to set up a news site for internal IT use? This TechTip will show you how to use the Planet RSS feed reader to consolidate your news and informational feeds.
What's RSS Anyway?
First, a little lesson in RSS. Really Simple Syndication (RSS) was formerly known as RDF Site Summary. The standard is a family of feed formats used for frequently updated Web content. RSS is commonly used for blogs, news Web sites, or any other Web site with constantly changing content. Specifications for using RSS are based on the common Extensible Markup Language, or XML. If you want to know the complete basics and history of RSS, visit Wikipedia's page on RSS.
If you've always wondered what the orange icon in your URL browser bar is when you visit a Web site, that's RSS in action. There are two basic components to using RSS. The first is the RSS feed, which is on the side of the Web site or content. The second is an RSS feed reader, or aggregator, which typically subscribes to the RSS feed from either your Web browser or any other application handling RSS formatting.
Planet
Planet's job is to subscribe to RSS feeds you specify and aggregate all content into a single location. This gives you the ability to visit only one Web site with your browser, rather than surf to multiple Web sites. Planet requires only an operating Web server and at least Version 2.1 of Python. If you want to set up Planet on a Windows server, you can download Python from the Web site, but I'll demonstrate installation on CentOS Linux. You can obtain the Planet software from planetplanet.org in either a tar.bz2 or zip format.
Installing Planet's Files
Once you've downloaded the zipped package, unpack Planet into your document root of a Web server. You should change ownership to Apache as well.
# unzip planet-2.0.zip
# chown -R apache.apache planet-2.0
# cd planet-2.0
Be sure to read both the README and INSTALL text files for complete details on many of the options that won't be covered here.
I suggest creating a directory reflecting your IT department name or perhaps your company name. Substitute my generic terms for your own.
# mkdir itnews
Next, copy all the files that are in the examples directory, along with either the basic or fancy style of Web design, to the directory you just created. The look and feel of the fancy style is a much better layout to choose.
# cp -ar examples/fancy/ examples/cache/ examples/output/ examples/*.tmpl itnews/
If you desire, you can edit any of the template (.tmpl) files to suit your needs. They are all in either Transitional HTML or XML formats. I find the default layout of the fancy template to be adequate.
Configuring Planet
If you don't want to customize the HTML or XML template files, there is only one configuration file that Planet uses. Navigate to the directory you created and then open up config.ini to edit it.
# cd itnews
# vim fancy/config.ini
The Planet section houses the basics, such as name, links, and ownership. The link is the address of the server that you are installing Planet on.
[Planet]
name = IT News
link = http://your_link.com
owner_name = Your Name
owner_email = you@your_email.com
Make sure that every configuration example using the path of the example's directory is changed to the directory that you created above. This will include the cache directory, the path to the template files, the output directory, and the link to the front page of the HTML file.
cache_directory = itnews/cache
template_files = itnews/fancy/index.html.tmpl itnews/atom.xml.tmpl itnews/rss20.xml.tmpl itnews/rss10.xml.tmpl itnews/opml.xml.tmpl itnews/foafroll.xml.tmpl
output_dir = itnews/output
[itnews/fancy/index.html.tmpl]
If you'd like to change the amount of days' worth of articles that are kept on the front page, then change the following parameter. The default is 7.
days_per_page = 7
At the very bottom of the config.ini file is where the feeds are placed that you want Planet to collect for you. There are four example links that you can base your RSS feeds off of. The only options that are necessary are the link and the name of the feed that you want displayed.
[http://rss.slashdot.org/Slashdot/slashdot]
name = Slashdot
[http://www.linux.com/feature/?theme=rss]
name = Linux.com
You can optionally add an image to the post or feed by using the face, facewidth, and faceheight options, but I'll leave that up to you to investigate. Use the examples for reference.
Once you're done adding RSS feeds, make sure to save the file.
The last configuration option I set up for myself was to make a symbolic link in the Web server directory, just to make the Web browsing experience easier. Your mileage may vary, but browse to your Web server root where Planet was unpacked.
# cd /var/www/html
# ln -s planet-2.0/itnews/output/ itnews
# ll
lrwxrwxrwx 1 root root 25 2008-01-18 21:37 itnews -> planet-2.0/itnews/output/
drwxr-xr-x 6 root root 4096 2008-01-18 20:59 planet-2.0
You'll see where the symbolic link comes in handy here shortly.
Running Planet
Now that you have your RSS feeds added, you can run Planet to build the links, output, and cache that you will browse to. Go back to the planet-2.0 directory and run the Planet script specifying where the configuration file is.
# /usr/bin/python planet.py itnews/fancy/config.ini
Once the script is done running, browse to your server using the symbolic link http://your_server/itnews, and you should see a screen similar to the figure below.
Figure 1: This is it! Planet in action! (Click image to enlarge.)
Automating Planet
The last step is to set up a cronjob to run Planet at a time you specify. I set up my script to run the RSS updates hourly from the Linux cron.hourly directory. To do that, create a script similar to this one.
# cd /etc/cron.hourly
# vim planet
#!/bin/bash
cd /var/www/html/planet-2.0
/usr/bin/python planet.py itnews/fancy/config.ini > /dev/null 2>&1
If you want to run the script at specified times, then take a look at scheduling the jobs to run with the Linux command crontab.
The Time Hack
You might have noticed that Planet's time from the Web page was listed in UTC time. For me, that's five hours ahead of what time is displayed on my server. I couldn't find an easy way to change the output format to reflect my time, so this little hack will change your time to the local time of your server.
# cd /var/www/html/planet-2.0/planet/
# vim __init__.py
Within this file, change every instance of gmtime that you find to localtime. After Planet runs, you'll see the time change to reflect your current time.
Personal News
Planet is perfect for setting up a news page for your IT department. This allows everyone internally to visit a single page to receive many news feeds externally. Don't allow Planet to stop you there, however, as you can easily customize and use Planet for your own personal interests as well. If it has an RSS feed, then Planet can grab it.
LATEST COMMENTS
MC Press Online