apache-mysql-php-postfix-dovecot-squirrelmail-smtp-virtualusers postfix-extman web安装指南

####################apache2 (httpd) install#######################
a.tar zxvf  tar zxvf httpd-2.2.9.tar.gz
b.cd httpd-2.2.9
c../configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-cgi --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/usr/local/apache2/htdocs
d.make && make install
e.cp -pf /usr/local/apache2/bin/apachectl /etc/init.d/httpd

################mysql (mysqld) install#####################
a.useradd -M -s /sbin/nologin mysql
b.tar zxvf  mysql-5.0.56.tar.gz
c.cd mysql-5.0.56/
d../configure --prefix=/usr/local/mysql
e.make && make install
f.cp -f support-files/my-medium.cnf /etc/my.cnf
g.cp support-files/mysql.server /etc/init.d/mysqld
h.chmod a+x /etc/init.d/mysqld
i.chkconfig --add mysqld
j.chkconfig --level 12345 mysqld on
k.cd /usr/local/mysql
l.bin/mysql_install_db --user=mysql
m.chown -R root.mysql ./
n. mkdir var
    chown -R mysql var
o.service mysqld restart
p.vim /etc/ld.so.conf
     /usr/local/mysql/lib/mysql
q.ldconfig
r.vim /etc/profile
    PATH=$PATH:/usr/local/mysql/bin
s./usr/local/mysql/bin/mysqladmin -u root password '123456'
t.


##################php install######################
a.tar jxvf php-5.2.6.tar.bz2
b.cd php-5.2.6
c. ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-sockets --enable-mbstring
d.make && make install
e.cp php.ini-dist /usr/local/php5/php.ini

test httpd&php&mysqld status
a.vim /usr/local/apache2/conf/httpd.conf
    ..............
    DirectoryIndex index.php index.html  (169)
    ..............
    AddType application/x-httpd-php.php   (311)
    ..............
b.service httpd restart
c.vim /usr/local/apache2/htdocs/index.php
<?php
echo "httpd works!";
phpinfo();
?>
e.vim /usr/local/apache2/htdocs/testdb.php
<?php
$link=mysql_connect('localhost','test','');
if(!$link) echo "fail !!";
else echo "success!!";
mysql_close();
?>

test:
elinks http://localhost/index.php
elinks http://localhost/testdb.php


##########postfix install###################

fist: service sendmail stop
        chkconfig --level 12345 sendmail off
a.groupadd -g 1200 postdrop
b.groupadd -g 1000 postfix
c.useradd -M -u 1000 -g postfix -G postdrop -s /sbin/nologin postfix
d.tar zxvf postfix-2.4.6.tar.gz
e.gunzip postfix-2.4.6-vda-ng.patch.gz
f.cd postfix-2.4.6
     patch -p1 < ../postfix-2.4.6-vda-ng.patch
g.make makefiles \
> 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH \
> -DUSE_CYRUS_SASL -I/usr/include/sasl' \
>  'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2 '
h.make
i.make install
j.cd /etc/postfix
    postconf -n > main2.cf
    mv main.cf main.cf.bak
    mv main2.cf main.cf
h.vim /etc/postfix/main.cf
    command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
html_directory = no
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
inet_interfaces = 10.1.1.2, 127.0.0.1
myhostname = mail.jiajia.org
mydomain = jiajia.org
myorigin = $mydomain
mydestination = $mydomain, $myhostname
home_mailbox = Maildir/

i.groupadd mailusers
    useradd -g mailusers -s /sbin/nologin xiaoqi
    useradd -g mailusers -s /sbin/nologin lisi
    passwd xiaoqi
    passwd lisi
    
j.you can use the user xiaoqi 'telnet localhost 25' send a test mail to lisi
  and cat /home/lisi/Maildir/new/****
###############dovecot install ###############
a.useradd -M -s /sbin/nologin dovecot
b.tar zxvf dovecot-1.1.4.tar.gz
c. cd dovecot-1.1.4
d../configure --sysconfdir=/etc --with-mysql
e.make && make install
f.cp /etc/dovecot-example.conf /etc/dovecot.conf
g.vim /etc/dovecot.conf
    ssl_disable = yes  (87)
    protocols = pop3 imap  (24)
    disable_plaintext_auth = no (48)
    mail_location = maildir:~/Maildir (209)
h.vim /etc/pam.d/dovecot
auth        required    pam_nologin.so
auth        include    system-auth
account    include    system-auth
session     include    system-auth
i.Start the dovecot service and verify that the listening port
    /usr/local/sbin/dovecot -c /etc/dovecot.conf
    netstat -anpl|grep dovecot
j.You can test just can not receive the letter of the lisi
  telnet localhost 110
k.now you can use outlook to send and receive e-mail

##############squirrelmail install #################
a.tar jxvf squirrelmail-1.4.13.tar.bz2 -C /usr/local/apache2/htdocs/
b.cd /usr/local/apache2/htdocs/
     mv squirrelmail-1.4.13/ webmail
    cd webmail/
    tar jxvf ~/Desktop/zh_CN-1.4.13-20071220.tar.bz2
c.mkdir -p attach data
    chown -R daemon:daemon attach/ data/
    chmod 730 attach/
    cp config/config_default.php  config/config.php
d.vim config/config.php
    $squirrelmail_default_language = 'zh_CN';
    $default_charset = 'zh_CN.UTF-8';
    $domain = 'jiajia.org';
    $smtpServerAddress = 'localhost';
    $smtpPort = 25;
    $imap_server_type = 'dovecot';
    $imapPort = 143;
    $data_dir = '/usr/local/apache2/htdocs/webmail/data/';
    $attachment_dir = '/usr/local/apache2/htdocs/webmail/attach/';

e. Now you can use IE to open to send and receive emails squirrelmail
     http://localhost/webmail/

#################Set the smtp user authentication################
a.rpm -qa |grep cyrus
b.cp /usr/lib/sasl2/Sendmail.conf  /usr/lib/sasl2/smtpd.conf
c.service saslauthd start
d.chkconfig --level 12345 saslauthd on
e. vim /etc/postfix/main.cf    (As follows)
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
mynetworks = 127.0.0.1
smtpd_recipient_restrictions =
 permit_mynetworks,
 permit_sasl_authenticated,
 reject_unauth_destination

f. test the authentication
    printf  "xiaoqi" | openssl base64
    printf  "1" | openssl base64
g.Now this based on local user postfix mail system has been set up successfully!!!!!




##################The virtual users postfix Advanced   install#####################
a.service mysqld restart
b.tar zxvf extman-0.2.5.tar.gz
c. cd extman-0.2.5/docs/
    mysql -u root -p < extmail.sql
    mysql -u root -p < init.sql
d.vim /etc/postfix/main.cf            (Add content as follows)
#mydestination = $mydomain, $myhostname                
virtual_mailbox_base = /mailbox
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
header_checks = regexp:/etc/postfix/header_checks
e.cp mysql_virtual_* /etc/postfix/
f.cd /root/Desktop/LNS-SG7/
g.tar jxvf courier-authlib-0.60.2.tar.bz2
    cd courier-authlib-0.60.2
     ./configure --prefix=/usr/local/courier-authlib --without-stdheaderdir --with-authmysql --with-redhat --with-mysql-libs=/usr/local/mysql/lib/mysql --with-mysql-includes=/usr/local/mysql/include/mysql
    make && make install
    make install-configure
h. echo '/usr/local/courier-authlib/lib/courier-authlib' >> /etc/ld.so.conf
i.    ldconfig
j.cd /usr/local/courier-authlib/etc/authlib/
    cp authdaemonrc authdaemonrc.bak
    rm -rf authdaemonrc
    grep -v '^#' authdaemonrc.bak|grep -v '^$' > authdaemonrc
k.vim authdaemonrc      (Add content as follows)
authmodulelist="authmysql"
authmodulelistorig="authmysql"
daemons=5
authdaemonvar=/usr/local/courier-authlib/var/spool/authdaemon
DEBUG_LOGIN=0
DEFAULTOPTIONS=""
LOGGEROPTS=""
l.chmod -R 755 /usr/local/courier-authlib/var/spool/authdaemon/
m.cp authmysqlrc authmysqlrc.bak
    rm -rf authmysqlrc
    grep -v '^#' authmysqlrc.bak|grep -v '^$' > authmysqlrc
n.vim authmysqlrc
MYSQL_SERVER            localhost
MYSQL_USERNAME          extmail
MYSQL_PASSWORD          extmail
MYSQL_SOCKET            /tmp/mysql.sock
MYSQL_PORT              0
MYSQL_OPT               0
MYSQL_DATABASE          extmail
MYSQL_USER_TABLE        mailbox
MYSQL_CRYPT_PWFIELD     password
MYSQL_UID_FIELD         uidnumber
MYSQL_GID_FIELD         gidnumber
MYSQL_LOGIN_FIELD       username
MYSQL_HOME_FIELD        concat('/mailbox/',homedir)
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD     concat('/mailbox/',maildir)
o.cp /root/Desktop/LNS-SG7/courier-authlib-0.60.2/courier-authlib.sysvinit /etc/init.d/courier-authlib
p.chmod 755 /etc/init.d/courier-authlib
q.chkconfig --level 122345 courier-authlib on
r.service courier-authlib start
s.vim /usr/lib/sasl2/smtpd.conf              (Add content as follows)
    pwcheck_method:authdaemond
   authdaemond_path: /usr/local/courier-authlib/var/spool/authdaemon/socket
##############Dovecot configuration changes#####################

a.cp /etc/dovecot.conf  /etc/dovecot.conf.bak
b.grep -v '^#' /etc/dovecot.conf.bak |grep -v '^$' > /etc/dovecot.conf
c.vim /etc/dovecot.conf               (Add content as follows)
protocols = pop3 imap
disable_plaintext_auth = no
ssl_disable = yes
mail_location = maildir:/mailbox/%d/%n/Maildir
protocol imap {
}
protocol pop3 {
}
protocol lda {
  postmaster_address = postmaster@example.com
}
auth default {
        mechanisms = plain
        passdb sql {
        args = /etc/dovecot-mysql.conf
}
        userdb sql {
        args = /etc/dovecot-mysql.conf
}
}
dict {
}
plugin {
}
d. vim /etc/dovecot-mysql.conf        (Add content as follows)
driver = mysql
connect = host=localhost dbname=extmail user=extmail password=extmail
default_pass_scheme = CRYPT
password_query = SELECT username AS user,password AS password FROM mailbox WHERE username = '%u'
user_query = SELECT maildir, uidnumber AS uid, gidnumber AS gid FROM mailbox WHERE username = '%u'
e. mkdir -p /mailbox/extmail.org/postmaster/Maildir/
    chown -R postfix:postfix /mailbox
f.killall dovecot
    dovecot
g.(Test virtual users to achieve results)
    /usr/local/courier-authlib/sbin/authtest -s login postmaster@extmail.org extmail
h.(SMTP virtual user testing of the certification letter)
printf "postmaster@extmail.org" |openssl base64
printf "extmail" |openssl base64
%%%%
[root@jiajia Maildir]# printf "postmaster@extmail.org" |openssl base64
cG9zdG1hc3RlckBleHRtYWlsLm9yZw==
[root@jiajia Maildir]# printf "extmail" |openssl base64
ZXh0bWFpbA==
[root@jiajia Maildir]# telnet localhost 25
Trying 127.0.0.1...
Connected to jiajia.org (127.0.0.1).
Escape character is '^]'.
220 mail.jiajia.org ESMTP Postfix
auth login
334 VXNlcm5hbWU6
cG9zdG1hc3RlckBleHRtYWlsLm9yZw==
334 UGFzc3dvcmQ6
ZXh0bWFpbA==
235 2.0.0 Authentication successful
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@jiajia Maildir]#
%%%%
################E-mail user interface deployment extmail##########################
a.tar zxvf Unix-Syslog-1.1.tar.gz
  tar zxvf DBI-1.607.tar.gz
  tar zxvf DBD-mysql-4.011.tar.gz
b.cd Unix-Syslog-1.1
    perl Makefile.PL
    make && make install
c.cd ../DBI-1.607
    perl Makefile.PL
    make && make install
d.cd ../DBD-mysql-4.011
    perl Makefile.PL
    make && make install
e.tar zxvf extmail-1.0.5.tar.gz -C /usr/local/apache2/htdocs/
    cd /usr/local/apache2/htdocs/
    mv extmail-1.0.5/ extmail
f.cd extmail/
    chown -R postfix:postfix cgi
g.cp webmail.cf.default webmail.cf
h.vim webmail.cf
SYS_CONFIG = /usr/local/apache2/htdocs/extmail/
SYS_LANGDIR = /usr/local/apache2/htdocs/extmail/lang
SYS_TEMPLDIR = /usr/local/apache2/htdocs/extmail/html
SYS_MAILDIR_BASE = /mailbox
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_DB = extmail
SYS_MYSQL_HOST = localhost
SYS_MYSQL_SOCKET = /tmp/mysql.sock
i.(Add a virtual host httpd)
    vi /usr/local/apache2/conf/httpd.conf
NameVirtualHost 10.1.1.2
<Virtualhost 10.1.1.2>
        Servername mail.jiajia.org
        DocumentRoot /usr/local/apache2/htdocs/extmail/html/
        ScriptAlias /extmail/cgi /usr/local/apache2/htdocs/extmail/cgi/
        Alias /extmail /usr/local/apache2/htdocs/extmail/html/
        SuexecUserGroup postfix postfix
</VirtualHost>
j. /usr/local/apache2/bin/apachectl restart
k.(now you can login and use extmail) username:postfix  password:extmail  domin:extmail.org
http://mail.jiajia.org/extmail   

^_^ Enjoy^_^

################Deployment extman web management interface###########################
a. tar zxvf GD-2.41.tar.gz
b.tar zxvf File-Tail-0.99.3.tar.gz
c.cd GD-2.41
    perl Makefile.PL
    make && make install
d.cd ../ File-Tail-0.99.3
    perl Makefile.PL
    make && make install
e.rpm -ivh rrdtool-1.2.23-3.el5.i386.rpm
  rpm -ivh rrdtool-perl-1.2.23-3.el5.i386.rpm
f. tar zxvf extman-0.2.5.tar.gz -C /usr/local/apache2/htdocs/
    cd /usr/local/apache2/htdocs/
    mv extman-0.2.5/ extman
g. chown -R postfix:postfix /usr/local/apache2/htdocs/extman/cgi/
    mkdir /tmp/extman
    chown -R postfix:postfix /tmp/extman/
h.vim /usr/local/apache2/htdocs/extman/webman.cf
    SYS_CONFIG = /usr/local/apache2/htdocs/extman/
    SYS_LANGDIR = /usr/local/apache2/htdocs/extman/lang
    SYS_TEMPLDIR = /usr/local/apache2/htdocs/extman/html
    SYS_MAILDIR_BASE = /m
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值