分类: LINUX
2009-09-01 22:43:26
请尊重作者劳动,复制转载此文档时,请保留或添加文档来源。版权:开源易有()
[*]base 我选择的是最小安装base 所以一些编译器什么的都没安装。
[*]devlopment libraries 用的是centos.ustc.edu.cn的源
[*]development tools
[*]editors
[*]text-base internet
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# wget CentOS-Base.repo.ta139
[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
[root@localhost yum.repos.d]# mv CentOS-Base.repo.ta139 CentOS-Base.repo
[root@localhost ~]# yum -y install httpd httpd-devel mysql mysql-devel mysql-server php php-xml php-cli php-pdo php-mbstring php-mcrypt php-gd php-common php-devel php-mysql
[root@localhost ~]# chkconfig --level 345 mysqld on
[root@localhost ~]# chkconfig --level 345 httpd on
[root@localhost ~]# service mysqld start
[root@localhost ~]# service httpd start
[root@localhost ~]# wget
[root@localhost ~]# tar xjf phpMyAdmin-2.11.9-all-languages-utf-8-only.tar.bz2
[root@localhost ~]# mv phpMyAdmin-2.11.9-all-languages-utf-8-only /var/www/html/phpmyadmin
[root@localhost phpmyadmin]# cp config.sample.inc.php config.inc.php
$cfg['blowfish_secret'] = 'skssiwksksie'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
[root@localhost ~]# tar zxf extman-0.2.5b1.tar.gz
[root@localhost ~]# cd extman-0.2.5b1/docs/
[root@localhost docs]# mysql -uroot -pEnter password:
[root@localhost docs]# mysql -uroot -pEnter password:
在这里我修改了init.sql 把里面的extmail.org改成icaot.com
[root@localhost ~]# export RPMS=/usr/src/redhat/RPMS
[root@localhost ~]# export SOURCE=/usr/src/redhat/SOURCES
[root@localhost ~]# export SPEC=/usr/src/redhat/SPECS
[root@localhost ~]# yum -y install postgresql-devel expect libtool-ltdl-devel
[root@localhost ~]# wget
[root@localhost ~]# tar xjf courier-authlib-0.61.0.tar.bz2
[root@localhost ~]# cd courier-authlib-0.61.0
[root@localhost courier-authlib-0.61.0]# cp courier-authlib.spec $SPEC
[root@localhost courier-authlib-0.61.0]# cd ..
[root@localhost ~]# cp courier-authlib-0.61.0.tar.bz2 $SOURCE
[root@localhost ~]# cd $SPEC
[root@localhost SPECS]# rpmbuild -bb courier-authlib.spec (创建rpm文件)
[root@localhost SPECS]# cd $RPMS/i386
[root@localhost i386]# rpm -ivh courier-authlib-0.61.0-1.i386.rpm
[root@localhost i386]# rpm -ivh courier-authlib-devel-0.61.0-1.i386.rpm
[root@localhost i386]# rpm -ivh courier-authlib-mysql-0.61.0-1.i386.rpm
[root@localhost i386]# cd /etc/authlib/
[root@localhost authlib]# mv authdaemonrc authdaemonrc.bak
[root@localhost authlib]# vim authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=10
authdaemonvar=/var/spool/authdaemon
DEBUG_LOGIN=2
DEFAULTOPTIONS="wbnodsn=1"
LOGGEROPTS=""
[root@localhost authlib]# mv authmysqlrc authmysqlrc.bak
[root@localhost authlib]# vim authmysqlrc
MYSQL_SERVER localhost
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_PORT 0
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_OPT 0
MYSQL_DATABASE extmail
MYSQL_SELECT_CLAUSE SELECT username,password,"",uidnumber,gidnumber,\
CONCAT('/home/data/domains/',homedir), \
CONCAT('/home/data/domains/',maildir), \
quota, \
name \
FROM mailbox \
WHERE username = '$(local_part)@$(domain)'
[root@localhost ~]# service courier-authlib start
Starting Courier authentication services: authdaemond
[root@localhost ~]# chmod 777 /var/spool/authdaemon/
[root@localhost ~]# useradd yiyou 在这里添加自己的用户
[root@localhost ~]# yum -y install openldap-servers
[root@localhost ~]# su - yiyou [yiyou@localhost ~]$ mkdir -p rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
[yiyou@localhost ~]$ vim ~/.rpmmacros
%_topdir /home/yiyou/rpm
[yiyou@localhost ~]$ wget
[yiyou@localhost ~]$ cp courier-imap-4.4.1.tar.bz2 rpm/SOURCES/
[yiyou@localhost ~]$ tar xjf courier-imap-4.4.1.tar.bz2
[yiyou@localhost ~]$ cd courier-imap-4.4.1
[yiyou@localhost courier-imap-4.4.1]$ cp courier-imap.spec ../rpm/SPECS/
[yiyou@localhost courier-imap-4.4.1]$ cd ../rpm/SPECS/
%if %suse_version
BuildPreReq: rpm >= 3.0.5 /usr/bin/sed openldap2 openldap2-devel %([ %{suse_version} -gt 819 ] && echo /usr/include/fam.h)
%else
BuildPreReq: rpm >= 4.0.2 sed /usr/include/fam.h openldap-devel openldap-servers
%endif
%if %suse_version 在这里好像提示没有安装openldap-server yum install openldap* 还真没装
BuildPreReq: rpm >= 3.0.5 /usr/bin/sed openldap2 openldap2-devel
%else
BuildPreReq: rpm >= 4.0.2 sed openldap-devel openldap-servers
%endif
[yiyou@localhost SPECS]$ rpmbuild -bb courier-imap.spec
[root@localhost ~]# rpm -ivh /home/yiyou/rpm/RPMS/i386/courier-imap-4.4.1-1.i386.rpm
[root@localhost ~]# service courier-imap start
[root@localhost ~]# wget ftp://194.199.20.114/linux/fedora/updates/8/SRPMS/cyrus-sasl-2.1.22-8.fc8.src.rpm
[root@localhost ~]# rpm -ivh cyrus-sasl-2.1.22-8.fc8.src.rpm
[root@localhost ~]# cd $SPEC
# Bundling copy of Berkeley DB, for sasldb support.
topdir=`pwd`
pushd db-%{db_version}/build_unix
../dist/configure \
--with-mutex=UNIX/fcntl --disable-shared --enable-static --with-pic \
--with-uniquename=_cyrus_sasl_sasldb_rh \
--prefix=${topdir}/db-instroot \
--includedir=${topdir}/db-instroot/include \
--libdir=${topdir}/db-instroot/lib
# Bundling copy of Berkeley DB, for sasldb support.
topdir=`pwd`
pushd db-%{db_version}/build_unix
../dist/configure \
--with-mutex=UNIX/fcntl --disable-shared --enable-static --with-pic \
--with-uniquename=_cyrus_sasl_sasldb_rh \
--prefix=${topdir}/db-instroot \
--includedir=${topdir}/db-instroot/include \
--libdir=${topdir}/db-instroot/lib \
--with-authdaemond=/var/spool/authdaemon
提示下面的故障的请看上面--with-authdaemond=/var/spool/authdaemon: No such file or directory 少了各斜杠所以看不到这个选项
Cannot enable LDAPDB plugin: Could not locate OpenLDAP
因为没有安装oepnldap 客户端什么的。装上就行了
[root@localhost SPECS]# rpmbuild -bb cyrus-sasl.spec
[root@localhost RPMS]# cd $RPMS/i386
[root@localhost i386]# rpm -e --nodeps cyrus-sasl-devel cyrus-sasl-plain cyrus-sasl cyrus-sasl-lib (如果这些包存在)
[root@localhost i386]# rpm -ihv cyrus-sasl-lib-2.1.22-8.i386.rpm
[root@localhost i386]# rpm -ihv cyrus-sasl-2.1.22-8.i386.rpm
[root@localhost i386]# rpm -ihv cyrus-sasl-plain-2.1.22-8.i386.rpm
pwcheck_method:authdaemond
log_level:3
mech_list:PLAIN LOGIN
authdaemond_path:/var/spool/authdaemon/socket
[root@localhost i386]# cd
[root@localhost ~]# wget
[root@localhost ~]# rpm -ivh postfix-2.5.4-2.src.rpm
[root@localhost ~]# cd $SPEC
%define distribution rhel-5.0
%define with_mysql_redhat 1
%define with_sasl 2
%define with_vda 1
[root@localhost SPECS]# rpmbuild -bb postfix.spec
[root@localhost RPMS]# cd $RPMS/i386
[root@localhost i386]# rpm -ivh postfix-2.5.4-2.rhel4.i386.rpm
[root@localhost i386]# alternatives --config mta (选择2,postfix)
[root@localhost i386]# rpm -e sendmail
[root@localhost i386]# cd /usr/sbin/
[root@localhost sbin]# mv sendmail sendmail.bak
[root@localhost sbin]# newaliases
[root@localhost sbin]# ln -s sendmail.postfix sendmail
[root@localhost ~]# cd /etc/postfix/
[root@localhost postfix]# mv main.cf main.cf.bak
[root@localhost postfix]# vim main.cf
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = /usr/share/doc/postfix-2.5.2-documentation/html
manpage_directory = /usr/share/man
sample_directory = /etc/postfix
readme_directory = /usr/share/doc/postfix-2.5.2-documentation/readme
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
myhostname = mail.yiyou.org
mydomain = yiyou.org
mydestination = $myhostname
smtpd_banner = yiyou.org ESMTP Mail System
message_size_limit = 14680064
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_base = /home/data/domains
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_limit_maps.cf
virtual_transport = maildrop:
maildrop_destination_recipient_limit = 1
#sasl
smtpd_sasl_auth_enable = yes
smtpd_sasl2_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_unauth_pipelining,
reject_invalid_hostname
[root@localhost postfix]# cp /root/extman-0.2.5b1/docs/mysql_virtual_* .
[root@localhost postfix]# service postfix start
[root@localhost postfix]# cd
[root@localhost ~]# wget
[root@localhost ~]# cp maildrop-2.0.4.tar.bz2 $SOURCE
[root@localhost ~]# tar xjf maildrop-2.0.4.tar.bz2
[root@localhost ~]# cd maildrop-2.0.4
[root@localhost maildrop-2.0.4]# cp maildrop.spec $SPEC
[root@localhost maildrop-2.0.4]# cd $SPEC
BuildRequires: /usr/include/fam.h gdbm-devel pcre-devel
BuildRequires: gdbm-devel pcre-devel
%configure --with-devel --enable-userdb --enable-maildirquota \
--enable-syslog=1 --enable-trusted-users='root mail daemon postmaster qmaild mmdf' \
--enable-restrict-trusted=0 \
--enable-sendmail=/usr/sbin/sendmail
%configure --with-devel --enable-userdb --enable-maildirquota \
--enable-syslog=1 --enable-trusted-users='root mail daemon postmaster qmaild mmdf' \
--enable-restrict-trusted=0 --enable-sendmail=/usr/sbin/sendmail \
--enable-authlib
[root@localhost SPECS]# yum -y install pcre-devel
[root@localhost SPECS]# rpmbuild -bb maildrop.spec
[root@localhost SPECS]# cd $RPMS/i386
[root@localhost i386]# rpm -ivh maildrop-2.0.4-1.i386.rpm
[root@localhost i386]# cd 在这里提示已经添加了用户 应该是安装postfix的时候创建的用户
[root@localhost ~]# groupadd -g 1000 vgroup
[root@localhost ~]# useradd -g 1000 -u 1000 -s /sbin/nologin -d /dev/null vuser
maildrop unix - n n - - pipe
flags=DRhu user=vuser argv=/usr/bin/maildrop -d ${user}@${nexthop} ${recipient} ${user} ${extension} ${nexthop}
[root@localhost ~]# mkdir -p /home/data/domains/extmail.org/postmaster
[root@localhost ~]# maildirmake /home/data/domains/extmail.org/postmaster/Maildir
[root@localhost ~]# chown -R vuser:vgroup /home/data/domains/
[root@localhost ~]# echo "test" | maildrop -V 10 -d postmaster@extmail.org
maildrop: authlib: groupid=1000
maildrop: authlib: userid=1000 这里改成自己相应的
maildrop: authlib:,
home=/home/data/domains/extmail.org/postmaster, mail=/home/data/domains/extmail.org/postmaster/Maildir/
maildrop: Changing to /home/data/domains/extmail.org/postmaster
Message start at 0 bytes, envelope sender=postmaster@extmail.org
maildrop: Attempting .mailfilter
maildrop: Delivery complete.
[root@localhost ~]# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Hello there.
user postmaster@extmail.org
+OK Password required.
pass extmail
+OK logged in.
list
+OK POP3 clients that break here, they violate STD53.
1 6
.
retr 1
+OK 6 octets follow.
test
.
quit
+OK Bye-bye.
Connection closed by foreign host.
[root@localhost ~]# perl -MMIME::Base64 -e 'print encode_base64("postmaster\@extmail.org");'
cG9zdG1hc3RlckBleHRtYWlsLm9yZw==
[root@localhost ~]# perl -MMIME::Base64 -e 'print encode_base64("extmail");'
ZXh0bWFpbA==
[root@localhost ~]# service postfix restart (重启一下)
[root@localhost ~]# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 yiyou.org ESMTP Mail System
ehlo test.com
250-mail.yiyou.org
250-PIPELINING
250-SIZE 14680064
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
auth login
334 VXNlcm5hbWU6
cG9zdG1hc3RlckBleHRtYWlsLm9yZw==
334 UGFzc3dvcmQ6
ZXh0bWFpbA==
235 2.7.0 Authentication successful
quit
221 2.0.0 Bye
Connection closed by foreign host
[dag]
name=Dag RPM Repostory for Red Hat Enterprise Linux
baseurl=
gpgcheck=1
enabled=1
gpgkey=
[root@localhost ~]# yum -y install clamav clamav-db clamd clamav-devel amavisd-new
$mydomain = 'yiyou.org'; # a convenient default for other settings
['ClamAV-clamd',
\&ask_daemon, ["CONTSCAN {}\n", "/tmp/clamd.socket"],
qr/\bOK$/, qr/\bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
$final_virus_destiny = D_DISCARD;
$final_banned_destiny = D_BOUNCE;
$final_spam_destiny = D_PASS;/这里原来是bounce直接拒绝,我说我从163发信直接收不到,,分提高到7.多都不行改成pass
$final_bad_header_destiny = D_PASS;
[root@localhost ~]# usermod -G amavis clamav
[root@localhost ~]# service clamd start
smtp-amavis unix - - n - 4 smtp 这里不知道是什么意思。。改天问问键盘
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o receive_override_options=no_header_body_checks
content_filter = smtp-amavis:[localhost]:10024
[root@localhost ~]# service postfix reload
User vuser
Group vgroup
[root@localhost ~]# cd /etc/httpd/conf.d/
[root@localhost conf.d]# vim extmail.conf
Alias /extman/cgi/ /var/www/extsuite/extman/cgi/
Alias /extman /var/www/extsuite/extman/html/
SetHandler cgi-script
Options +ExecCGI
# config for ExtMail
Alias /extmail/cgi/ /var/www/extsuite/extmail/cgi/
Alias /extmail /var/www/extsuite/extmail/html/
SetHandler cgi-script
Options +ExecCGI
[root@localhost ~]# mkdir /var/www/extsuite
[root@localhost ~]# tar zxf extmail-1.0.5b1.tar.gz
[root@localhost ~]# cp -r extmail-1.0.5b1 /var/www/extsuite/extmail
[root@localhost ~]# cp -r extman-0.2.5b1 /var/www/extsuite/extman
[root@localhost ~]# cd /var/www/extsuite/extmail/
[root@localhost extmail]# cp webmail.cf.default webmail.cf
SYS_SESS_DIR = /tmp/extmail
SYS_MAILDIR_BASE = /home/data/domains
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
[root@localhost extmail]# cd /var/www/extsuite/extman/
SYS_MAILDIR_BASE = /home/data/domains
[root@localhost extman]# mkdir /tmp/{extman,extmail}
[root@localhost extman]# chown vuser:vgroup /tmp/ext*
[root@localhost addon]# cd /var/www/extsuite/extman/addon/
[root@localhost addon]# cp -r mailgraph_ext /usr/local/
/usr/local/mailgraph_ext/mailgraph-init start
/usr/local/mailgraph_ext/qmonitor-init start
[root@localhost mailgraph_ext]# yum -y install rrdtool perl-rrdtool perl-GD perl-File-Tail
[root@localhost mailgraph_ext]# /usr/local/mailgraph_ext/qmonitor-init start
Starting queue statistics grapher: qmonitor
[root@localhost mailgraph_ext]# /usr/local/mailgraph_ext/mailgraph-init start
Starting mail statistics grapher: mailgraph_ext
[root@localhost ~]# tar zxf slockd-0.2beta1.tar.gz
[root@localhost ~]# cp -r slockd-0.2beta1 /usr/local/slockd
[root@localhost ~]# cd /usr/local/slockd
/usr/local/slockd/slockd-init start
setsid 1 (去掉注释,让程序成为后台进程)
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_unauth_pipelining,
reject_invalid_hostname
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_unauth_pipelining,
reject_invalid_hostname,
check_policy_service inet:127.0.0.1:10030
[root@localhost slockd]# service postfix relo
这个是因为sasl的pain 模块没有安装
tatus=deferred (connect to localhost[127.0.0.1]:10024: Connection refused
这个是因为amavis 没有启动首先查看有没有10024端口,如果没有则是因为这个原因
Permission denied: exec of '/usr/sbin/suexec
这个是在配置虚拟主机的时候添加了suexecgroup 因为apache的运行都改成vuser 了所以没必要添加
虚拟主机配置文件
NameVirtualHost 192.168.1.100:80
ServerAdmin
ServerName mail.gamebao.net
DocumentRoot /var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
Alias /extmail /var/www/extsuite/extmail/html
ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi
Alias /extman /var/www/extsuite/extman/html
SetHandler cgi-script
Options +ExecCGI
DocumentRoot /var/www/html/
ServerAdmin
ServerName
ServerAlias gamebao.net
关于imap服务编译postfix包时,编译的有问题。所以从网上下载了一个支持sasl mysql 的postfix.rpm
它 的默认uid 是501 gid 1000
配置imap时提示maildrop: Unable to change to home directory.
主要是因为没有权限。先前创建的一个用户因为是uid1000的所以导致整个问题删除,重新建立。修改webman.cf 里的uid 为501 新建用户ok
总得来说部分新软件好久没弄有点手生