Create a new directory called /downloads and place the Qmailrocks tarball in that directory before unpacking it.
mkdir /downloads
cd /downloads
Now download the Qmailrocks.org software bundle.
wget http://www.qmailrocks.org/downloads/qmailrocks.tar.gz
Unpack tha tar file
tar zxvf qmailrocks.tar.gz
Run this script. It will create user and groups as well as all the needed directories, permissions and ownership settings needed for the installation of qmail, ucspi-tcp and daemontools.
/downloads/qmailrocks/scripts/install/qmr_install_linux-s1.script
Now apply the following patches for qmail.
cd /usr/src/qmail/qmail-1.03
wget http://members.elysium.pl/brush/qmail-smtpd-auth/dist/qmail-smtpd-auth-0.31.tar.gz
tar -xvzf qmail-smtpd-auth-0.31.tar.gz
cd qmail-smtpd-auth-0.31
patch -d /usr/src/qmail/qmail-1.03 < auth.patch
cd /usr/src/qmail/qmail-1.03
Replace "extern int errno;" with "#include <errno.h>" in error.h
Now build Qmail
make man && make setup check
./config-fast your_fqdn_hostname
Now build ucspi-tcp
cd /usr/src/qmail/ucspi-tcp-0.88/
Now apply the following patch for qmail.
Replace "extern int errno;" with "#include <errno.h>" in error.h
make && make setup check
Now build the daemontools
cd /package/admin/daemontools-0.76/src
Replace "extern int errno;" with "#include <errno.h>" in error.h
cd /package/admin/daemontools-0.76/
package/install
If you run take a look at the running processes on your server at this point, you should see the daemon "svscanboot" running. You can usually do this with a "ps -aux" command.
EZmlm is a nice mailing list add-on to Qmail. I've used it several times myself and its actually one of the better mailing list programs out there. When we install Qmailadmin later on, you'll see that EZmlm integrates seamlessly into Qmailadmin to provide a very user friendly mailing list management interface. As an added bonus, Vpopmail (which we will install as well) will let you control what users can and cannot use mailing lists!
cd /downloads/qmailrocks/
tar zxvf ezmlm-0.53-idx-0.41.tar.gz
cd ezmlm-0.53-idx-0.41
make && make setup
Autoresponder does exactly what you think it does. It allows us to set up autoresponders for mailboxes and so forth.
So let's install it...
cd /downloads/qmailrocks
tar zxvf autorespond-2.0.5.tar.gz
cd autorespond-2.0.5
make && make install
Vpopmail is one of the major components of this installation. Vpopmail allows us to do virtual domain mail hosting. It's got a lot of built in tools and features that make it a dream to work with.
So let's install it...
cd /downloads/qmailrocks
tar zxvf vpopmail-5.4.13.tar.gz
cd vpopmail-5.4.13
Now let's configure vpopmail...
./configure --enable-logging=p
make && make install-strip
Vqadmin is simply a nice web based interface that will let us manage Vpopmail. Through the interface we can create new domains, new users, net quotas, enable services and much more.
So let's install it...
cd /downloads/qmailrocks
tar zxvf vqadmin-2.3.6.tar.gz
cd vqadmin-2.3.6
./configure --enable-cgibindir=/path/to/your/cgi-bin --enable-htmldir=/path/to/your/html/directory
(Example: ./configure --enable-cgibindir=/var/www/cgi-bin --enable-htmldir=/var/www/html )
make && make install-strip
If the installation is successfull, Vqadmin should install itself in the cgi-bin directory of your default website. Unless you tell it otherwise, that usually defaults to /var/www/cgi-bin. You can specify another location in the ./configure command above.
Now you will need to add the following to your server's Apache configuration file (usually httpd.conf)
<Directory "/path/to/your/cgi-bin/vqadmin">
deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow
</Directory>
cd /path/to/your/cgi-bin/vqadmin
Now you will want to create a .htaccess file to password protect the Vqadmin interface. There should already be a .htaccess file in the vqadmin directory, so all you need to do is configure it. We'll use the ever useful vi editor for this.
vi .htaccess
AuthType Basic
AuthUserFile /path/to/where/you/want/to/store/the/password/file/.htpasswd
AuthName vQadmin
require valid-user
satisfy any
chown apache .htaccess (you may need to change the chown to either "nobody", "apache" or "www" etc., depending on what user your installation of Apache is running as)
chmod 644 .htaccess
Now you need to create a corresponding .htpasswd file that's going to contain the username and encrypted password for the Vqadmin administrator...
htpasswd -bc /path/to/where/you/want/to/store/the/password/file/.htpasswd admin admin_password
chmod 644 /path/to/where/you/want/to/store/the/password/file/.htpasswd
Now restart Apache...
apachectl stop
apachectl start
If all has gone well, you should now be able to browse (in your web browser) to:
http://www.yourdomain.com/cgi-bin/vqadmin/vqadmin.cgi
Note: make sure you include "vqadmin.cgi" in the path or you will get a 403 forbidden error!
Enter the user "admin" and whatever password your assigned it.
Maildrop is a mail filtering agent which can be used to filter messages as they arrive on the server. You will probably notice, once this installation in complete, that you don't really use maildrop. However, it's a cool tool and it's worth having around if you ever decide to get crazy with filtering your imcoming mail. You can find documentation on maildrop right here.
Let's install it...
cd /downloads/qmailrocks
tar zxvf maildrop-1.6.3.tar.gz
cd maildrop-1.6.3
./configure --prefix=/usr/local --exec-prefix=/usr/local --enable-maildrop-uid=root --enable-maildrop-gid=vchkpw --enable-maildirquota
make && make install-strip && make install-man
Qmailadmin is going to provide us with a nice web based interface for administering mail accounts once they are setup through Vpopmail (or Vqadmin). From Qmailadmin we can create mailboxes, aliases, fowards, mail robots, mailing lists.
Let's install it...
cd /downloads/qmailrocks
tar zxvf qmailadmin-1.2.9.tar.gz
cd qmailadmin-1.2.9
./configure --enable-cgibindir=/path/to/your/cgi-bin --enable-htmldir=/path/to/your/html/directory
make && make install-strip
That's it! Now browse to http://www.yourdomain.com/cgi-bin/qmailadmin and you should see the login screen. Login with the postmaster account and password for the domain that you created a while back using Vqadmin. Pretty cool, isn't it? Go ahead and create some additional mailboxes for your domain(s).
The first thing we're going to do is create the qmail supervise scripts, create the the qmail rc and qmailctl scripts and then set the needed permissions on all these scripts.
So let's run the script...
/downloads/qmailrocks/scripts/finalize/linux/finalize_linux.script
Edit the following files.
vi /var/qmail/supervise/qmail-pop3d/run
Find "mail.example.com" and change it to your server's hostname. For example: mail.mydomain.com.
vi /var/qmail/supervise/qmail-smtpd/run
Find "mail.example.com" and change it to your server's hostname. For example: mail.mydomain.com
Next, we'll kill any running qmail processes so that we can implement some final configurations.
qmailctl stop
We setup selective relaying for localhost...
echo '127.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
qmailctl cdb
Now we create the common system aliases. These aliases are going to tell Qmail what to do with common server-generated mails.
echo some_address > /var/qmail/alias/.qmail-root
where "some_address" is the system user or email address you want these addresses aliased to.
echo some_address > /var/qmail/alias/.qmail-postmaster
where "some_address" is the system user or email address you want these addresses aliased to.
echo some_address > /var/qmail/alias/.qmail-mailer-daemon
where "some_address" is the system user or email address you want these addresses aliased to.
ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-anonymous
chmod 644 /var/qmail/alias/.qmail*
Run the script given below. When you run the script, it will check for some key required files and folders and will also check permissions and owership settings on many key items. It a needed file does not exist or if the ownership/permissions settings are wrong on a key file, it will tell you and then make a suggestion as to how to correct the error.
So you ready? Let's do it...
/downloads/qmailrocks/scripts/util/qmr_inst_check
If you get a "congratulations" type of message, you're all set. If you get some errors, just follow the directions to fix the errors and then re-run the script until you get all errors corrected and you get a "congratulations" message.
Assuming, you've passed the installation check script, let's crank Qmail up!
qmailctl stop
qmailctl start
You can find out how things are running by:
qmailctl stat
You should see an output like this:
/service/qmail-send: up (pid 29956) 2 seconds
/service/qmail-send/log: up (pid 29960) 2 seconds
/service/qmail-smtpd: up (pid 29963) 2 seconds
/service/qmail-smtpd/log: up (pid 29968) 2 seconds
/service/qmail-pop3d: up (pid 29971) 2 seconds
/service/qmail-pop3d/log: up (pid 29972) 2 seconds
messages in queue: 0
messages in queue but not yet preprocessed: 0
Qmail is now officially up and running and you should be able to send and receive mail on the server.
Let's test your new server's POP3 service...
telnet localhost 110
you should see something like this:
Trying 192.168.1.10...
Connected to 192.168.1.10.
Escape character is '^]'.
+OK <
16658.1054485137@yourserver.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
>
user
postmaster@mydomain.com
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
(enter your username here. remember to use the full e-mail address)
+OK
pass your_password
+OK
quit
+OK
Connection closed by foreign host.
This is the sign of a successfull POP connection to the server!
Now configure Outlook express and check whether everything is working fine or not.