Chinaunix首页 | 论坛 | 博客
  • 博客访问: 413326
  • 博文数量: 89
  • 博客积分: 1386
  • 博客等级: 中尉
  • 技术积分: 827
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-20 10:32
个人简介

12年 linux 系统运维工程师,网络架构设计、优化,故障处理。

文章分类

全部博文(89)

文章存档

2019年(1)

2015年(2)

2014年(11)

2013年(14)

2012年(2)

2011年(59)

分类: LINUX

2011-11-15 16:22:13

一)     环境设置

 redhat as3 u6  下安装qmail

1.       检查软件

[root@mail root]# rpm -q sendmail

sendmail-8.12.10-1

[root@mail root]# rpm -q httpd php php-mysql mysql mysql-server mysql-devel gdbm gdbm-devel openssl openssl-devel stunnel krb5-devel

httpd-2.0.46-25.ent

php-4.3.2-8.ent

php-mysql-4.3.2-8.ent

mysql-3.23.58-1

package mysql-server is not installed

mysql-devel-3.23.58-1

gdbm-1.8.0-20

gdbm-devel-1.8.0-20

openssl-0.9.7a-22.1

openssl-devel-0.9.7a-22.1

stunnel-4.04-4

krb5-devel-1.2.7-19

[root@mail root]#

[root@mail root]# rpm -q gcc g++ gcc-g++ bzip2 bzip2-devel

gcc-3.2.3-20

package g++ is not installed

package gcc-g++ is not installed

bzip2-1.0.2-11

bzip2-devel-1.0.2-11

[root@mail root]#

[root@mail root]# rpm -q spamassassin

package spamassassin is not installed

 

2.       配置APACHE

[root@mail root]# vi /etc/httpd/conf/httpd.conf

ServerName mail.happy.com:80

[root@mail root]# chkconfig --list httpd

httpd           0:关闭  1:关闭  2:关闭  3:关闭  4:关闭  5:关闭  6:关闭

[root@mail root]# chkconfig --level 3 httpd on

[root@mail root]# chkconfig --list httpd

httpd           0:关闭  1:关闭  2:关闭  3:启用  4:关闭  5:关闭  6:关闭

[root@mail root]# service httpd start

启动 httpd                                               [  确定  ]

[root@mail root]#

 

3.       建软件目录

[root@mail /]# mkdir -p /app/src

[root@mail /]# cd /app/src

上传文件

 

4.       配置MYSQL

[root@mail src]# rpm -ivh mysql-server-3.23.58-1.i386.rpm

Preparing...                ########################################### [100%]

   1:mysql-server           ########################################### [100%]

[root@mail src]# chkconfig --list mysqld

mysqld          0:关闭  1:关闭  2:关闭  3:关闭  4:关闭  5:关闭  6:关闭

[root@mail src]# chkconfig --level 3 mysqld on

[root@mail src]# chkconfig --list mysqld

mysqld          0:关闭  1:关闭  2:关闭  3:启用  4:关闭  5:关闭  6:关闭

[root@mail src]# service mysqld start

初始化 MySQL 数据库:                                      [  确定  ]

启动 MySQL                                               [  确定  ]

[root@mail src]#

[root@mail src]# mysqladmin -u root password zlwt

 

5.       删除sendmail

[root@mail src]# chkconfig --list sendmail

sendmail        0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

[root@mail src]#

[root@mail src]# service sendmail stop

关闭 sendmail                                            [  确定  ]

关闭 sm-client                                           [  确定  ]

[root@mail src]# rpm -e --nodeps sendmail

 

二)     开始安装

1.       解压缩netqmail-1.05.tar.gz

[root@mail src]# tar -zxf netqmail-1.05.tar.gz

[root@mail src]# cd netqmail-1.05

[root@mail netqmail-1.05]# chmod -R 755 /app/src

[root@mail netqmail-1.05]# ./collate.sh

 

You should see 7 lines of text below.  If you see anything

else, then something might be wrong.

[1] Extracting qmail-1.03...

[2] Patching qmail-1.03 into netqmail-1.05.  Look for errors below:

     24

[4] The previous line should say 24 if you used GNU patch.

[5] Renaming qmail-1.03 to netqmail-1.05...

[6] Continue installing qmail using the instructions found at:

[7]

