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
configure --with-c-compiler=/usr/gcc2723/bin/gcc
--with-c++-compiler=/usr/gcc2723/bin/c++makemake install
make CC=/usr/gcc2723/bin/gccmake install
configuremake CC=/usr/gcc2723/bin/gccmake installApache 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.
make CC=/usr/gcc2723/bin/gccmake installThe 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.
configuremake ELF_CC=/usr/gcc2723/gcc elfmake CC=/usr/gcc2723/bin/gcc install-elfmake install-linksZlib is a compression library, used by programs like PKware's zip and unzip utilities. Lynx can use this library to compress certain files.
configuremakemake install
configure --libdir=/etc --with-zlib --with-screen=slangmake CC=/usr/gcc2723/bin/gccmake installmake install-helpmake install-docIt'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.
/etc/inetd.conf containing the following:
# Begin /etc/inetd.conf telnet stream tcp nowait root /usr/sbin/in.telnetd # End /etc/inetd.conf
/etc/init.d/inetd containing the following:
#!/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
chmod 755 /etc/init.d/inetd
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
groupadd -g 65534 nogroup groupadd -g 4 ftp
useradd -u 65534 -g nogroup -d /home nobody useradd -u 4 -g ftp -m ftp
/etc/init.d/proftpd containing the following:
#!/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
chmod 755 /etc/init.d/proftpd
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
Edit the files in the /usr/apache/etc directory and modify them according to your own needs.
httpd.conf file and find the variable: Group
/etc/init.d/apache containing the following:
#!/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
chmod 755 /etc/init.d/apache
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
The last step in this section is testing the just installed and configured daemons.
/etc/init.d/inetd
starttelnet localhost/etc/init.d/proftpd startftp localhost/etc/init.d/apache startlynx http://localhostIf these tests ran without trouble, the daemons are all working fine.