10. Install of qmail (Mail Server)

Solaris, Linux:

# mkdir /var/qmail
# groupadd nofiles
# useradd -g nofiles -d /var/qmail/alias alias
# useradd -g nofiles -d /var/qmail qmaild
# useradd -g nofiles -d /var/qmail qmaill
# useradd -g nofiles -d /var/qmail qmailp
# groupadd qmail
# useradd -g qmail -d /var/qmail qmailq
# useradd -g qmail -d /var/qmail qmailr
# useradd -g qmail -d /var/qmail qmails

FreeBSD:

# mkdir /var/qmail
# pw groupadd nofiles
# pw useradd alias -g nofiles -d /var/qmail/alias -s /noexistent
# pw useradd qmaild -g nofiles -d /var/qmail -s /noexistent
# pw useradd qmaill -g nofiles -d /var/qmail -s /noexistent
# pw useradd qmailp -g nofiles -d /var/qmail -s /noexistent
# pw groupadd qmail
# pw useradd qmailq -g qmail -d /var/qmail -s /noexistent
# pw useradd qmailr -g qmail -d /var/qmail -s /noexistent
# pw useradd qmails -g qmail -d /var/qmail -s /noexistent
# tar zxvf qmail-1.03.tar.gz
# cd qmail-1.03
# patch < ../qmail-date-localtime.patch
# patch < ../qmail-smtpd-relay-reject
# make setup check
# ./config
(DNS :
   ./config-fast hostname.your.domain 
# cd ~alias
# touch .qmail-postmaster .qmail-mailer-daemon .qmail-root .qmail-default
# chmod 644 .qmail*
% maildirmake $HOME/Maildir
% echo ./Maildir/ > ~/.qmail
# cp /var/qmail/boot/home /var/qmail/rc
# echo to: mylogin | /var/qmail/bin/qmail-inject
#!/bin/sh
test -x /var/qmail/rc || exit 0
case "$1" in
  start)
     echo -n "Starting qmail: "
     sh -cf '/var/qmail/rc &'
     echo "qmail."
     ;;
  stop)
     echo -n "Stopping qmail: "
     pid=`/usr/bin/ps -e | /usr/bin/grep qmail | /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
     if test "$pid"
     then
	 kill $pid
     fi
     echo "qmail."
     ;;
  restart)
     echo -n "Restarting qmail: "
     $0 stop
     $0 start
     echo "qmail."
     ;;
  *)
     echo "Usage: /etc/init.d/qmail {start|stop|restart}"
     exit 1
esac
exit 0
#!/bin/sh
#
# qmail: /var/qmail
PATH=/var/qmail/bin:/usr/local/bin:/bin:/usr/bin
[ -f /var/qmail/rc ] || exit 0
case "$1" in
  start)
	# Start daemons.
	echo "Starting qmail."
	#csh -cf '/var/qmail/rc &'
	sh -cf '/var/qmail/rc &'
	tcpserver -v -u 503 -g 502 -x /etc/tcp.smtp.cdb \
		0 smtp /var/qmail/bin/qmail-smtpd 2>&1 | /var/qmail/bin/splogger smtpd 3 &
	tcpserver -v 0 pop3 /var/qmail/bin/qmail-popup po.yui.mine.nu /usr/local/bin/ch_pass \
	/var/qmail/bin/qmail-pop3d Maildir 2>&1 \
		| /var/qmail/bin/splogger pop3d 3 &
	echo
	touch /var/lock/qmail
	;;
  stop)
	# Stop daemons.
	echo "Shutting down qmail."
	PID=`/bin/ps -aefw | grep qmail | awk '{print $2}'`
	if [ ! -z "$PID" ] ;  then
		/bin/kill ${PID} 1> /dev/null 2>&1
	fi
	echo
	rm -f /var/lock/qmail
	;;
  restart)
	# Restart daemons.
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: qmail {start|stop|restart}"
	exit 1
esac
exit 0