Sun 22 Oct 2006
Installing xinetd
Posted by Richard under Configuration , Installation , Software , Westhost1 Comment
- Download source from xinetd The current version is 2.3.14, so the command to download it is wget http://xinetd.org/xinetd-2.3.14.tar.gz.
- Unzip the file using the command gunzip -c xinetd-2.3.14.tar.gz|tar x and change into the directory this creates (cd xinetd-2.3.14)
- Configure it using the command ./configure --prefix=/usr/mylocal >log.config 2>err.config
- Check err.config for any errors
- Build the source code using the command make >log.make 2>err.make
- Check err.make for errors
- Install the package using the command make install >log.install 2>err.install
- Check err.install for any errors
- Now create the configuration file for the services you want to run using the command pico /etc/xinetd.conf. It should look something like this example:
C:
-
# Configuration file for xinetd
-
#
-
-
defaults
-
{
-
instances = 25
-
log_type = FILE /var/log/xinetd
-
log_on_success = HOST PID
-
log_on_failure = HOST
-
}
-
-
#service imapd
-
#{
-
# socket_type = stream
-
# wait = no
-
# user = vuser
-
# server = /usr/local/sbin/imapd
-
# log_on_failure += USERID
-
#}
-
-
#service imaps
-
#{
-
# socket_type = stream
-
# wait = no
-
# user = vuser
-
# server = /usr/local/sbin/imapd
-
# log_on_failure += USERID
-
#}
-
-
## rsyncd can't run on 873/tcp because WestHost's own backup
-
## tools are running there.
-
#service rsync-alt
-
#{
-
# disable = no
-
# type = UNLISTED
-
# port = 8730
-
# socket_type = stream
-
# wait = no
-
# user = vuser
-
# server = /usr/local/bin/rsync
-
# server_args = --daemon
-
# log_on_failure += USERID
-
#}
Replace vuser with your user name
-
- Test your installation of xinetd by typing /usr/mylocal/sbin/xinetd -d. Fix any errors. If there are none, then terminate the daemon using Control-X
- Create the file /etc/rc.d/init.d/xinetd which will be used to start and stop the xinetd task using the command pico /etc/rc.d/init.d/xinetd
C:
-
#!/bin/bash
-
#
-
# Startup script for the xinetd server
-
#
-
# chkconfig: - 86 14
-
# description: xinetd
-
# processname: xinetd
-
# pidfile: /var/run/xinetd.pid
-
# config: /etc/xinetd.conf
-
-
# Source function library.
-
. /etc/rc.d/init.d/functions
-
-
xinetd=/usr/mylocal/sbin/xinetd
-
prog=xinetd
-
RETVAL=0
-
-
start() {
-
echo -n $"Starting $prog: "
-
pidfile=/var/run/xinetd.pid
-
pid=`cat $pidfile 2>/dev/null`
-
[ "$pid" ] && \
-
[ "`find /proc/${pid}/exe -printf '%l%U\n' 2>/dev/null |
-
awk -F'/' '{print $NF}'`" != "xinetd`id -u`" ] && \
-
/bin/rm -f $pidfile
-
daemon $xinetd
-
RETVAL=$?
-
echo
-
[ $RETVAL = 0 ] && touch /var/lock/subsys/xinetd
-
return $RETVAL
-
}
-
stop() {
-
echo -n $"Stopping $prog: "
-
killproc $xinetd
-
RETVAL=$?
-
echo
-
if [ $RETVAL = 0 ] ; then
-
rm -f /var/lock/subsys/xinetd /var/run/xinetd.pid
-
pid=`pidof -o $$ -o $PPID -o %PPID -x ${xinetd} || pidof -o $$ -o $PPID -o %PPID -x ${prog}`
-
if [ "$pid" ] ; then
-
killproc $xinetd
-
RETVAL=$?
-
fi
-
fi
-
}
-
reload() {
-
echo -n $"Reloading $prog: "
-
killproc $xinetd -HUP
-
RETVAL=$?
-
echo
-
}
-
-
# See how we were called.
-
case "$1" in
-
start)
-
start
-
;;
-
stop)
-
stop
-
;;
-
status)
-
status $xinetd
-
RETVAL=$?
-
;;
-
restart)
-
stop
-
start
-
;;
-
condrestart)
-
if [ -f /var/run/xinetd.pid ] ; then
-
stop
-
start
-
fi
-
;;
-
reload)
-
reload
-
;;
-
*)
-
echo $"Usage: $prog
-
{start|stop|restart|condrestart|reload|status}"
-
exit 1
-
esac
-
-
exit $RETVAL
-
- Make this file executable by using chmod u+x /etc/rc.d/init.d/xinetd
- Create the links Snnxinetd and Knnxinetd in /etc/rc.d/rc2.d so that xinetd will start and stop whenever you restart and shutdown your VPS. Choose suitable unique numbers for nn. Packages are started and stopped in ascending order. I chose nn=100.
- ln -s /etc/rc.d/init.d/xinetd /etc/rc.d/rc2.d/S100xinetd
- ln -s /etc/rc.d/init.d/xinetd /etc/rc.d/rc2.d/K100xinetd


January 17th, 2007 at 12:07 pm
[...] Any packages which are not required all the time should be started and stopped from a daemon such as xinetd or inetd in order to reduce the loading on the CPU processor and memory. Tasks which are required to run on a periodic basis should be run by cron. [...]