Search:  
Gentoo Wiki

HOWTO_Gentoo_and_INND


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Introduction

The purpose is to establish a working news server storing a limited number of newsgroups. Why? Well my ISP's newsgroup server has a fairly short message retention time frame, which causes me to miss some messages that I would rather have. This is not going to tell you how to setup a fully functioning news server, the idea is better retrieval, not full newsgroup discussion participation. This may (or may not) start you on your way, but don’t come to me when you can't post something to your news server for everyone to see, you'll wind up with an "I told you so" and a swift kick in the butt.

Getting Started

IMPORTANT NOTE: Commands are prefixed with a "#", lines in a file are prefaced with a "$"

The first thing we need to do is install our INND daemon. This isn’t as lengthy as compiling a windowing system, but still takes a healthy amount of time. Lets get up to date:

# emerge --sync

The whole reason we're here:

# emerge inn

The init script for innd is WRONG, and wont allow innd to start as is... so we change /usr/lib/news/bin/innd to /usr/lib/news/bin/inndstart in the /etc/init.d/innd file. Now... innd is REALLY picky with ownership on the file system so we need to setup the appropriate directory and file owners

# chmod u+s /usr/lib/news/bin/inndstart
# chown -R news:news /var/log/news/
# chown -R news:news /var/spool/news/

I know this is weird, but innd WILL NOT RUN unless /var/run is owned by the news user AND the news group

# chown news:news /var/run

Now a lot of the work that you do on the actual file and directory structure of your news server HAS TO BE DONE AS THE USER NEWS if you have the wrong ownership on the right files you WILL END UP WITH A BROKEN NEWS SERVER (again, ITYS). Unfortunately for us to be able to su to the user news we need to give it a real shell

# chsh -s /bin/bash news
# su news
# cd /var/spool/news/db

this file is not created by default, but is required to initialize innd's databases

# touch /var/spool/news/db/history

now we initialize said databases

# /usr/lib/news/bin/makedbz -i
# mv history.n.dir history.dir
# mv history.n.hash history.hash
# mv history.n.index history.index

First we give innd a hostname, and set the retention (in a number of days) for messages on the server

# nano -w /etc/news/inn.conf
$ domain: domain.com
$ artcutoff: 10

We then need to define how innd will store our messages This way seems easiest, there are many others, and they can be specified down to a per newsgroup basis, but both those topics are outside the scope of this document.

# nano -w /etc/news/storage.conf
$ method timehash {
$        newsgroups: *             
$        class: 1
$        size: 2,3200000
$ }

Next add any ip addresses you want to allow full access to the news server to the "localhost" section of readers.conf... I'm on a 10.* local network, thus I want those IP addresses to be able to read. Access control, users, passwords, etc, are beyond the scope of this document.

# nano -w /etc/news/readers.conf
$ auth "localhost" {           
$     hosts: "localhost, 127.0.0.1, stdin, 10.*"
$     default: "<localhost>"     
$ }

Now we exit the "news" user in favor of root and start innd

# exit
# /etc/init.d/innd start
# ps waux

The process listing should show /usr/lib/news/bin/innd -p4 running as the user news. If not, then something went wrong. Soon we're going to need some perl modules later on, so... lets get that out of the way now.

# perl -MCPAN -e shell

If you know what you are doing, and want to configure the CPAN module right now answer "yes" when asked "Are you ready for manual configuration? [yes]" or you can choose the easy way out and answer "no" which will simply go with some sensible defaults and let you get on with using the module. You only have to answer the question once.

# install Net::NNTP
# exit

Now we add each of our newsgroups-to-be into innd like so. (Where a.b.c is the name of the newsgroup we want to eventually be mirrored.)

# ~news/bin/ctlinnd newgroup a.b.c y root

Now we're going to make one /etc/news/pullnews-a.b.c file for each of the newsgroups we want mirrored, like so:

$ x.y.z
$        a.b.c

Where x.y.z is the hostname, or the IP address of your ISP's newsgroup server. And a.b.c is the name of the newsgroup we are mirroring. Almost done, only two steps to go... We make a script to pull all the new news from a group on a regular basis. This script will be called at startup, and will run in the background.

# nano -w /etc/news/pullnews-script
$ #! /bin/bash
$ DELAY=60        # The number, in seconds,
$        # you want to wait before
$        # re-syncing the groups again
$ while [ 1 ]
$  do
$   for i in `ls /etc/news/pullnews* | grep -v pullnews-script`
$    do
$     ~news/bin/pullnews -q -c $i 2>&1 1>/dev/null
$   done
$  sleep $DELAY
$ done
# chmod 751 /etc/news/pullnews-script
  

Now, finally, our init script

# nano -w /etc/init.d/pullnews
$ #!/bin/bash
$ /etc/news/pullnews-script &
# chmod 711 /etc/init.d/pullnews

Lets add both innd and our new pullnews script to the default runlevel (so they start every bootup) and run our pullnews init script

# rc-update add innd default
# rc-update add pullnews default
# /etc/init.d/pullnews
# ps waux

our process list should show something similar to the following:

news 14852 1.4 4.7 9472 5964 ? S 04:48 0:25 /usr/lib/news/bin/innd -p4
root 12372 0.6 0.8 2288 1084 pts/0 S 05:18 0:00 /bin/bash /etc/news/pullnews-script
root 2060 40.7 3.1 5012 3904 pts/0 S 05:18 0:00 pullnews

Congratulations. You’re done. Configure your newsgroup client to log into your local news server, and wait for the newsgroups to propagate. This will take a long time to happen, the first time since this pullnews a single threaded news puller it cannot get messages very fast. you also cannot mirror more then one newsgroup at a time due to the fact that pullnews will not allow multiple instances of itself. Alternatives are welcome and greatly appreciated.

mailto:apokalyptik@apokalyptik.com

Discussion

Original discussion can be found here

Retrieved from "http://www.gentoo-wiki.info/HOWTO_Gentoo_and_INND"

Last modified: Fri, 05 Sep 2008 10:06:00 +0000 Hits: 12,070