TuDols: Setting up Apache Web Server
| what is linux? | distributions | applications | projects | support |
| documentation | security | online magazine | feedback | about |
| system | news | search |



Setting up Qmail


Adding the review of Qmail this week prompted me to write this installation and setup guide for first-time users of Qmail. Just a quick thanks to Tony Wade for the help he gave me with Qmail.


Things you have to decide before starting:

  • The qmail home directory, normally /var/qmail. To change this directory, edit conf-qmail now.
    ( I would suggest sticking to the defaults )

  • The names of the qmail users and the qmail groups. To change these names, edit conf-users and conf-groups now.
    ( Once again stick to the defaults )
1. Creating the Qmail directory.

Create the directory /var/qmail or edit conf-qmail in your source directory to set your own

2. Setup the Qmail users and group.

Enter the following at command prompt ( without the "'s )

    "groupadd nofiles"
    ( add's a new group called 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"
    ( adds all the users to group nofiles )

    "groupadd qmail"
    ( add's a new group called qmail )

    "useradd -g qmail -d /var/qmail qmailq"
    "useradd -g qmail -d /var/qmail qmailr"
    "useradd -g qmail -d /var/qmail qmails"
    ( adds all the users to group qmail )

This will create the default groups and users needed for Qmail.

3. Installing Qmail.

Make sure you are in the install directory and type

    "make setup check"

4. Pre-configuring Qmail.

If you have DNS setup on your system run the following command in your install directory.

    "./config"
If you do not have DNS setup on your system run the following command in your install directory.
( please note: replace "your.host.name" with your acuall hostname )
    "./config-fast your.host.name"
5. Create aliases for Qmail

You need to create some aliases for qmail to use. Type the following command.

    "cd ~alias; touch .qmail-postmaster .qmail-mailer-daemon .qmail-root"
    "chmod 644 ~alias/.qmail*"
7. Setting up Qmail for your mail application.

This is a very important step. Please follow the instructions very carefully.

Read the following files that is in your install directory.

INSTALL.maildir
INSTALL.mbox

I would suggest using the Maildir system, as it is easy to setup. Unfortunately if you choose the Mbox system you'll have to consult the documentation for installation instructions.

To use the Maildir option, run the following commands.

    "cd /etc/skel"
    "/var/qmail/bin/maildirmake Maildir"
8. Running Qmail with Sendmail.

If you have sendmail on your system, I would suggest removing it. To find out if you have sendmail follow these steps.

On RedHat and other RPM based systems:

Type in at your command prompt:

    "rpm -e `rpm -q -a |grep sendmail`"
this will un-install the sendmail RPM that comes with RedHat.

On other systems using tar.gz format:

Follow these steps.

Type in at your command prompt

    "rm -f /usr/lib/sendmail"
    "rm -f /usr/sbin/sendmail"
This will delete the two sendmail files. Don't worry about them. It's become clear in the next step.

9. Linking Sendmail to Qmail

    "ln -s /var/qmail/bin/sendmail /usr/lib/sendmail"
    "ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail"

10. Adding Qmail to your to /etc/inetd.conf

Add this string to your /etc/inetd.conf file so that your internet daemon knows what to do with mail. ( do not copy it or it will not work and make sure you put it in the correct place )

    smtp stream tcp nowait qmaild /var/qmail/bin/tcp-env tcp-env /var/qmail/bin/qmail-smtpd

    pop-3 stream tcp nowait root /var/qmail/bin/qmail-popup qmail-popup your.domain.here /bin/checkpassword /var/qmail/bin/qmail-pop3d ./Maildir/

Please note: replace "your.domain.here" with your acuall domain name.

10. using Qmail with Shadowpasswords.

If you do not know if you are running shadow passwords the do the following.

    "less /etc/passwd"
You should see something like this:
    qmailq:x:508:505::/var/qmail:/bin/bash
    qmailr:x:509:505::/var/qmail:/bin/bash
    qmails:x:510:505::/var/qmail:/bin/bash
You'll note that after the the user name e.g. qmail there is a x. this means you are using shadowpasswords.
If you see text where the "x" is then skip this next step.

After downloading checkpassword, type the following:

    chmod a+x checkpassword-0.76.shar
    ./checkpassword-0.76.shar
This will extract the checkpassword files you need. Now you need to edit the MakeFile and remove eveything.
Once you have removed the content, replace it with this. ( do not copy and paste. It does not work )
    #For RH5 see later
    #SHADOWLIBS=-lshadow
    #SHADOWOPTS=-DPW_SHADOW

    # If using RehHat 5, uncomment the next line
    CRYPTLIB=-lcrypt

    # Additionally for shadow passwords under Linux RehHat 5, uncomment
    SHADOWLIBS=-lpwdb
    SHADOWOPTS=-DPW_SHADOW

    CC=cc $(SHADOWOPTS)
    LD=cc -s

    all: checkpassword

    checkpassword: checkpassword.o
    $(LD) -o checkpassword checkpassword.o $(SHADOWLIBS) $(CRYPTLIB)

    checkpassword.o: checkpassword.c
    $(CC) -c checkpassword.c

    shar: FILES
    shar -m `cat FILES` > checkpassword.shar
Now that you have changed the MakeFile type the following:
    "make"
    "cp ./checkpassword /bin"
11. Adding Qmail to your startup secuence.

Edit /etc/rc.d/rc.local and add these line to the file: echo "Starting Qmail Mail Server"
env - PATH="/var/qmail/bin:$PATH" qmail-start ./Maildir/ splogger qmail &

After All this your system is ready for Qmail.

There are some final pointer to keep in mind. 1. It's easer to setup qmail before adding user since it will effect their directories.

If you already have users on the system and you are using the maildir system for mail delivery you'll have to do some more work quickly.

In each users directory you have to run these commands:

    "/var/qmail/bin/maildirmake Maildir"
This will create the mail directory in the users directory.
Now you have to change the permissions so that the user can see the directory.
( this had me boggled for a few minutes. )
    "chown -R : /home//Maildir"
    "chmod -R gu+rw /home//Maildir"
In each case replace the with the username of the direcoty where the changes are being made.

I suggest you read ALL the Installation documentation in /var/qmail/doc/ This will give you information on how to optimize and change settings for Qmail.


| Submit an Application | Submit a Review |

| what is linux? | distributions | applications | projects | support |
| documentation | security | online magazine | feedback | about |
| system | news | search |



copyright © TuDols 1998: comments and suggestions to webmaster