[root@mail netqmail-1.05]#

2.       安装daemontools

[root@mail /]# cd /app/src

[root@mail src]# tar -zxf daemontools-0.76.tar.gz

[root@mail src]# cd admin/daemontools-0.76/

[root@mail daemontools-0.76]# patch -p1 < /app/src/netqmail-1.05/other-patches/daemontools-0.76.errno.patch

patching file src/error.h

[root@mail daemontools-0.76]# package/install

[root@mail daemontools-0.76]# ps ax | grep svscan

15970 ?        S      0:00 /bin/sh /command/svscanboot

15972 ?        S      0:00 svscan /service

15975 pts/1    S      0:00 grep svscan

3.       安装ucspi-tcp

[root@mail daemontools-0.76]# cd /app/src

[root@mail src]# tar -zxf ucspi-tcp-0.88.tar.gz

[root@mail src]# cd ucspi-tcp-0.88

[root@mail ucspi-tcp-0.88]# patch -p1 < /app/src/netqmail-1.05/other-patches/ucspi-tcp-0.88.errno.patch

patching file error.h

[root@mail ucspi-tcp-0.88]#

[root@mail ucspi-tcp-0.88]# make

[root@mail ucspi-tcp-0.88]# make setup check

./install

./instcheck

[root@mail ucspi-tcp-0.88]#

4.       安装qmail

[root@mail ucspi-tcp-0.88]# mkdir /var/qmail

[root@mail ucspi-tcp-0.88]# groupadd nofiles

[root@mail ucspi-tcp-0.88]# useradd alias -g nofiles -d /var/qmail/alias -s /sbin/nologin

[root@mail ucspi-tcp-0.88]# useradd qmaild -g nofiles -d /var/qmail -s /sbin/nologin

[root@mail ucspi-tcp-0.88]# useradd qmaill -g nofiles -d /var/qmail -s /sbin/nologin

[root@mail ucspi-tcp-0.88]# useradd qmailp -g nofiles -d /var/qmail -s /sbin/nologin

[root@mail ucspi-tcp-0.88]# groupadd qmail

[root@mail ucspi-tcp-0.88]# useradd qmailq -g qmail -d /var/qmail -s /sbin/nologin

[root@mail ucspi-tcp-0.88]# useradd qmailr -g qmail -d /var/qmail -s /sbin/nologin

[root@mail ucspi-tcp-0.88]# useradd qmails -g qmail -d /var/qmail -s /sbin/nologin

[root@mail ucspi-tcp-0.88]#

[root@mail ucspi-tcp-0.88]# cd /app/src

[root@mail src]# tar -zxf toaster-scripts-0.8.tar.gz

[root@mail src]# cd netqmail-1.05/netqmail-1.05

[root@mail netqmail-1.05]# vi qmail-smtpd.c

void straynewline() { out("553 See ~djb/docs/smtplf.html.\r\n"); flush(); _exit(1); }

[root@mail netqmail-1.05]# ln -s /usr/kerberos/include/com_err.h /usr/kerberos/include/krb5.h /usr/kerberos/include/profile.h /usr/include/

[root@mail netqmail-1.05]#

[root@mail netqmail-1.05]# rm -rf /usr/sbin/sendmail

[root@mail netqmail-1.05]# make

[root@mail netqmail-1.05]# make setup check

开启SPF设置

[root@mail netqmail-1.05]# echo 3 > /var/qmail/control/spfbehavior

设置管理员的邮箱地址

[root@mail netqmail-1.05]# cd /var/qmail/alias

[root@mail alias]# echo "admin@happy.com" > .qmail-postmaster

[root@mail alias]# echo "admin@happy.com" > .qmail-mailer-daemon

[root@mail alias]# echo "admin@happy.com" > .qmail-root  (移机后重做)

[root@mail alias]# chmod 644 /var/qmail/alias/.qmail-*

[root@mail alias]#

[root@mail alias]# echo ./Maildir/ > /var/qmail/control/defauledelivery

[root@mail alias]# cd /app/src/netqmail-1.05/netqmail-1.05

[root@mail netqmail-1.05]# ./config-fast mail.happy.com

Your fully qualified host name is mail.happy.com.

Putting mail.happy.com into control/me...

Putting happy.com into control/defaultdomain...

Putting happy.com into control/plusdomain...

