Difference between revisions of "Leafnode"

From SME Server
Jump to navigationJump to search
m
m (Some common formating done, more work required...)
 
Line 5: Line 5:
 
== Here we go: ==
 
== Here we go: ==
  
'''1)''' Firstly get your Leafnode, I used leafnode-1.11.6-1.i486.rpm the latest in April 2008 and the most recent of the version 1 series I could find. Pop that on to your SME Server somewhere and run:
+
<ol></li><li>Firstly get your Leafnode, I used leafnode-1.11.6-1.i486.rpm the latest in April 2008 and the most recent of the version 1 series I could find. Pop that on to your SME Server somewhere and run:
  
 
  rpm -ivh --nodeps leafnode-1.11.6-1.i486.rpm
 
  rpm -ivh --nodeps leafnode-1.11.6-1.i486.rpm
Line 13: Line 13:
 
Follow the instructions in the well commented /etc/leafnode/config to configure Leafnode to your upstream news server and preferences. Don't forget to do a ''fetchnews -f'' to force a fetch of the newsgroups your upstream server(s) carry.
 
Follow the instructions in the well commented /etc/leafnode/config to configure Leafnode to your upstream news server and preferences. Don't forget to do a ''fetchnews -f'' to force a fetch of the newsgroups your upstream server(s) carry.
  
'''2)''' Change directory to /var/service and make a new directory '''nntp'''.
+
</li><li>Change directory to /var/service and make a new directory '''nntp'''.
  
'''3)''' Change into the nntp directory and make the following directories '''control''', '''log''' and '''peers'''.
+
</li><li>Change into the nntp directory and make the following directories '''control''', '''log''' and '''peers'''.
  
'''4)''' Use your favourite editor to create the file '''run''' in the nntp directory with the contents:
+
</li><li>Use your favourite editor to create the file '''run''' in the nntp directory with the contents:
  
 
  #!/bin/sh
 
  #!/bin/sh
Line 37: Line 37:
 
Save the file and make it executable for owner, group and others - ''chmod a+x run''.
 
Save the file and make it executable for owner, group and others - ''chmod a+x run''.
  
'''5)''' Create a file called '''down''' in the nntp directory, no contents or special permissions. This file stops the runsvdir system starting the service automatically, so it has to be started via the SME process startup method, which takes into account the status setting of nntp in the configuration database.
+
</li><li>Create a file called '''down''' in the nntp directory, no contents or special permissions. This file stops the runsvdir system starting the service automatically, so it has to be started via the SME process startup method, which takes into account the status setting of nntp in the configuration database.
  
'''6)''' Change to the control directory and create a file named '''1''' with the contents:
+
</li><li>Change to the control directory and create a file named '''1''' with the contents:
  
 
  #!/usr/bin/perl -w
 
  #!/usr/bin/perl -w
Line 47: Line 47:
 
Make the file 1 executable by all - ''chmod a+x 1''.
 
Make the file 1 executable by all - ''chmod a+x 1''.
  
'''7)''' Change to the log directory and create a file named '''run''' with the contents:
+
</li><li>Change to the log directory and create a file named '''run''' with the contents:
  
 
  #!/bin/sh
 
  #!/bin/sh
Line 57: Line 57:
 
Make the file run executable by all - ''chmod a+x run''.
 
Make the file run executable by all - ''chmod a+x run''.
  
