Centos6

From The DXSpider Documentation Wiki
Jump to navigation Jump to search

Introduction

Centos is a community rebuild of Redhat enterprise linux (RHEL) and the instructions given here will also work for other modern redhat based linux distributions such as RHEL,Scientific Linux, Fedora Linux

Centos is an excellent choice of linux distribution to run DXSpider on. 

RHEL (& by extension Centos) is supported for ten years from it's release date, the Centos 6.x series will be supported until 2020.


Installing Dxspider on centos version 6.x

See Centos5 notes for centos 5.x versions

centos7 notes

starting from a basic 'bare bones' server install that is up to date

Some notes before we begin.

commands starting with

# 

are carried out as the root user

$ 

are carried out as the sysop user


Selinux is by default enabled and there is no need to disable it for running a telnet DXSpider node.

yum is the package manager

to update the system use

# yum update

to install package 'foo'

# yum install foo

Package Installation

as the root user install the additional package repository EPEL, this is required for perl-Curses

see http://fedoraproject.org/wiki/EPEL/FAQ#What_is_EPEL.3F

instructions here

http://fedoraproject.org/wiki/EPEL/FAQ#How_can_I_install_the_packages_from_the_EPEL_software_repository.3F

as of 2012/03/12 the command is

# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm

install needed packages

# yum install perl-TimeDate perl-Time-HiRes perl-Digest-SHA1 perl-Curses perl-Net-Telnet git gcc make

if you intend using the vi text editor you may wish to install vim which extends the basic vi editor features

# yum install vim

if you prefer to use the nano editor (probably the best choice for beginners)

# yum install nano

if you prefer the emacs editor

# yum install emacs

Configuring The User And Group

Now create the sysop user

# adduser -m sysop
# passwd sysop

Choose a strong password here!

yes I know that /home/sysop/spider we are about to link to does not exist yet but the plan is to use git to pull it in as the sysop user a bit later and we are root right now. Doing it in this order does not break anything.

# ln -s ~sysop/spider /spider

before adding the spider group it is advisable to check that group # 251 is not already in use

# cat /etc/group |grep 251

Which should produce no output, if 251 is already assigned to a group choose a different group Number here, On Redhat based distributions Group numbers below 500 are assigned to system services so choose a free group number below 500

# groupadd -g 251 spider

Use the following commands to add the users to the spider group

# usermod -aG spider sysop
# usermod -aG spider root

Getting The Latest Version Of DXSpider

Change to user sysop

# su - sysop

use git to get latest DXspider build

$ git clone git://scm.dxcluster.org/scm/spider

Fix up permissions (AS THE SYSOP USER )

Very bad things happen if you run these as root and in the wrong place, so I wish to make it abundantly clear that these are to be run as the sysop user in the sysop's home directory /home/sysop

$ chown -R sysop.spider spider
$ find . -type d -exec chmod 2775 {} \;
$ find . -type f -exec chmod 775 {} \;

Cluster Configuration

We are installed, now to configure the cluster

$ cd /spider
$ mkdir local
$ mkdir local_cmd
$ cp perl/DXVars.pm.issue local/DXVars.pm
$ cd local
$ vi DXVars.pm (or your favourite editor)

Using the distributed DXVars.pm as a a template, set your cluster callsign, sysop callsign and other user info to suit your own environment.

$mycall = "GB7DJK";     

This is the call sign of your cluster. Here in the UK we have separate callsigns for our cluster nodes. If you can't use a different callsign I suggest you use an SSID of '-2' for the node callsign '$mycall'.

$myalias = "G1TLH";

This is the sysop user callsign, normally your own.

PLEASE USE CAPITAL LETTERS FOR CALLSIGNS

Note that this a perl file which will be parsed and executed as part of the cluster. If you get it wrong then perl will complain when you start the cluster process. It is important only to alter the text of any section. Some of the lines look a little odd. Take this line for example ....

$myemail = "ianmaude\@example.com";

There appears to be an extra slash in there. However this has to be there for the file to work so leave it in.

DON'T alter any file in /spider/perl, they are overwritten with every release. Any files or commands you place in /spider/local or /spider/local_cmd will automagically be used in preference to the ones in /spider/perl EVEN while the cluster is running!

Save the new file and change directory to ../perl ....

