We need to add a few groups and a user which will be used by the email utilities.
groupadd -g 1 bin groupadd -g 2 kmemgroupadd -g 3 mailuseradd -u 1 -g bin -d /bin -s /bin/sh binThere are two directories used by the email sub system, thus we need to create them and give them the proper permissions.
/var/spool directory/var/spool/mqueue directory/var/spool/mail directorychmod 777 /tmpchmod 700 /var/spool/mqueuechmod 775 /var/spool/mailchgrp mail /var/spool/mail
makemake installmake install-suid
Build CC=/usr/gcc2723/bin/gccBuild installConfiguring Sendmail isn't as easily said as done. There are a lot of things you need to consider while configuring Sendmail and I can't take everything into account. That's why at this time we'll create a very basic and standard setup. If you want to tweak Sendmail to your own liking, go right ahead, but this is not the right article. You could always use your existing /etc/sendmail.cf (or /etc/mail/sendmail.cf) file if you need to use certain features.
cf/lfs.mc containing the following:
OSTYPE(LFS) FEATURE(nouucp) define(`LOCAL_MAILER_PATH', /usr/bin/procmail) MAILER(local) MAILER(smtp)
ostype/lfs.m4 by running touch ostype/lfs.m4m4 m4/cf.m4 cf/lfs.cf > cf/lfs.cf/etc/sendmail.cftouch /etc/aliasessendmail -v -bi
make *.c -o mailIgnore possible 'comparison between pointer and integer' and 'assignments makes integer from pointer without a cast' warnings. You'll probably get quite a few of these. Though, the program seems to work just fine nevertheless.
mailchgrp mail
/usr/bin/mailchmod 2755 /usr/bin/mail
/etc/init.d/sendmail containing the following:
#!/bin/sh
# Begin /etc/init.d/sendmail
check_status()
{
if [ $? = 0 ]
then
echo "OK"
else
echo "FAILED"
fi
}
case "$i" in
start)
echo -n "Starting Sendmail..."
start-stop-daemon -S -q -p /var/run/sendmail.pid \
-x /usr/sbin/sendmail -- -bd
check_status
;;
stop)
echo -n "Stopping Sendmail..."
start-stop-daemon -K -q -p /var/run/sendmail.pid
check_status
;;
reload)
echo -n "Reloading Sendmail configuration file..."
start-stop-daemon -K -q -s 1 -p /var/run/sendmail.pid
check_status
;;
restart)
echo -n "Stopping Sendmail..."
start-stop-daemon -K -q -p /var/run/sendmail.pid
check_status
sleep 1
echo -n "Starting Sendmail..."
start-stop-daemon -S -q -p /var/run/sendmail.pid \
-x /usr/sbin/sendmail -- -bd
check_status
;;
*)
echo "Usage: $0 {start|stop|reload|restart}"
exit 1
;;
esac
# End /etc/init.d/sendmail
chmod 755 /etc/init.d/sendmail
cd /etc/init.d/rc2.d; ln -s ../init.d/sendmail S20sendmail cd ../rc0.d; ln -s ../init.d/sendmail K20sendmail cd ../rc6.d; ln -s ../init.d/sendmail K20sendmail
My favorite email client is Mutt, so that's why we're installing this one. Feel free to skip the installation of Mutt and install your own favorite client. After all, this is going to be your system. Not mine.
If your favorite client is an X Window client (such as Netscape Mail) then you'll have to sit tight a little while till we've installed X.
configuremakemake install
configuremakemake installIt's time to test the email system now.
/usr/sbin/sendmail -bd (you need to start sendmail
using the full path. If you don't, you can't let sendmail reload the sendmail.cf
by with kill -1 <sendmail pid>).echo "this is an email test"
| mail -s test rootmail program and you should see your email there.useradd -m testuserecho "test mail to testuser"
| mail -s test testuser If this all worked just fine, you have a working email system for local email. It's not necessarily ready for Internet yet. You can remove the testuser by running userdel -r testuser