'''8)''' Change to the peers directory and create two empty files '''local''' and '''0''' (that's zero).
+
</li><li>Change to the peers directory and create two empty files '''local''' and '''0''' (that's zero).
 
Remove all permissions from the file 0 - ''chmod 0 0'' (both zeros).
 
Remove all permissions from the file 0 - ''chmod 0 0'' (both zeros).
 
Set the file local to all/read - ''chmod a+r local''.
 
Set the file local to all/read - ''chmod a+r local''.
 
These two files determine access rights when a connection request arrives.
 
These two files determine access rights when a connection request arrives.
  
'''9)''' Make the directory /var/log/nntp - ''mkdir /var/log/nntp''.
+
</li><li>Make the directory /var/log/nntp - ''mkdir /var/log/nntp''.
 
Change ownership and group to smelog - ''chown smelog: /var/log/nntp''.
 
Change ownership and group to smelog - ''chown smelog: /var/log/nntp''.
 
Remove permissions for others - ''chmod o-rwx /var/log/nntp''.
 
Remove permissions for others - ''chmod o-rwx /var/log/nntp''.
  
'''10)''' Add nntp to the SME configuration database with the command:
+
</li><li>Add nntp to the SME configuration database with the command:
  
 
  config set nntp service status enabled TCPPort 119 access private
 
  config set nntp service status enabled TCPPort 119 access private
Line 72: Line 72:
 
I'm not sure if the last two properties (TCPPort and access) are required by the internals of SME that I haven't investigated. I have simply included them for completness, most other services in the database have them.
 
I'm not sure if the last two properties (TCPPort and access) are required by the internals of SME that I haven't investigated. I have simply included them for completness, most other services in the database have them.
  
'''11)''' Now to automate news downloads and the house keeping. Make the directory tree /etc/e-smith/templates-custom/etc/crontab - ''mkdir /etc/e-smith/templates-custom/etc/crontab'' and change to that directory. Use your editor to create the file '''nntp''' with contents:
+
</li><li>Now to automate news downloads and the house keeping. Make the directory tree /etc/e-smith/templates-custom/etc/crontab - ''mkdir /etc/e-smith/templates-custom/etc/crontab'' and change to that directory. Use your editor to create the file '''nntp''' with contents:
  
 
  {
 
  {
Line 92: Line 92:
 
The Leafnode rpm contains an /etc/cron.daily/leafnode file that runs texpire during the normal execution of the cron.daily events.
 
The Leafnode rpm contains an /etc/cron.daily/leafnode file that runs texpire during the normal execution of the cron.daily events.
  
'''12)''' Create a symlink in /service to /var/service/nntp - ''ln -s /var/service/nntp /service/nntp''. Within 5 seconds the nntp process should be started. Try svstat /service/nntp and you should get a line giving you the status of nntp, some thing similar to:
+
</li><li>Create a symlink in /service to /var/service/nntp - ''ln -s /var/service/nntp /service/nntp''. Within 5 seconds the nntp process should be started. Try svstat /service/nntp and you should get a line giving you the status of nntp, some thing similar to:
  
 
  [root@testsrvr ]# svstat /service/nntp
 
  [root@testsrvr ]# svstat /service/nntp
 
  /service/nntp: down 1676 seconds
 
  /service/nntp: down 1676 seconds
  
'''13)''' Now to configure the SME boot process to start Leafnode on boot up. Change to the directory /etc/rc.d/rc7.d. Create a symlink from /etc/rc.d/rc7.d/S90nntp to /etc/rc.d/init.d/e-smith-service - ''ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S90nntp''. This ensures that nntp is not started unless it is enabled in the SME configuration database.
+
</li><li>Now to configure the SME boot process to start Leafnode on boot up. Change to the directory /etc/rc.d/rc7.d. Create a symlink from /etc/rc.d/rc7.d/S90nntp to /etc/rc.d/init.d/e-smith-service - ''ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S90nntp''. This ensures that nntp is not started unless it is enabled in the SME configuration database.
  
'''14)''' Change to /etc/rc.d/init.d/supervise and make a symlink from /etc/rc.d/init.d/supervise/nntp to ../daemontools - ''ln -s ../daemontools /etc/rc.d/init.d/supervise/nntp''.
+
</li><li>Change to /etc/rc.d/init.d/supervise and make a symlink from /etc/rc.d/init.d/supervise/nntp to ../daemontools - ''ln -s ../daemontools /etc/rc.d/init.d/supervise/nntp''.
  
'''15)''' Issue a signal-event reboot command and when the server comes back up leafnode should be running, login and check with svstat again:
+
</li><li>Issue a signal-event reboot command and when the server comes back up leafnode should be running, login and check with svstat again:
  
 
  [root@testsrvr ]# svstat /service/nntp
 
  [root@testsrvr ]# svstat /service/nntp

Latest revision as of 00:49, 5 May 2008

How to: Install Leafnode on SME 7

Leafnode is a usenet news server for small networks. This How To: is what I did to get it running as a service under SME 7.3 and is based on orginal installation done on SME 7.0rc1. It may or may not be "best practice" with regards how SME likes to do things. If there are errors or better ways please feel free to edit this wiki.

Here we go:

  1. Firstly get your Leafnode, I used leafnode-1.11.6-1.i486.rpm the latest in April 2008 and the most recent of the version 1 series I could find. Pop that on to your SME Server somewhere and run: rpm -ivh --nodeps leafnode-1.11.6-1.i486.rpm The --nodeps is to stop rpm complaining about the lack of xinetd, SME 7 does not use xinetd so this can be safely ignored. Yum doesn't have a --nodeps option so until such time as an SME version of the rpm becomes available that doesn't contain a dependancy for xinetd we can't use yum. Follow the instructions in the well commented /etc/leafnode/config to configure Leafnode to your upstream news server and preferences. Don't forget to do a fetchnews -f to force a fetch of the newsgroups your upstream server(s) carry.
  2. Change directory to /var/service and make a new directory nntp.
  3. Change into the nntp directory and make the following directories control, log and peers.
  4. Use your favourite editor to create the file run in the nntp directory with the contents: #!/bin/sh exec 2>&1 # Generate ACL files in ./peers ./control/1 exec /usr/local/bin/softlimit -m 10000000 \ tcpsvd \ -v \ -i ./peers \ -c ${CONCURRENCYREMOTE:-40} \ -C ${PER_IP_INSTANCES:-4}:'421 per host concurrency limit reached\r\n' \ -l ${LOCALNAME:-0} \ -u news \ ${LISTENIP:-0} \ ${PORT:-nntp} \ /usr/sbin/leafnode Save the file and make it executable for owner, group and others - chmod a+x run.
  5. Create a file called down in the nntp directory, no contents or special permissions. This file stops the runsvdir system starting the service automatically, so it has to be started via the SME process startup method, which takes into account the status setting of nntp in the configuration database.
  6. Change to the control directory and create a file named 1 with the contents: #!/usr/bin/perl -w use esmith::tcpsvd; esmith::tcpsvd::configure_peers('nntp'); Make the file 1 executable by all - chmod a+x 1.
  7. Change to the log directory and create a file named run with the contents: #!/bin/sh exec \ /usr/local/bin/setuidgid smelog \ /usr/local/bin/multilog t s5000000 \ /var/log/nntp Make the file run executable by all - chmod a+x run.
  8. Change to the peers directory and create two empty files local and 0 (that's zero). Remove all permissions from the file 0 - chmod 0 0 (both zeros). Set the file local to all/read - chmod a+r local. These two files determine access rights when a connection request arrives.
  9. Make the directory /var/log/nntp - mkdir /var/log/nntp. Change ownership and group to smelog - chown smelog: /var/log/nntp. Remove permissions for others - chmod o-rwx /var/log/nntp.
  10. Add nntp to the SME configuration database with the command: config set nntp service status enabled TCPPort 119 access private I'm not sure if the last two properties (TCPPort and access) are required by the internals of SME that I haven't investigated. I have simply included them for completness, most other services in the database have them.
  11. Now to automate news downloads and the house keeping. Make the directory tree /etc/e-smith/templates-custom/etc/crontab - mkdir /etc/e-smith/templates-custom/etc/crontab and change to that directory. Use your editor to create the file nntp with contents: { my $status = $nntp{status} || "disabled"; return "# nntp service is set to disabled or is missing from the configuration database.\n" unless ($status eq "enabled"); $OUT .= "\n"; $OUT .= "# Leafnode news server events\n"; $OUT .= "15\t*\t*\t*\t*\tnews\t/usr/sbin/fetchnews\n"; $OUT .= "\n"; # This will: # Download news at 15 minutes past every hour. } Watch the line wrap on the "return "# nntp..." line, it should be all one line. Expand the template expand-template /etc/crontab and check that /etc/crontab has the correct entries for running texpire and fetchnews. Cron will pick up the changes automatically. The Leafnode rpm contains an /etc/cron.daily/leafnode file that runs texpire during the normal execution of the cron.daily events.
  12. Create a symlink in /service to /var/service/nntp - ln -s /var/service/nntp /service/nntp. Within 5 seconds the nntp process should be started. Try svstat /service/nntp and you should get a line giving you the status of nntp, some thing similar to: [root@testsrvr ]# svstat /service/nntp /service/nntp: down 1676 seconds
  13. Now to configure the SME boot process to start Leafnode on boot up. Change to the directory /etc/rc.d/rc7.d. Create a symlink from /etc/rc.d/rc7.d/S90nntp to /etc/rc.d/init.d/e-smith-service - ln -s /etc/rc.d/init.d/e-smith-service /etc/rc.d/rc7.d/S90nntp. This ensures that nntp is not started unless it is enabled in the SME configuration database.
  14. Change to /etc/rc.d/init.d/supervise and make a symlink from /etc/rc.d/init.d/supervise/nntp to ../daemontools - ln -s ../daemontools /etc/rc.d/init.d/supervise/nntp.
  15. Issue a signal-event reboot command and when the server comes back up leafnode should be running, login and check with svstat again: [root@testsrvr ]# svstat /service/nntp /service/nntp: up (pid 3064) 764 seconds, normally down

    CONGRATULATIONS

    You now have a working Leafnode on your SME Server and news clients within your network should be able to connect to it for their news feed.