$ cd ../perl

Now type the following command which creates the basic user file with you as the sysop.

$ ./create_sysop.pl

Compile the Client program

$ cd /spider/src
$ make

Internet Access

Now set up your cluster so that it is available from the internet

you need to copy the file /spider/perl/Listeners.pm to /spider/local and then edit it. You will need to uncomment the line containing "0.0.0.0" and select the correct port to listen on.

$ cp /spider/perl/Listeners.pm  /spider/local/

edit /spider/local/Listeners.pm

It comes out of the box looking something like:-

 @listen = (
#    ["0.0.0.0", 7300],
);

Change it so that it looks like this:-

 @listen = (
   ["0.0.0.0", 7300],
);

Later versions have more comments in the Listeners.pm file that are designed to help you remove the correct '#' character.

As standard, the listener will listen on all interfaces simultaneously. If you require more control than this, you can specify each interface individually:-

 @listen = (
   ["gb7baa.dxcluster.net", 7300],
   ["44.131.16.2", 6300],
);

This will only be successful if the IP addresses on each interface are static. If you are using some kind of dynamic IP addressing then the 'default' method is the only one that will work.

Restart the cluster.pl program to enable the listener.

Firewall Configuration

This might be a good time to modify the default firewall to allow connections to the cluster on port 7300 (or other port of your choosing)

as root edit /etc/sysconfig/iptables add the line

-A INPUT -m state --state NEW -m tcp -p tcp --dport 7300 -j ACCEPT

Just after the line permitting ssh on port 22 and before the REJECT rules

restart iptables

#service iptables restart

Service Configuration

whilst you are still root, now might be a good time to configure the cluster to auto-start

In this regard there are differences between the way that centos 5.x and 6.x handle startups

6.x uses upstart so we need to create an upstart configuration

create the following file /etc/init/dxspider.conf

# This service kicks off the DXspider cluster 

start on stopped rc RUNLEVEL=[3]
stop on starting runlevel [016]

respawn
respawn limit 10 5
exec /bin/su -c "/usr/bin/perl -w /spider/perl/cluster.pl" sysop >/dev/tty7

now start the cluster

#start dxspider

Should you need to stop it

#stop dxspider 

will do the trick

change back to the sysop user

#su - sysop

Cluster Peers

create a connect script to connect to your peer node(s)

to do this create a new connect script for your chosen peer in /spider/connect/ One entry per peer

$cd /spider/connect

Next create a connect script to bring up connections, here I use the vi editor but you can also use nano

$vi ei7mre

my script looks like this, be sure to change the connect line to telnet to you peer node and the 'Login' line to your own cluster callsign

timeout 15
connect  telnet mayodx.ath.cx 7300
'Login' 'ei7tst'


now use the cluster console to set up the peer node as a dxspider node

$ /spider/perl/console.pl

issue

set/spider <peer call as used for connect script>

(in my exmaple: set/spider ei7mre ) now connect

connect ei7mre

Crontab

Tidying up

you will want your cluster to automatically connect to your peer node(s)

create a file called crontab in /spider/local_cmd

$cd /spider/local_cmd

with an entry like

* * * * * start_connect('ei7mre') unless connected('ei7mre')


This will cause the cluster to attempt to connect to ei7mre unless already connected, once per minute using the connect script file that was created earlier

IPv6 Support

Assuming you have IPv6 connectivity.

Dxspider supports IPv6 but you need to install the 'IO::Socket::INET6' perl module first

# yum install perl-IO-Socket-INET6

Now configure the /spider/local/Listeners.pm file

replace the line 
["0.0.0.0", 7300]
with
["::", 7300]

restart dxspider and it will be listening for IPv4 and IPv6 connections

you will need to add a firewall rule to /etc/sysconfig/ip6tables to allow inbound cluster connections

add the following just after the ssh rule and before the REJECT rules

-A INPUT -m state --state NEW -m tcp -p tcp --dport 7300 -j ACCEPT

restart ip6tables

# service ip6tables restart

Other Things

run the NTP service to keep the clock accurate

First install NTP

# yum install ntp

Configure NTP to start at boot

# chkconfig ntpd on

Start the service

# service ntpd start

you can check all is well by querying the NTP service

#ntpdc -pn