| FAST BUILD BOXES |
| IN A BOX |
like this |
| like this |
| like this |
shutdown -r -F now and let it reboot.
When it starts back up it will run "fsck" which is the conceptual equivalent
of "chkdsk /f" in the Windows world.
Ghost 2003 comes with SystemWorks 2003 or often comes with
motherboard software. Ghost 2003 also works in (the recommended) normal mode
but after the disk is cloned the boot record must be repaired on the
cloned drive by first booting to a rescue floppy.
There is other software out there that has the ability
to clone Linux hard drives. I’m just used to Ghost.
shutdown -r -F now to repair
any potential problems.
|
For future reference:
http://www.us.debian.org/releases/sarge/debian-installer/ http://www.debian.org/distrib/netinst http://www.debian.org/releases/stable/i386/ch04s02.html.en |
| Make a new directory on your Windows computer and call it 'debian' or
something. Then download the latest version of the Debian installer for "Sarge" and save it there. Go to: http://cdimage.debian.org/debian-cd/3.1_r2/i386/iso-cd/debian-31r2-i386-netinst.iso for the Debian 3.1 (Sarge, Stable) network installation CD, which I recommend. |
|
We are going to erase the hard drive so make sure you don't
have any data on it you might need.
Boot up the computer using the Installer CD or the Installer floppy #1. If you use the floppy to boot up, it will prompt you for the second floppy. I recommend the CD-ROM. The instructions below pertain to the CD-ROM method in the default "ask as few questions as possible" mode. To install the recommended 2.6.x version of the Linux kernel, type in: linux26 |
| [Choose Language] This determines the language of the installer and picks a keyboard. This installation has only been tested with English - English |
| [Choose country or region] Choose what is appropriate |
| Unplug the Ethernet cable, we want DHCP to fail. |
| [Select a keyboard layout] American English selects a standard qwerty keyboard |
| [Module needed by your ethernet card] |
| [!! Configure the network]
Network autoconfiguration failed We wanted this to happen, simply press: [Continue] On the next screen, choose the default of: [Configure network manually] |
| [Configure the network] Plug the Ethernet cable back in (and make sure Num Lock is on!) [IP address:] 111.111.111.111[Netmask:] 255.255.255.x[Gateway:] 333.333.333.333[Name server addresses:] 444.444.444.444 555.555.555.555[Hostname:] sfa[Domain name:] example.com
|
| [!! Partition disks] Choose [Erase entire disk] [Partitioning scheme:] You are free to choose any of the three partitioning schemes provided but we need at least 1GB of space for each data partition. If you choose the [Desktop machine] or [Multi-user workstation] method of partitioning, ideally you would have 4GB or more for either the /var partition or the /var/spool partition respectively. If you are building this with a 1GB or 2GB drive (not recommended), choose [All files in one partition] For a larger drive choose: [Desktop machine] Then arrow up and change the "Mount point:" of partition "#6 logical" from /home to /var Here is an example of what the finished product could look like: IDE1 master (hda) - 10.0 GB Maxtor 5T010H1 hda1 #1 primary 2.8 GB ext3 / (bootable) (root partition) hda5 #5 logical 353.7 MB swap (swap partition) hda6 #6 logical 6.8 GB ext3 /varThe same drive using and modifying the [Multi-user workstation] partitioning scheme: It took me about 10 minutes of playing with the software to figure out how to modify what the partitioning software came up with, but this will provide a little better performance (due to reduced file fragmentation). You need a 6GB or larger drive and a little patience to do this. Change the mount point of "#1 primary" from / to /boot Change the mount point of "#5 logical" from /usr to / Change the mount point of "#6 logical" from /var to /var/lib (Enter manually) Delete both partitions #9 and #8, then recreate logical partitions #8 and #9 from the free space and change the mount points to what is illustrated below. Each data partition should be at least 1GB as shown. The /var/spool directory is where our mail queues will be, so it would be desirable to make it 3GB or larger. IDE1 master (hda) - 10.0 GB Maxtor 5T010H1 hda1 #1 primary 279.6 MB ext3 /boot (bootable) hda5 #5 logical 3.6 GB ext3 / (root) hda6 #6 logical 1.8 GB ext3 /var/lib hda7 #7 logical 386.6 swap swap hda8 #8 logical 1.0 GB ext3 /var/log hda9 #9 logical 3.0 GB ext3 /var/spoolOnce you have what you like, choose [Finish partitioning and write changes to disk] [Write changes to disk?] [Yes] |
|
[Installing the Debian base system] Wait.... [Install the GRUB boot loader to the master boot record?] If you would like the install the GRUB boot loader choose [Yes] If you would like the install the LILO boot loader [Tab] over and select [Go Back] Then select the 'Install the LILO boot loader...' [Finish the installation] Remove the CD or floppy when prompted, then hit [Continue] This will reboot. |
| [Debian base system configuration] - Welcome to your new Debian system! [OK] |
| [Time zone configuration] [Is the hardware clock set to GMT?] [NO] [Select your time zone:] Simply choose what is appropriate. |
| [Password setup] This will ask for root's password and allow you to create a "normal" user and a password for that user. Watch your [Num Lock] status. Use really good passwords and don't forget them. Please add one, and just one, normal user here. If you plan on storing mail locally on this machine (not documented here), or even if you don't, create a user who's main purpose in life might be to hold root's mail. I suggest calling the user myroot or something similar. |
|
Make sure you are connected to the Internet
[Apt configuration] [Archive access method for apt:] Choose [http] then your [Mirror country] then a mirror near you. (mirrors.kernel.org works very well in the US) [HTTP proxy information] (configure if needed, otherwise leave unconfigured) |
| [Debian software selection]
[Choose software to install:] Do not select anything here. Simply [Tab] over and select [Ok] |
| [Configuring console data] IMPORTANT! choose "Don't touch keymap" You chose one earlier whether you knew it or not and choosing any keyboard here may remove the keyboard mapping and you may not be able to get it back without starting the installation over!!!!! |
| [Configuring Exim v4 (exim4-config)]
[General type of mail configuration:] choose [no configuration at this time] [Really leave the mail system unconfigured?] [Yes] [Root and postmaster mail recipient:] The "normal" user we added earlier will display here. This is fine, so simply accept this. Since all mail will be relayed to another server, this setting will actually end up being ignored. However, if you configure your system to store mail locally, all of root's mail will be redirected to this "normal" user's mailbox. This is necessary because you typically cannot access root's mailbox remotely. |
| [Debian base system configuration]
[Setup of your Debian system is complete] [OK] |
Once you get the login prompt, login as root and issue the following command:
apt-get install ntpdate
|
hwclock --systohc
|
dpkg-reconfigure locales
|
|
[Configuring locales] You use [PgUp] [PgDn] [up-arrow] [down-arrow] [tab] and [spacebar] to navigate and select. Your ISO-8859-x locale should already be selected. You can simply [Tab] over to [Ok]. The installer software correctly assumed I wanted en_US ISO-8859-1. I suggest you have this also (in addition to others if you require them). If you need to change the locale, or add additional locales, use the [arrow] [spacebar] and [tab] keys. I suggest you do NOT pick a UTF-8 locale. SpamAssassin and amavisd-new may have problems if you do. [Which locale should be the default in the system environment?] I suggest you do NOT choose [None], I suggest you choose [en_US] |
ls -l /etc/consoleThis lists the contents of the /etc/console directory.
You should see a file named "boottime.kmap.gz"If you get "Total: 0" then we have no keymap file. If, and only if, we have no keymap file, run the command: dpkg-reconfigure console-dataAnd choose [Select keymap from arch list] Follow the prompts that apply to you and when the program exits check again to see if there is now a file called "boottime.kmap.gz" in the /etc/console
directory.If the file is not there, reboot and try again. We cannot continue until a keymap file is installed. Worst case is we would have to start the installation over again! |
| Once you are back at the shell prompt, reboot the system with [Ctrl][Alt][Delete] |
pwd(which means "print working directory"; it will reply with "/root") |
apt-get install libc6-dev dpkg-dev db4.3-util libdb4.3-dev libberkeleydb-perl vim lynx ncftp bzip2 unzip perl-doc libwww-perl ntp-simple zlib1g-dev unzoo arj zip lzop nomarch arc zoo unarj ftp lsof less libdbi-perl libmail-spf-query-perl libconvert-binhex-perl gcc make autoconf automake1.7 libtool flex bison libldap2 libcompress-zlib-perl dnsutils rblcheck pax libmail-spf-query-perl libdbi-perl libnet-ident-perl cabextract libio-socket-ssl-perl
|
apt-get remove ipchains lpr nfs-common portmap pidentd pcmcia-cs
pppoe pppoeconf ppp pppconfig uw-imapd qpopper mailagent |
i",
(short for "insert"). You can edit text pretty much as you would expect in
Write mode. You exit out of Write mode and return to Command mode by hitting
the [Esc] key. There are many commands that can be learned in Command mode but
we only need to learn two more in addition to "i". Those commands
are ":" (a colon) and "/" (a forward slash). The
colon is used to enter the third mode, the Command line mode and the slash
enables the Search command. When you are in Command line mode, you will see a
colon at the bottom of the screen. Here is a list of commands we will use while
in Command line mode:
:q quit (provided you have not made any changes) By the way,
the lower case q is used often in *nix as a way to exit a screen. :q! exits vi and discards changes (great when you trashed the
file and just want to start over!) :wq saves the changes and exits vi (write and quit) :w saves the current changes but does not exit vi (write) G The capital "G" Goes to the bottom of the page (very handy)
/text_to_search_for moves the cursor to the first occurrence of
text_to_search_for
Run this to see which program vi points to:
ls -l /etc/alternatives/vi
If it says it is pointing to nvi or other program instead of vim (like this): /etc/alternatives/vi -> /usr/bin/nvi Then we need to fix it so it points to (symbolically links to) vim:
mv /etc/alternatives/vi /etc/alternatives/nvi
If you run this again:
ls -l /etc/alternatives/vi
You should see that it now links to vim. |
vi /etc/resolv.confMake sure our domain name is at the top, in the form: search example.com The file should look something like: search example.com nameserver 444.444.444.444 nameserver 555.555.555.555 Repair it if it is not. (Use "i", then edit it) remember - the numeric keypad is useless. If you made changes, Exit the file with [Esc] : wqIf you did not need to change anything, Exit the file with [Esc] : q
|
vi /etc/hostsThe top of file should look something like: 127.0.0.1 localhost.localdomain localhost 111.111.111.111 sfa.example.com sfaRepair it if it does not (localhost.localdomain is not strictly required). Remember, use "i" to insert and don't use the numeric keypad. If the hostname "sfa" is listed on both lines, remove it from the 127.0.0.1 line. Since we are here, you might as well add any other hosts you would like our spamfilter to know about. I suggest you (at least) put your internal mail server(s) here. Simply append any other entries to the bottom of the list. If you made changes, Exit the file with [Esc] : wqIf you did not need to change anything, Exit the file with [Esc] : qIf you have a mess on your hands, Exit the file with [Esc] : q! and try again.
|
rebootlogout |
shutdown -h now
apt-get update (to update the local database of available
packages) followed by apt-get upgrade, to install the
latest version of any and all packages it found on our system. This is fine because
we are using the "stable" version of Debian, but you should not upgrade your system
or install packages indiscriminately, especially if you use any packages from
the "testing" or "unstable" branches. This could make stuff stop
working. Fortunately there is something called "Apt-Pinning" that enables us to
prioritize the order of "stable", "testing", and "unstable" software sources. This file
has to be created by us.
The most succinct explanation of this can be found at
http://jaqque.sbih.org/kplug/apt-pinning.html. If you ever use "apt-get upgrade",
I strongly recommend using
apt-get -s upgrade to "simulate" the upgrade process
before you actually upgrade.
vi /etc/apt/preferences |
| Enter this text in the file ("i" to insert) EXACTLY as shown. Yes, you can select the text with your mouse, hit [Ctrl]+c , and then right-click in the vi editor window.
Package: *
Exit the file with [Esc] : wq as usual.
|
apt-get -s install [package]
before you install any package. It lets you "simulate" what would happen.
If you want a package that is an
"unstable" or "testing" version, you would have to specifically request the "unstable"
or "testing" version or change the priority before you install it (unless the only version
is "unstable" or "testing" or your current version is "unstable" or "testing"). For example
apt-get -t unstable install [package]. If you use tools like
tasksel, you may have to temporarily change the priority prior to installing a
new set of packages. The most stable situation is to only upgrade to new
packages if a security flaw is found and make sure you have the ability to
completely restore the hard drive if upgrades don't go well. So I don't
frighten you too much, the Debian package maintainers are amazing, so apt-get usually works very well.
apt-cache to search the local database for
available packages. apt-cache search [search terms] will find packages that
sound like what you want and: apt-cache show [packagename] will return more details
on a particular package. apt-cache showpkg [packagename] will return more
details on a particular package. apt-cache policy [packagename] will return which
versions are available along with the priority of each version. apt-setup will enable you to change mirrors. The
alternative is to edit /etc/apt/sources.list manually (which I prefer). apt-get clean clears the local repository of all retrieved
package files. apt-get autoclean clears the local repository of retrieved
package files of programs that are no longer installed. dpkg -l [packagename] will list the version and a short
description of the package we have installed.
cp /etc/apt/sources.list /etc/apt/sources.backup
This creates a backup file. Then: vi /etc/apt/sources.list |
At this point, the contents of the file look something like this:
#deb file:///cdrom/ sarge main deb http://mirrors.kernel.org/debian/ stable main deb-src http://mirrors.kernel.org/debian/ stable main deb http://security.debian.org/ stable/updates main We need to modify this file so the result will look something like this: (with only the http server unique to your particular system) deb http://mirrors.kernel.org/debian/ stable main non-free contrib deb-src http://mirrors.kernel.org/debian/ stable main deb http://security.debian.org/ stable/updates main deb http://mirrors.kernel.org/debian/ testing main non-free contrib deb-src http://mirrors.kernel.org/debian/ testing main deb http://mirrors.kernel.org/debian/ unstable main non-free contrib deb-src http://mirrors.kernel.org/debian/ unstable main Note what I have done here: The line #deb file:///cdrom/ sarge main has been erased. ([up-arrow] to the top of the file and hold down the [Delete] key.) The 4 bottom lines have been copied from the top 2 lines, and then modified slightly as indicated. The words "non-free" and "contrib" have been added to 3 of the lines. You are welcome to simply copy and paste what I have listed above. Save and exit the file. |
apt-get update
|
apt-get install lha unrar
|
less. less is a great file
and directory viewer.
less.
less: less /path/file
less:
ls -l | less (current directory, or)
ls -l /path/directory | less
history | less
locate.
locate allows you to search a database of every file name on the
system.
updatedb command, and then you can search through it.
locate and less
together:
updatedb
locate kmap | less
less
/usr/share/keymaps/i386/qwerty/
cd
cd and hit [return]. We just saved ourselves
having to type the entire path name just in order to change to that directory.
I like that.
cd to get back home.
iptables -F
|
iptables -L |
vi /etc/network/interfacesAnd insert the following text (remember, it's "i" to insert) in the blank line just below "iface lo inet loopback": pre-up iptables-restore < /etc/firewall-rules
Save and exit the file as usual with [Esc] : wq From now on I will assume you know how to edit, save, and exit files using vi. If not stated, it will be implied that after editing a file, you need to save and exit it, or if necessary, discard changes and start over. |
If you have not done so, reboot again and runiptables -L to verify the firewall loaded during start up. |
iptables -F from the
console to clear out iptables. This will allow you another shot at it.
top
ps afx
ps afxl
ps -A
ls -F /etc/rc2.d
lsof -i | grep LISTEN
grep -v "^#" /etc/inetd.conf | sort -u
netstat -pn -l -A inet
netstat -pn -l inet
cd /usr/bin
wget http://www200.pair.com/mecham/debian/lsconfig
chmod +x /usr/bin/lsconfig
lsconfig
cp -r /etc/init.d /etc/init.d-original |
/etc/init.d/lpd stop
|
update-inetd --disable time
|
/etc/init.d/inetd restart
|
lsof -i | grep LISTEN
The only daemon you should see is at this point is *:ssh You may have to run this again: update-inetd --disable discardIf there are other programs shown, try rebooting and test again. |
update-inetd --enable ident
/etc/init.d/inetd restart
update-rc.d lpd defaults
/etc/init.d/lpd start
cp -i /etc/init.d-original/lpd /etc/init.d
update-rc.d lpd defaults
/etc/init.d/lpd start
/etc/ntp.conf and
insert it per the example in the file. NTP is a flexible and complex system so I leave
it up to you to research it further if you care to.
/etc/ntp.conf:
/etc/init.d/ntp-server stopntpdate clock.fmt.he.netntpdate ntp1.tummy.com/etc/init.d/ntp-server start
date
and to change the time zone it's tzconfig
apt-get upgrade
|
If the kernel is upgraded, once the upgrade process is complete, you must:
reboot
|
cd /usr/local/src
If all goes well, the last thing you will see is: "Appending installation info to /usr/local/lib/perl/5.8.4/perllocal.pod" |
To avoid any compatibility problems with Net::Server, please read this:
http://www200.pair.com/mecham/spam/net-server.html
|
apt-cache policy postfix spamassassin amavisd-new
|
postfix:
Installed: (none)
Candidate: 2.1.5-9
Version Table:
2.2.10-1 0
400 http://mirrors.kernel.org unstable/main Packages
2.2.4-1.0.1 0
450 http://mirrors.kernel.org testing/main Packages
2.1.5-9 0
600 http://mirrors.kernel.org stable/main Packages
spamassassin:
Installed: (none)
Candidate: 3.0.3-2
Version Table:
3.1.0a-2 0
450 http://mirrors.kernel.org testing/main Packages
400 http://mirrors.kernel.org unstable/main Packages
3.0.3-2 0
600 http://security.debian.org stable/updates/main Packages
600 http://mirrors.kernel.org stable/main Packages
amavisd-new:
Installed: (none)
Candidate: 20030616p10-5
Version Table:
1:2.3.3-2 0
400 http://mirrors.kernel.org unstable/main Packages
20030616p10-5 0
600 http://mirrors.kernel.org stable/main Packages
450 http://mirrors.kernel.org testing/main Packages
This tells us there are newer versions of Postfix available in the "testing"
and "unstable" branches.
Once we have completed our setup, you can optionally upgrade to the newer version
by simply installing it using "apt-get -t testing install [list of packages]".
Note that if you decide to install the testing version of Postfix, some other important
system files will also get upgraded to the testing version (notably libc6, libc6-dev
and locales). When mixing testing with stable, there is always some potential of
future problems with program dependencies, but generally, Debian is very smart about
these issues. The more cautious person would not upgrade. I have experienced problems
with new versions of libc6 when using a 2.4 version of the Linux kernel.
I had to upgrade to a 2.6 kernel to solve the problem.
The report shows there is a newer version of SpamAssassin available. We can
also upgrade SpamAssassin to the new version once our install is done, or you can
install the new 3.1 version now.
It shows us there is an unstable version of amavisd-new available, but we are NOT
going to install it. The configuration files for that new Debian version are
not consistent with the typical way amavisd-new is configured. Instead of one
configuration file, this new version splits the configuration files into half
a dozen files in a couple different directories.
We will instead install an old version of amavisd-new. We need to install this
old version via apt-get because it creates the amavis user and group, installs
several scripts for startup and maintenance, creates the directory structure and
installs other ancillary files. We will manually install the author's version
2.4.2 of amavisd-new over the top of 20030616-p10. So with this in mind:
apt-get -t stable install amavisd-new
apt-get install razor pyzor
If you would like to install the newer version of spamassassin: apt-get install spamassassin/testing
Otherwise: apt-get install spamassassin
apt-get install postfix postfix-pcre postfix-mysql postfix-ldap
|
|
Debconf will pop up a Postfix configuration screen. For [General type of configuration?] select: No configuration |
mkdir /root/.spamassassinmkdir /var/lib/amavis/tmpmkdir /var/lib/amavis/dbmkdir /var/lib/amavis/varchown -R amavis:amavis /var/lib/amavischmod -R 750 /var/lib/amavisln -s /etc/amavis/amavisd.conf /etc/amavisd.conf
|
Now we will replace our (currently unconfigured) amavisd-new version 20030616-p10
with version 2.4.2.
amavisd-new stop
To prevent the Debian version of amavisd-new from installing over our custom one when we run 'apt-get upgrade', place the package on hold: echo "amavisd-new hold" | dpkg --set-selections |
cd /usr/local/srcwget http://ftp.debian.org/debian/pool/main/p/postfix/postfix_2.1.5.orig.tar.gztar xzvf postfix_2.1.5.orig.tar.gz
|
ls -l |
rm postfix* |
| The second line below will need to be edited if you have a different version of
the Postfix source code. MAKE SURE you answer "n" to "overwrite?" Do each section separately. cp -i /usr/share/postfix/main.cf.debian /etc/postfix/main.cf
cp -i /usr/local/src/postfix-2.1.5/conf/* /etc/postfix
cp -i /etc/postfix/header_checks /etc/postfix/body_checks
cp -i /etc/postfix/access /etc/postfix/sender_access
|
The master.cf we download here can be used with Postfix versions 2.3.x, 2.2.x and 2.1.x postfix stop
cd /etc/postfix
mv master.cf master.cf-original
wget http://www200.pair.com/mecham/debian-postfix-2.2-amavisd/master.cf
|
postfix stop vi /etc/postfix/master.cf
|
| Add these lines near the bottom of master.cf. Note: the items on these lines are separated by tabs. And the "-o" is the lower case letter o, not zero. These settings are from http://www.ijs.si/software/amavisd/README.postfix. You can copy and paste this entire section once the cursor is in the correct position (see below) and you are in insert mode. Note: when copying sections like this that contain tabs, rather than using a right click of the mouse to paste into the editor, press [Shift]+[Insert]: |
smtp-amavis unix - - - - 2 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes -o disable_dns_lookups=yes -o max_use=20 127.0.0.1:10025 inet n - - - - smtpd -o content_filter= -o local_recipient_maps= -o relay_recipient_maps= -o smtpd_restriction_classes= -o smtpd_delay_reject=no -o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o smtpd_data_restrictions=reject_unauth_pipelining -o smtpd_end_of_data_restrictions= -o mynetworks=127.0.0.0/8 -o smtpd_error_sleep_time=0 -o smtpd_soft_error_limit=1001 -o smtpd_hard_error_limit=1000 -o smtpd_client_connection_count_limit=0 -o smtpd_client_connection_rate_limit=0 -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks |
Add this just below the 'pickup' service type:
-o content_filter= -o receive_override_options=no_header_body_checks |
# ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== smtp inet n - - - - smtpd #submission inet n - - - - smtpd # -o smtpd_etrn_restrictions=reject # -o smtpd_client_restrictions=permit_sasl_authenticated,reject #smtps inet n - - - - smtpd # -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes #submission inet n - - - - smtpd # -o smtpd_etrn_restrictions=reject # -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes #628 inet n - - - - qmqpd pickup fifo n - - 60 1 pickup -o content_filter= -o receive_override_options=no_header_body_checks cleanup unix n - - - 0 cleanup qmgr fifo n - n 300 1 qmgr #qmgr fifo n - - 300 1 oqmgr tlsmgr unix - - - 1000? 1 tlsmgr rewrite unix - - - - - trivial-rewrite bounce unix - - - - 0 bounce defer unix - - - - 0 bounce trace unix - - - - 0 bounce verify unix - - - - 1 verify flush unix n - - 1000? 0 flush proxymap unix - - n - - proxymap smtp unix - - - - - smtp # When relaying mail as backup MX, disable fallback_relay to avoid MX loops relay unix - - - - - smtp -o fallback_relay= # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 showq unix n - - - - showq error unix - - - - - error discard unix - - - - - discard local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - - - - lmtp anvil unix - - - - 1 anvil scache unix - - - - 1 scache # smtp-amavis unix - - - - 2 smtp -o smtp_data_done_timeout=1200 -o smtp_send_xforward_command=yes -o disable_dns_lookups=yes -o max_use=20 127.0.0.1:10025 inet n - - - - smtpd -o content_filter= -o local_recipient_maps= -o relay_recipient_maps= -o smtpd_restriction_classes= -o smtpd_delay_reject=no -o smtpd_client_restrictions=permit_mynetworks,reject -o smtpd_helo_restrictions= -o smtpd_sender_restrictions= -o smtpd_recipient_restrictions=permit_mynetworks,reject -o smtpd_data_restrictions=reject_unauth_pipelining -o smtpd_end_of_data_restrictions= -o mynetworks=127.0.0.0/8 -o smtpd_error_sleep_time=0 -o smtpd_soft_error_limit=1001 -o smtpd_hard_error_limit=1000 -o smtpd_client_connection_count_limit=0 -o smtpd_client_connection_rate_limit=0 -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks |
/etc/postfix/main.cf the main
configuration file for Postfix. Following are suggested values to use in
main.cf. These have been tested for this configuration and will work fine, but
there are many judgment calls involved in this, and it is a good idea at some
point to learn more about Postfix configuration, on your own. You could first
look at the sample Postfix main.cf file /usr/share/postfix/main.cf.dist
. There are comments describing some of the most common options.
Refer also to the Postfix documents on your machine in the
/usr/local/src/postfix-2.1.5/README_FILES directory, or
read the documentation on the Postfix web site
http://www.postfix.org/documentation.html. I also recommend
http://www.postfix-book.com/.
postmap
command to create binary files (Berkeley DB format) that Postfix will ultimately use to
retrieve the data. For example, if you have a file called "filename" and you "postmap filename",
a new file is created "filename.db". Postfix will retrieve data from "filename.db", not
"filename".
There are more than a dozen other types of data files that Postfix
can use to store data. Hash tables are an appropriate choice for
several tables we will use, and pcre (Perl Compatible Regular Expressions)
is appropriate for a couple tables we will use to hold content filtering data.
In its simplest form a hash table is comprised of 2 pieces of data,
a key and a value; typically referred to as the key/value pair. The key
and the value are separated with whitespace (typically a space or tab).
The data in a typical table that we use in Postfix would look something like:
postconf -e "alias_maps = hash:/etc/aliases"
|
newaliases now, and every time after you edit the aliases file. The
newaliases command is just like postmap except that it's
specific to the aliases file.
newaliases
|
postconf -e "myorigin = example.com" |
postconf -e "myhostname = sfa.example.com" |
Please read important notes above.postconf -e "mynetworks = 127.0.0.0/8, 222.222.222.222/24, 10.10.10.10/24"
|
postconf -e "message_size_limit = 10485760" |
postconf -e "local_transport = error:no local mail delivery" |
postconf -e "mydestination = " |
postconf -e "local_recipient_maps = " |
Set up a reference to the virtual file:postconf -e "virtual_alias_maps = hash:/etc/postfix/virtual"Then edit the virtual file: vi /etc/postfix/virtualand add postmaster and admin in the format:
postmaster postmaster@example.com
Save and exit the file, then create the binary file that Postfix will use:postmap /etc/postfix/virtual |
postconf -e "relayhost = [666.666.666.666]" |
Set up a reference to a file we will create to store the data:postconf -e "relay_recipient_maps = hash:/etc/postfix/relay_recipients"
Then edit that file: vi /etc/postfix/relay_recipients
For the moment, we are going to accept mail for all users in our domain(s) so enter each domain you accept mail for in the format:
@example.com OK
Then create the binary file that Postfix will use: postmap /etc/postfix/relay_recipientsThe entries above are temporary. They are wildcards that allow mail to your domains. You MUST remove the entries above at some point in the near future and replace them with every single one of your valid recipients' email addresses. When you are ready to enter each user individually in the relay_recipients file, you would first remove (or comment out) the data above that allows mail to all users in the domain, and then list each user individually in the form: user1@example.com OK user2@example.com OK user3@example.com OK |