Saturday, 19 November 2016

Leafnode News Server

Following on with my setting up of a Raspberry Pi as a Newsgroup Indexer, I've realised that the next big issue is with news servers themselves. I don't really want a load of newsgroup just a few with a reasonable retention. Some of the paid for servers are suffering from missing posts so I've decided to use a Raspberry Pi with a 500GB drive in it and set up my own. If it works well, I'll eventually add on a bigger drive.

I've installed Raspbian Lite and mounted the external drive at /var/news, one problem is that the drive doesn't seem to mount at boot, this has been fixed by modifying the cmdline.txt file, run:

sudo nano /boot/cmdline.txt

And add rootdelay=5 to the end.

Once you've done all that let's bring the machine up to date with:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove

and then restart it with:

sudo shutdown -r now

Once it's rebooted, installation is fairly straightforward with:

sudo apt-get install leafnode

You get asked to enter the details of a news server, I've got Virgin Media here so it's and a permanent connection.

Then the fun begins, you're going to need to edit your hosts file with:

sudo nano /etc/hosts

Edit the line that says machinename

so that it shows nachinename.domain machinename

You can't use localdomain here, so just put your Samba workgroup domain in, then we need to edit another two files so we can connect on the local network:

sudo nano /etc/hosts.allow

#-- leafnode begin
#-- leafnode end

Edit this so it looks like

#-- leafnode begin
#-- leafnode end

Changing the to whatever your IP address range is and then:

sudo nano /etc/hosts.deny

#-- leafnode begin
leafnode: ALL
#-- leafnode end

Comment out the middle line so it looks like this:

#-- leafnode begin
# leafnode: ALL
#-- leafnode end

Now it's time to fetch a list of newsgroups:

sudo fetchnews -vvv

You can now connect to the server with news reader, I'm going to use Pan but there are loads out there, this is how you do it with Pan

Subscribe to a newsgroup and then go and request the latest headers, this will only give one leafnode entry at the moment, now we want to change some settings before we go any further, just enter:

sudo nano /etc/news/leafnode/config

I'm going to change the expire entry at the top to 400, that's just over a year

Going down the screen I'm changing the initial fetch to 1000, keep going down the screen and set maxfetch to 2000, maxcrosspost to 10 and maxage to 1000. If you're on a slow connection it may be worth you dropping some of these settings

We then run:

sudo fetchnews -vvv

This time it will populate the group(s)

You may find that your current news server doesn't hold all the groups you want so you can edit the leafnode config file again and add some other servers in, here's some you can add in;;

server =
username = username
password = password

You can sign up for a free account with XSUsenet by following this link.

# Free Servers

server =

server =

server =

server =

Now run sudo fetchnews -vvv again and it will pull down a list of groups from these servers, make sure that you ask your usenet client to refresh the groups list.

Last thing we have to do is make it update the groups by itself, there is a file in the leafnode folder that you can use but I've done it this way and it works for me:

sudo nano /bin/getnews

Paste the following into it:

texpire -v
fetchnews -vvv

Let#s make it executable with:

sudo chmod +x /bin/getnews

And we'll get cron to run this every 15 minutes with:

sudo crontab -e

Paste this into it:

*/15 * * * * /bin/getnews

Then save it, give it a final reboot and you're all sorted, you're very own news server. You can't add a username and password for access as far as I'm aware so it's not a good idea to make it accessible from the Interwebs.

If you reboot at some point the lockfile may stop leafnode updating, I've created another file called clearlock with:

sudo /bin/clearlock

This goes into it:

rm /var/spool/news/leaf.node/lock.file 

Again, we make it executable with:

sudo chmod +x /bin/clearlock

And we make it run on boot with:

sudo crontab -e

Paste this in.

@reboot /bin/mtclearlock

And we're all done

No comments:

Post a comment