📄 linux-mail-server-setup.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD><TITLE>Josh's Linux Guide - Setting Up a Mail Server</TITLE> <META NAME="Description" CONTENT="A beginner's guide on how to set up an e-mail server with Linux using POP3 and sendmail."> <META NAME="Keywords" CONTENT="beginners, Linux, help, mail, server, sendmail, POP3, IMAP"> <BASE TARGET="_top"></HEAD><LINK REL="stylesheet" TYPE="text/css" HREF="default.css"><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#7F007F"><H2><A NAME="0">Setting Up a Mail Server</A></H2><FONT SIZE="-1"><B>Last updated: September 17, 1999</B></FONT><BR><FONT SIZE="-1"><B>Development stage: Beta</B></FONT><BR><P>A mail server is a server that is running one or more of the following:an IMAP server, a POP3 server, a POP2 server, and an SMTP server. For now,I'm only going to cover installing IMAP4, POP3, and POP2, which all comein a single package. A few examples of SMTP servers are Sendmail (widelyused) and QMail (more secure and configurable). Sendmail is installed onmany Linux distributions by default so it might not be necessary at all toinstall it.</P><P>You may already have this installed on your system. As root, type<TT>which ipop3d</TT> and if it shows up, you don't need to read on unlessyou want to reinstall or perhaps to upgrade.</P><P>Download a file at <AHREF="ftp://ftp.cac.washington.edu">ftp.cac.washington.edu</A> called <AHREF="ftp://ftp.cac.washington.edu/mail/"><TT><B>imap-4.1.BETA.tar.Z</TT></B></A>.It's about 1.3 megabytes in size, so if you want to back it up on a floppydisk later on, go ahead. Remember also, the version might change, so justlook for a file in <TT>imap*.Z</TT> format. Also remember to set thetransfer mode in FTP to binary so that you don't download the entire fileas plain text. Do that by typing <TT>type binary</TT> or <TT>typeimage</TT> when you're logged into the FTP server. Also, downloading thefile from your web browser will probably automatically transfer it inbinary format.</P><P>Now, I'm assuming you've downloaded that archive already. If youhaven't already, place it in <TT>/usr/local/src/</TT> (or any directoryyou want, actually... but let me keep it simple) and extract it using<TT><B>tar -zxvf imap-4.1.BETA.tar.Z</B></TT>.</P><P>You should know by now that <B>imap-4.1.BETA.tar.Z</B> is only the namethat I use as an example. There probably will be different and newerreleases for that. Move into the directory it has extracted; in my case,that would be <TT>imap-4.1.BETA</TT>. Instead of just <TT><B>make</B></TT>from there on, you have to use <B>make lnx</B> to tell it how to set upthe compiling and file formats. The "lnx" stands for Linux, andif you're using some other Unix implementation, read "Makefile" to find out which abbreviation you should use. If you're using shadowpasswords on your server, you'll probably have to use <TT>make slx</TT>. Thanks to <A HREF="mailto:roth@gamgee.acad.emich.edu">Charles Roth</A> forfiguring out and sharing this information.</P><P>Once you run <TT><B>make lnx</B></TT> from the <TT>imap-4.1.BETA</TT>directory (and yes, it will change from time to time), all the binariesshould be compiled already and copied to <TT>/usr/sbin</TT>. The files itshould have produced are <B>imapd, ipop3d, and ipop2d</B>. Those filesshould also be in the subdirectories, <TT>imapd</TT> and <TT>ipopd</TT>after imap-4.1.BETA. Do 'which imapd' and a 'which ipop3d' and see ifthey're in <TT>/usr/sbin/</TT>. Remember to do this as root if you plan touse the machine as a mail server. :)</P><P>This should already be present, but if it's not, put it in. Make surethat somewhere in <TT>/etc/inetd.conf</TT>, there are lines that read:</P><PRE>pop-2 stream tcp nowait root /usr/sbin/tcpd ipop2dpop-3 stream tcp nowait root /usr/sbin/tcpd ipop3dimap stream tcp nowait root /usr/sbin/tcpd imapd</PRE><H3><A NAME="1">Common Problems</A></H3><P>Here's a common error that people face: when someone sends amessage to a user on your machine, the message is sent back to the senderand a copy of it is given to <TT>root</TT> also. This is what the errormessage looks like:</P><PRE> ----- The following addresses had permanent fatal errors -----<jgo@d67.local.net> ----- Transcript of session follows -----553 d67.local.net. config error: mail loops back to me (MX problem?)554 <jgo@d67.local.net>... Local configuration error</PRE><P>This was actually a <TT>sendmail</TT> configuration problem. I foundout on IRC that I had to add a line to <TT>/etc/sendmail.cf</TT> in thisformat: <TT><B>Cw<host.name.net></B></TT>. Even though I have adynamic (constantly changing/randomly assigned) IP address, it works. Ijust entered the whole range of my possible IP addresses at the end of<TT>/etc/sendmail.cf</TT> (you can put this anywhere in sendmail.cf, but Ijust decided to put it at the end of the file because of this habit that Ihave...). This is what the end of my <TT>/etc/sendmail.cf</TT> file lookslike:</P><PRE>Cwd50.local.netCwd51.local.netCwd52.local.netCwd53.local.netCwd54.local.net</PRE><P>... and so on. With those entries, I can accept incoming mail when I'md50.local.net through d54.local.net. You can also just put in all your IPaddresses and hostnames in <TT>/etc/sendmail.cw</TT>. I think that puttingthem in <TT>sendmail.cw</TT> in <TT>/etc/</TT> is much easier, not tomention more convenient, than putting it in <TT>sendmail.cf</TT>, since<TT>sendmail.cf</TT> is the main sendmail configuration file, which shouldbe kept free of clogging up.</P><P>More information on Sendmail can be accessed at <AHREF="http://www.sendmail.org">http://www.sendmail.org</A>. You can alsoorder the book written on it, featured there on the Sendmail site.</P><HR><P><B><FONT SIZE="-1">Copyright © 1997-1999 <AHREF="mailto:jgo@local.net">Joshua Go (jgo@local.net)</A>. All rightsreserved. Permission to use, distribute, and copy this document is hereby granted.You may modify this document as long as credit to me is given.</FONT></B></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -