Next Previous Contents

14. Installing Internet Servers

In this section we're going to install three of the most used Internet servers, together with the necessary clients. These are going to be installed:

telnetd with the standard telnet client

proftpd with the standard ftp client

apache with lynx as client

14.1 Installing telnet daemon + client

14.2 Installing Proftpd

14.3 Installing Netkit-ftp

14.4 Installing Apache

Apache isn't that easily configured. Like with Sendmail, a lot depends on your own preference and system setup. Therefore, once I again I stick with a very basic installation. If this doesn't work well enough for you, read the documentation and modify whatever you need to.

14.5 Installing Slang Library

The Slang library is an alternative to the Ncurses library. We're going to use this library to link Lynx against. Though Lynx works fine with the Ncurses library, people recommend using the Slang library. I myself can't find a difference between a Lynx linked against the Slang library or against the Ncurses library. However, I'll just follow that advise and use Slang.

14.6 Installing Zlib

Zlib is a compression library, used by programs like PKware's zip and unzip utilities. Lynx can use this library to compress certain files.

14.7 Installing Lynx

14.8 Configuring the daemons

It's possible to run the daemons in either stand-alone mode or via the Internet Server daemon (inetd). Where possible, I choose to run the daemons in stand-alone mode. This makes it easier to start and stop individual processes without modifying the /etc/inetd.conf file constantly.

However, in the telnetd case it's better to run it via inetd, since telnetd doesn't seem to respawn itself when the last user logs out. This would mean as soon as the last person logs out from the telnet session, the telnet daemon stops as well. This isn't desirable, so we let telnetd run using inetd to spawn a telnet process whenever somebody logs on.

14.9 Configuring telnetd

Creating the /etc/inetd.conf configuration file

# Begin /etc/inetd.conf
 
telnet stream tcp nowait root /usr/sbin/in.telnetd
 
# End /etc/inetd.conf

Creating the /etc/init.d/inetd bootscript

#!/bin/sh
# Begin /etc/init.d/inetd
 
check_status()
{
  if [ $? = 0 ]
  then
    echo "OK"
  else
    echo "FAILED"
  fi
}
 
case "$1" in
  start)
    echo -n "Starting Internet Server daemon..."
    start-stop-daemon -S -q -p /var/run/inetd.pid \
         -x /usr/sbin/inetd
    check_status
    ;;
 
  stop)
    echo -n "Stopping Internet Server daemon..."
    start-stop-daemon -K -q -p /var/run/inetd.pid
    check_status
    ;;
 
  reload)
    echo -n "Reloading Internet Server configuration file..."
    start-stop-daemon -K -q -s 1 -p /var/run/inetd.pid
    check_status
    ;;
 
  restart)
    echo -n "Stopping Internet Server daemon..."
    start-stop-daemon -K -q -p /var/run/inetd.pid
    check_status
 
    sleep 1
 
    echo -n "Starting Internet Server daemon..."
    start-stop-daemon -S -q -p /var/run/inetd.pid \
        -x /usr/sbin/inetd
    check_status
    ;;
 
  *)
    echo "Usage: $0 {start|stop|reload|restart}"
    ;;
 
esac
 
# End /etc/init.d/inetd

Setting up permissions and symlinks

cd /etc/rc2.d; ln -s ../init.d/inetd S30inetd
cd ../rc0.d; ln -s ../init.d/inetd K30inetd
cd ../rc6.d; ln -s ../init.d/inetd K30 inetd

14.10 Configuring proftpd

Creating necessary groups and users

groupadd -g 65534 nogroup
groupadd -g 4 ftp

useradd -u 65534 -g nogroup -d /home nobody
useradd -u 4 -g ftp -m ftp

Creating the /etc/init.d/proftpd bootscript

#!/bin/sh
# Begin /etc/init.d/proftpd
 
check_status()
{
  if [ $? = 0 ]
  then
    echo "OK"
  else
    echo "FAILED"
  fi
}
 
case "$1" in
  start)
    echo -n "Starting Pro FTP daemon..."
    start-stop-daemon -S -q -x /usr/sbin/proftpd
    check_status
    ;;
 
  stop)
    echo -n "Stopping Pro FTP daemon..."
    start-stop-daemon -K -q -x /usr/sbin/proftpd
    check_status
    ;;
 
  restart)
    echo -n "Stopping Pro FTP daemon..."
    start-stop-daemon -K -q -x /usr/sbin/proftpd
    check_status
 
    sleep 1
 
    echo -n "Starting Pro FTP daemon..."
    start-stop-daemon -S -q -x /usr/sbin/proftpd
    check_status
    ;;
 
  *)
    echo "Usage: $0 {start|stop|restart}"
    ;;
 
esac
 
# End /etc/init.d/proftpd

Setting up permissions and symlinks

cd /etc/rc2.d; ln -s ../init.d/proftpd S40proftpd
cd ../rc0.d; ln -s ../init.d/proftpd K40proftpd
cd ../rc6.d; ln -s ../init.d/proftpd K40proftpd

14.11 Configuring apache

Editing apache configuration file

Edit the files in the /usr/apache/etc directory and modify them according to your own needs.

Creating /etc/init.d/apache bootscript

#!/bin/sh
# Begin /etc/init.d/apache
 
case "$1" in
  start)
    echo -n "Starting Apache HTTP daemon..."
    /usr/apache/sbin/apachectl start
    ;;
 
  stop)
    echo -n "Stopping Apache HTTP daemon..."
    /usr/apache/sbin/apachectl stop
    ;;
 
  restart)
    echo -n "Restarting Apache HTTP daemon..."
    /usr/apache/sbin/apachectl restart
    ;;
 
  force-restart)
    echo -n "Stopping Apache HTTP daemon..."
    /usr/apache/sbin/apachectl stop
 
    sleep 1
 
    echo -n "Starting Apache HTTP daemon..."
    /usr/apache/sbin/apachectl start
    ;;
 
  *)
    echo "Usage: $0 {start|stop|restart|force-restart}"
    ;;
 
esac
 
# End /etc/init.d/apache

Setting up permissions and symlinks

cd /etc/rc2.d; ln -s ../init.d/apache S50apache
cd ../rc0.d; ln -s ../init.d/apache K50apache
cd ../rc6.d; ln -s ../init.d/apache K50apache

14.12 Testing the daemons

The last step in this section is testing the just installed and configured daemons.

If these tests ran without trouble, the daemons are all working fine.


Next Previous Contents