RedHat Enterprise Linux 5.4 搭建完整Postfix 邮件服务器(3)

5、安装httpd-2.2.4
[root @ root] # tar jxvf httpd-2.2.4.tar.bz2
[root @ root] # cd httpd-2.2.4
[root @ ] #./configure --prefix=/usr/local/apache--sysconfdir=/etc/httpd --enable-so --enable-ssl--with-ssl=/usr/local/ssl --enable-track-vars --enable-rewrite--with-zlib --enable-mods-shared=most --enable-suexec  --with-suexec-caller=daemon

[root @ ] # make
[root @ ] # echo "/usr/local/apache/bin/apachectlstart" >>/etc/rc.local(系统启动时服务自动启动)


 

6、安装php-5.2.3
[root @ root] # tar -zvxf php-5.2.3.tar.gz
[root @ root] # mkdir -p /usr/local/php
[root @ root] # cd php-5.2.3
[root @ ] # ./configure--prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs  --with-mysql=/usr/local/mysql--with-mysqli=/usr/local/mysql/bin/mysql_config  --with-xml   --with-png--with-jpeg  --with-zlib  --with-freetype  --with-gd   --enable-track-vars   --enable-mbstring=all

[root @ ] # make
[root @ ] # make install
[root @ ] # cpphp.ini-dist  /usr/local/php/lib/php.ini
注:编辑apache配置文件httpd.conf,以apache支持php
[root @ ] # vi /etc/httpd/httpd.conf
# 添加如下二行
  AddTypeapplication/x-httpd-php  .php
  AddTypeapplication/x-httpd-php-source  .phps
# 定位至DirectoryIndex index.html
  修改为:
  DirectoryIndex  index.php  index.html


 

7、安装 postfix
[root @ root] # groupadd -g 2525 postfix
[root @ root] # useradd -g postfix -u 2525 -s /sbin/nologin -Mpostfix
[root @ root] # groupadd -g 2526 postdrop
[root @ root] # useradd -g postdrop -u 2526 -s /bin/false -Mpostdrop
[root @ root] # tar zxvf postfix-2.4.5.tar.gz
[root @ root] #cd postfix-2.4.5
[root @ ] # make makefiles 'CCARGS=-DHAS_MYSQL-I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL-I/usr/local/sasl2/include/sasl-I/usr/local/BerkeleyDB/include  -DUSE_TLS-I/usr/local/ssl/include/openssl ''AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm-L/usr/local/sasl2/lib -lsasl2 -L/usr/local/BerkeleyDB/lib-L/usr/local/ssl/lib -lssl -lcrypto'

[root @ ] # make
[root @ ] # make install
Install_root: [/]
tempdir: [/usr/local/src/ postfix-2.4.5]
config_directory: [/etc/postfix]
daemon_directory: [/usr/libexec/postfix]
command_directory: [/usr/sbin]
queue_directory: [/var/spool/postfix]
sendmail_path: [/usr/sbin/sendmail]
newaliases_path: [/usr/bin/newaliases]
mailq_path: [/usr/bin/mailq]
mail_owner: [postfix]
setgid_group: [postdrop]  
html_directory: [no]
manpages: [/usr/local/man] 
readme_directory: [no]

上面的选项全部保持默认,直接回车即可。

注:以上几步可能会说找不到libmysqlclient.so.15,只要在postfix目录下搜索libmysqlclient.so.15,把libmysqlclient.so.15拷一个放/usr/lib或者把libmysqlclient.so.15的路径加到ld.so.conf里ldconfig下就OK生成别名二进制文件,这个步骤如果忽略,会造成postfix效率极低:
[root @ ]#  newaliases
配置 postfix
[root @ ] # vi /etc/postfix/main.cf(编辑)
myhostname = mail.linuxidc.com
mydomain = linuxidc.com
myorigin = $mydomain
inet_interfaces = all
mynetworks = 59.64.0.0/16, 127.0.0.0/8
#================Virtual Setting ====================
virtual_mailbox_base = /var/mailbox/
virtual_mailbox_maps=mysql:/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains=mysql:/etc/postfix/mysql/mysql_virtual_domains_maps.cf
virtual_alias_domains =
virtual_alias_maps =mysql:/etc/postfix/mysql/mysql_virtual_alias_maps.cf
virtual_uid_maps = static:2525
virtual_gid_maps = static:2525
virtual_transport = virtual
maildrop_destination_recipient_limit = 1
maildrop_destination_concurrency_limit = 1
#=================Quota Setting ====================
message_size_limit = 14336000
virtual_mailbox_limit = 20971520
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps =mysql:/etc/postfix/mysql/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry,the user's maildir hasoverdrawn his diskspace quota,please Tidy your mailbox and tryagain later.
virtual_overquota_bounce = yes
#=================== Cyrus-sasl=====================
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining, reject_unauth_destination, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sasl_application_name = smtpd
smtpd_banner = Welcome to our $myhostname ESMTP, Warning:Versionnot Available!
[root @ ] # mkdir -p /etc/postfix/mysql
[root @ ] # cd /etc/postfix/mysql
[root @ ] # vi mysql_virtual_alias_maps.cf(新建)
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = alias
select_field = goto
where_field = address
[root @ ] #   vimysql_virtual_mailbox_limit_maps.cf(新建)
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = quota
where_field = username
[root @ ] # vi mysql_virtual_domains_maps.cf(新建)
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = domain
select_field = description
where_field = domain
[root @ ] # vi mysql_virtual_mailbox_maps.cf(新建)
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = maildir
where_field = username


 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://127.0.0.1/wyyjgd.html