Putting mail.happy.com into control/locals...

Putting mail.happy.com into control/rcpthosts...

Now qmail will refuse to accept SMTP messages except to mail.happy.com.

Make sure to change rcpthosts if you add hosts to locals or virtualdomains!

[root@mail netqmail-1.05]# echo MANPATH /var/qmail/man >> /etc/man.config

 

[root@mail netqmail-1.05]# cd /app/src

 [root@mail src]# cp toaster-scripts-0.8/rc /var/qmail/rc

[root@mail src]# chmod 755 /var/qmail/rc

[root@mail src]# mkdir /var/log/qmail

[root@mail src]# cp toaster-scripts-0.8/qmailctl /var/qmail/bin/

[root@mail src]# chmod 755 /var/qmail/bin/qmailctl

[root@mail src]# ln -s /var/qmail/bin/qmailctl /usr/bin

[root@mail src]# ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

[root@mail src]# ln -s /var/qmail/bin/sendmail /usr/lib/sendmail

 

[root@mail src]# mkdir -p /var/qmail/supervise/qmail-send/log

[root@mail src]# mkdir -p /var/qmail/supervise/qmail-smtpd/log

[root@mail src]# mkdir -p /var/qmail/supervise/qmail-pop3d/log

[root@mail src]# mkdir -p /var/qmail/supervise/qmail-pop3ds/log

[root@mail src]# cp /app/src/toaster-scripts-0.8/send.run /var/qmail/supervise/qmail-send/run

[root@mail src]# cp /app/src/toaster-scripts-0.8/send.log.run /var/qmail/supervise/qmail-send/log/run

[root@mail src]# cp /app/src/toaster-scripts-0.8/smtpd.run /var/qmail/supervise/qmail-smtpd/run

[root@mail src]# cp /app/src/toaster-scripts-0.8/smtpd.log.run /var/qmail/supervise/qmail-smtpd/log/run

[root@mail src]# cp /app/src/toaster-scripts-0.8/pop3d.run /var/qmail/supervise/qmail-pop3d/run

[root@mail src]# cp /app/src/toaster-scripts-0.8/pop3d.log.run /var/qmail/supervise/qmail-pop3d/log/run

 [root@mail src]# cp /app/src/toaster-scripts-0.8/pop3ds.run /var/qmail/supervise/qmail-pop3ds/run

[root@mail src]# cp /app/src/toaster-scripts-0.8/pop3ds.log.run /var/qmail/supervise/qmail-pop3ds/log/run

 

[root@mail src]# echo 20 > /var/qmail/control/concurrencyincoming

[root@mail src]# chmod 644 /var/qmail/control/concurrencyincoming

[root@mail src]# chmod 755 /var/qmail/supervise/qmail-send/run

[root@mail src]# chmod 755 /var/qmail/supervise/qmail-send/log/run

[root@mail src]# chmod 755 /var/qmail/supervise/qmail-smtpd/run

[root@mail src]# chmod 755 /var/qmail/supervise/qmail-smtpd/log/run

[root@mail src]# chmod 755 /var/qmail/supervise/qmail-pop3d/run

[root@mail src]# chmod 755 /var/qmail/supervise/qmail-pop3d/log/run

[root@mail src]# chmod 755 /var/qmail/supervise/qmail-pop3ds/run

[root@mail src]# chmod 755 /var/qmail/supervise/qmail-pop3ds/log/run

[root@mail src]# mkdir -p /var/log/qmail/smtpd

[root@mail src]# mkdir -p /var/log/qmail/pop3d

[root@mail src]# mkdir -p /var/log/qmail/pop3ds

[root@mail src]# chown -R qmaill /var/log/qmail

 

[root@mail src]# ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service

[root@mail src]# sleep 5

[root@mail src]# qmailctl stat

/service/qmail-send: up (pid 29413) 86 seconds

/service/qmail-send/log: up (pid 29415) 86 seconds

/service/qmail-smtpd: up (pid 29416) 86 seconds

/service/qmail-smtpd/log: up (pid 29417) 86 seconds

messages in queue: 0

messages in queue but not yet preprocessed: 0

阅读(871) | 评论(0) | 转发(0) |
0

上一篇:时间同步

下一篇:qmail安装及配置文档2

给主人留下些什么吧!~~