Leafnode

| No Comments | No TrackBacks
Home: http://www.leafnode.org

一、  Ubuntu (7.10)下安装

参考了 http://www.emacs.cn/Gnus/Leafnode 和 http://learn.tsinghua.edu.cn:8080/2002315162/gnus_leafnode.html。

Ubuntu 7.10 有 leafnode 包(版本为最新稳定版 1.11.6)。通过Synaptic安装即可。

安装时网络连接方式我选择了 NONE,暂时手动 fetchnews。

/etc/cron.d/leafnode 抄了 http://learn.tsinghua.edu.cn:8080/2002315162/gnus_leafnode.html:
 # Cron entries for Leafnode
0-59/15 * * * * news if [ -x /etc/news/leafnode/do-fetch-news ];
then /etc/news/leafnode/do-fetch-news; fi


Ubuntu作为Debian系统,配置目录在 /etc/news/leafnode 下。
News spool目录为 /var/spool/news。

修改 /etc/hosts,设定hostname为 news.cyberhut.org。
(hosts里设置让我觉得怪异,我设置在 127.0.0.1 居然不行,里面本来有的 127.0.1.1 行中设置才可以。需要找时间研究下为什么。)

/etc/news/leafnode/config 中设置:
server = news.gmane.org
server = yaako.com

expire  = 20000
 (我准备用leafnoe作为新闻组的本地archive,所以不需要expire。设一个大的数字就可以了。2000天差不多等于54年)

initialfetch = 100

maxage = 20000 (原因和expire同)。


先通过 sudo fetchnews -vvv 把组列表取下来。
然后订阅一些组后,为了取下旧的文章,使用  sudo fetchnews -vvv -x 2000 (为了控制数据量。有些组因为文章数巨大,还需要加大 x 值直到把文章全部取下来。

在Gnus中设置nntp为localhost即可。

注:经过使用leafnode2,决定Ubuntu下也从源码安装leafnode。

Ubuntu源码安装需要先安装 libpcre3-dev包,通过 synaptic,apt-get或者aptitude安装即可。
安装很简单,不过为了使用ubuntu安装已经建立的配置目录和文件,configure时候使用sysconfdir指定原来目录。
./configure --sysconfdir=/etc/news/leafnode (--prefix=/usr/local)
make
sudo make install

然后修改 /etc/inetd.conf, 将leafnode路径修改为  /usr/local/sbin/leafnode。

leafnode2 中有些配置从config中挪到了filters中,作相应修改即可。
由于本地存储文件格式的变化,需要运行一次以下命令来更新格式:
sudo fetchnews -f


二、 MacOSX 下安装
Mac Mini G4 (MacOSX 10.4.10 PPC)

MacOSX下的安装配置本以为很简单,结果发现不是。主要参考 http://www.kutilek.de/technik/news-macosx.en.php (万分感谢,否则我还搞不定)。

由于 Macports 里没有 leafnode,只能通过源码自己安装。于是我选择了安装 leafnode 2 ( http://www.dt.e-technik.uni-dortmund.de/~ma/leafnode/beta/ ),所用为最新的 snapshot 2.0.0.alpha 20070602a

由于/usr/local/ 已经交给 Macports,我就直接选择安装进 /usr。
所需的 pcre 已经通过 Macports 安装。

需要建用户 news,通过控制面板中的 Accounts 增加一个用户 news即可。没有这个news用户,configure会失败。

安装:
./configure --prefix=/usr --sysconfdir=/Library/Leafnode --enable-spooldir=/private/var/spool/news
make
sudo make install-strip (现在的snapshot中不是 strip-install)

进入 /Library/Leafnode,cp config.example config,然后编辑 config:
sudo emacs config

主要设置和上面Ubuntu提到的差不多。 leafnode2中config文件结构有变化。server设置在global设置之后。

hostname没有向参考文章中一样在config设置,而是通过系统端。这也是leafnode FAQ中所建议的。

由于我家中 Mac使用ADSL上网,MacOSX 从10.4.6开始hostname改成自动设置(PPPOE连接后自动获取),这对leafnode运行造成麻烦。

MacOSX下像 GNU/Linux一样通过修改/etc/hosts设置是无效的。必须修改 /etc/hostconfig,将
HOSTNAME=~AUTOMATIC~
修改为
HOSTNAME=home.cyberhut.org

设置leafnode运行方式,使用Tiger所建议的Launch Daemon 方式,在 /Library/LaunchDaemons下建立
org.cyberhut.home.leafnode.plist,内容如下:





Label
org.cyberhut.home.leafnode
Program
/usr/sbin/leafnode
ProgramArguments

/usr/sbin/leafnode

Sockets

Listeners

SockServiceName
nntp


UserName
news
inetdCompatibility

Wait




我没有参照参考文章设置bonjour。

然后装载并启动leafnode:


sudo launchctl load /Library/LaunchDaemons/org.cyberhut.home.leafnode.plist
sudo launchctl start org.cyberhut.home.leafnode

现在用手动方式运行fetchnews,需要研究下如何使用 launchd 来定期运行fetchnews,或者通过crontab设置运行。

3 使用

由于 leafnode 本身带filter功能,对spam的过滤就直接交给了leafnode,这样在Gnus中就不需要spam处理了,因此相关的score设置,spam.el设置及相关文件就可以全部去掉了。

filter设置在 /etc/news/leafnode (Ubuntu)或 /Library/Leafnode(MacOSX下根据上文安装)下,文件名为 filters。

因为主要阅读gmane.×,对gmane组设置:

newsgroups = gmane\..*
pattern = ^Newsgroups:.*gmane\.spam\.detected
action = kill

这样对gmane服务器已经确认的spam就可以kill掉了。这基本可以对付gmane中大多数的垃圾。
本地leafnode的巨大好处是可以将这些spam完全杀掉,包括从本地spool里删除。

对相关组已经取到本地的文章进行过滤:

sudo applyfilter -vvv gmane.group.name

以后对其它特征的spam加入过滤规则,然后手动applyfilter,就可以在本地建立一个洁净的新闻组服务器了。

No TrackBacks

TrackBack URL: http://cyberhut.org/mt/mt-tb.cgi/26

Leave a comment

About this Entry

This page contains a single entry by cg published on October 12, 2007 12:05 PM.

中华书局历代史料笔记丛刊 was the previous entry in this blog.

Gnus+MSMTP实现多账号邮件发送 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.