Centos install Postfix

###########################################POSTFIX安装文档############

centos6.4搭建postfix+extmail

系统环境Centos6.4 x64

一、安装mysql-5.0.60

yum remove mysql

rm -f /etc/my.cnf

groupadd mysql

useradd -g mysql -s /bin/false -M mysql

tar zxvf mysql-5.0.60.tar.gz

cd mysql-5.0.60

./configure --prefix=/usr/local/mysql --enable-thread-safe-client --enable-local-infile --with-charset=gbk --with-extra-charset=all --with-low-memory

make && make install && echo "ok"

cp support-files/my-medium.cnf /etc/my.cnf

chown -R mysql /usr/local/mysql/var

/usr/local/mysql/bin/mysql_install_db --user=mysql

cp support-files/mysql.server /etc/rc.d/init.d/mysqld

chmod u+x /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig --level 345 mysqld on

service mysqld start

ln -s /usr/local/mysql/bin/* /usr/local/bin

echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf

ldconfig -v

二、安装httpd-2.2.20

yum install openssl openssl-devel

tar jxvf httpd-2.2.20.tar.bz2

cd httpd-2.2.20

./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl ---enable-track-vars --enable-rewrite --with-zlib --enable-mods-shared=most --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/var/www

make && make install && echo "ok"

echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.local(系统启动时服务自动启动)

三、安装php-5.2.17

yum install curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype* patch libxml2

ln -s /usr/lib64/libjpeg.so /usr/lib/

ln -s /usr/lib64/libpng.so /usr/lib/

tar -zvxf php-5.2.17.tar.gz

cd php-5.2.17

./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-openssl --enable-fastcgi --enable-mbstring --enable-force-cgi-redirect --enable-sockets --with-curl --with-gd --with-zlib --with-png-dir --with-freetype-dir --with-jpeg-dir

make && make install && echo "ok"

cp php.ini-dist /usr/local/php/lib/php.ini

注:编辑apache配置文件httpd.conf,以apache支持php

vi /etc/httpd/httpd.conf

1、添加如下二行

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

2、定位至DirectoryIndex index.html

修改为:

DirectoryIndex  index.php index.html

###############################################以上为LAMP安装底层环境支持

四、编译安装POSTFIX

1, 创建运行postfix的用户,组。安装cyrus-sasl

yum install  cyrus-sasl*

groupadd -g 1000 postfix

groupadd -g 1200 postdrop

useradd -u 1000 -g postfix -G postdrop -M -s /sbin/nologin postfix

2, 解压释放源码包,合并补丁包。

yum install  db*-devel

tar zxvf postfix-2.8.3.tar.gz

gunzip postfix-2.8.3-vda-ng.patch.gz

cd postfix-2.8.3

patch -p1 < ../postfix-2.8.3-vda-ng.patch

3, 编译并进行安装。

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/lib64/sasl2 -lsasl2‘

make && make install && echo "ok"

4.配置postfix服务。

#vim /etc/postfix/main.cf

myhostname = mail.upchina.cn

myorigin = $mydomain

mydomain = upchina.cn

mydestination = $myhostname, localhost.$mydomain, localhost

inet_interfaces = 192.168.1.83, 127.0.0.1

Home_mailbox = Maildir/

#postfix check

postfix start

5.添加邮件用户,并测试

groupadd mailusers

useradd -s /sbin/nologin -g mailusers test1

useradd -s /sbin/nologin -g mailusers test2

passwd test1

passwd test2

五、建立虚拟用户数据库。

tar zxvf extman-1.0.1.tar.gz

cd extman-0.2.5/docs/

mysql -u root -p < extmail.sql

mysql -u root -p < init.sql

修改postfix的配置。

vim /etc/postfix/main.cf 添加

#mydestination = $myhostname, localhost.$mydomain, localhost 注释掉这行

broken_sasl_auth_clients = yes

smtpd_recipient_restrictions= permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination

smtpd_sasl_auth_enable = yes

mynetworks = 127.0.0.1

smtpd_sasl_local_domain = $mydomain

smtpd_sasl_security_options = noanonymous

smtpd_sasl_application_name = smtpd

smtpd_banner = Welcome to our $myhostname ESMTP, Warning:Version not Available!

virtual_mailbox_base = /mailbox

virtual_mailbox_maps= mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf

virtual_mailbox_domains=mysql:/etc/postfix/mysql_virtual_domains_maps.cf

virtual_alias_domains =

virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf

virtual_uid_maps = static:1000

virtual_gid_maps = static:1000

#postfix reload

cp mysql_virtual_* /etcc/postfix/

五,设置用户认证。

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

chmod 755 /usr/local/courier-authlib/var/spool/authdaemon(这一步需注意,这一步若没有,则会出现authdaemon权限拒绝。)

修改authdaemonrc主配置文件,仅保留authmysql认证方式,去掉其它方式。

cd /usr/local/courier-authlib/etc/authlib/

vim authdaemonrc

authmodulelist="authmysql"

authmodulelistorig="authmysql"

daemons=10

DEBUG_LOGIN=2

编辑authmysqlrc配置文件

#vim authmysqlrc

MYSQL_SERVER            localhost

MYSQL_USERNAME          extmail

MYSQL_PASSWORD          extmail

MYSQL_SOCKET            /tmp/mysql.sock

MYSQL_PORT              3306

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)

#

cp courier-authlib.sysvinit /etc/rc.d/init.d/courier-authlib

chmod 755 /etc/rc.d/init.d/courier-authlib

chkconfig --add courier-authlib

chkconfig courier-authlib on

echo "/usr/local/courier-authlib/lib/courier-authlib" >> /etc/ld.so.conf

ldconfig

service courier-authlib start

六、安装Courier-IMAP

tar jxvf courier-imap-4.1.0.tar.bz2

cd courier-imap-4.1.0

./configure --prefix=/usr/local/courier-imap --with-redhat --enable-unicode --disable-root-check --with-trashquota --without-ipv6 CPPFLAGS=‘-I/usr/include/openssl  -I/usr/local/courier-authlib/include‘ LDFLAGS=‘-L/usr/local/courier-authlib/lib/courier-authlib‘ COURIERAUTHCONFIG=‘/usr/local/courier-authlib/bin/courierauthconfig‘

make && make install && echo "ok"

cp /usr/local/courier-imap/etc/imapd.dist /usr/local/courier-imap/etc/imapd

cp /usr/local/courier-imap/etc/imapd-ssl.dist /usr/local/courier-imap/etc/imapd-ssl

cp /usr/local/courier-imap/etc/pop3d.dist /usr/local/courier-imap/etc/pop3d

cp /usr/local/courier-imap/etc/pop3d-ssl.dist /usr/local/courier-imap/etc/pop3d-ssl

配置Courier-IMAP,为用户提供pop3服务:

vi /usr/local/courier-imap/etc/pop3d

#

POP3DSTART=YES

注:如果你想为用户提供IMAP服务,则需在"/usr/local/courier-imap/etc/imapd"文件中设置"IMAPDSTART=yes";其它类同;

#

mkdir /mailbox

chown -R postfix:postfix /mailbox

cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imapd

chmod 755 /etc/rc.d/init.d/courier-imapd

chkconfig --add courier-imapd

chkconfig --level 35 courier-imapd on

service courier-imapd start

修改cyrus sasl设置。

vim /usr/lib64/sasl2/smtpd.conf

#

pwcheck_method: authdaemond

log_level: 3

mech_list:PLAIN LOGIN

authdaemond_path:/usr/local/courier-authlib/var/spool/authdaemon/socket

#

service saslauthd start

建立虚拟用户的邮箱目录,调整权限。

mkdir -p /mailbox/extmail.org/postmaster/Maildir/

cd /mailbox/extmail.org/postmaster/Maildir/

chown -R postfix:postfix /mailbox

测试验证。

/usr/local/courier-authlib/sbin/authtest -s login [email protected] extmail

七、使用extmail及管理平台。

安装并配置extmail套件。

tar zxvf extmail-1.0.5.tar.gz -C /var/www

cd /var/www/

mv extmail-1.0.5 extmail

cd extmail/

chown -R postfix:postfix cgi

cp webmail.cf.default webmail.cf

vim /var/www/extmail/webmail.cf

#

SYS_USER_LANG = zh_CN

SYS_MAILDIR_BASE = /mailbox

SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS = extmail

SYS_MYSQL_HOST = localhost

SYS_MYSQL_SOCKET = /tmp/mysql.sock

SYS_CONFIG = /var/www/extmail

SYS_LANGDIR = /var/www/extmail/lang

SYS_TEMPLDIR = /var/www/extmail/html

SYS_MYSQL_TABLE = mailbox

SYS_AUTHLIB_SOCKET = /usr/local/courier-authlib/var/spool/authdaemon/socket

#

chown postfix:postfix /var/www/extmail/cgi

八、安装Extman

1、安装及基本配置

tar zxvf extman-1.0.1tar.gz

mv extman-1.0.1 /var/www/extman

修改配置文件以符合本例的需要:

vi /var/www/extsuite/extman/webman.cf

#

SYS_MAILDIR_BASE = /mailbox

SYS_CONFIG = /var/www/extmail

SYS_LANGDIR = /var/www/extmail/lang

SYS_TEMPLDIR = /var/www/extmail/html

SYS_MYSQL_USER = webman

SYS_MYSQL_PASS = webman

SYS_MYSQL_DB = extmail

SYS_MYSQL_HOST = localhost

SYS_MYSQL_SOCKET = /tmp/mysql.sock

SYS_LANG = zh_CN

#

chown postfix:postfix /var/www/extman/cgi

mkdir /tmp/extman

chown -R postfix.postfix /tmp/extman/

调整http.conf文件中的配置(添加一个虚拟主机),并重新启动服务程序

vim /etc/httpd/http.conf

#

User postfix

Group postfix

Include /etc/httpd/extra/httpd-vhosts.conf

#

vim /etc/httpd/extra/httpd-vhosts.conf

#

<VirtualHost *:80>

ServerName mail.upchina.cn

DocumentRoot /var/www/extmail/html/

ScriptAlias /extmail/cgi /var/www/extmail/cgi

Alias /extmail /var/www/extmail/html

ScriptAlias /extman/cgi /var/www/extman/cgi

Alias /extman /var/www/extman/html

</VirtualHost>

#

apache start

游览器访问 mail.upchina.cn,/extman添加一个域,默认管理员账号root,密码:extmail*123*并且添加用户测试

时间: 2024-11-09 05:59:42

Centos install Postfix的相关文章

CentOS install Desktop and Remotely access 远程管理Centos桌面 TigerVNC

Centos 安装完毕,但是通过windows 远程管理桌面: 当然我们可以通过secureCRT工具连接命令行,但是我希望通过windows 连接他们的远程桌面: 首先我们的保证 X windows等桌面环境安装成功: yum groupinstall -y "Desktop"   "Desktop Platform"   "Desktop Platform Development" "Fonts" "Genera

CentOS使用Postfix发送邮件

1)配置hosts映射 [[email protected] ~]# ifconfig ens33 ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.2.3.11 netmask 255.255.255.0 broadcast 10.2.3.255 inet6 fe80::20c:29ff:fec1:6505 prefixlen 64 scopeid 0x20<link> ether 00:0c:2

centos下 postfix + extmail + dovecot + maildrop 安装笔记2014更新

本文最初是2008年发表的,最近几天照此笔记又安装了一遍系统,这里更新一下记录. 作者:wangdy 安装环境是CentOS 6.5,拿到服务器的时候只有根目录的分区.邮件准备存储到 /var/mailbox 下.有条件的建议对 /var/spool/postfix 和 /var/vmail 进行了单独分区. /var/spool/postfix 是postfix存储队列的地方, /var/vmail 是用来存储邮件的. CentOS提供了很方便的yum在线安装,我的基本原则是非重要.对版本不敏

centos配置postfix邮件服务

1.环境初始化 [[email protected] ~]# rpm -q centos-release //查看系统版本 centos-release-7-5.1804.el7.centos.x86_64 [[email protected] ~]# vi /etc/hostname //将主机名更改为邮件服务器域名mail.test.com [[email protected] ~]# systemctl disable firewalld //禁止防火墙开机自启动 [[email prot

Install postfix on Ubuntu 14.04.txt

Ubuntu 14.04上安装和配置Postfix邮件服务详细教程 Postfix: 用来接受和发送邮件的邮件服务器,正确说法应该叫邮件传送代理(Mail Transfer Agent,MTA),是邮件服务最重要的部分:    Dovecot: POP 和 IMAP 服务器,用来管理本地邮件目录以便用户能通过 Mail.app, Thunderbird, Mutt 等邮件客户端(又叫邮件用户代理 Mail User Agent, MUA)登陆和下载邮件:    Postgrey: 邮件灰名单工具

linux(CentOS)之postfix服务器Dovecot接收邮件

一.安装Dovecot来接收邮件,使用rpm方式安装完dovecot软件以后,需要经过一些修改才能正常使用. 首先,直接使用系统的yum源安装dovecot yum install dovecot 修改配置文件 1. 在/etc/dovecot/dovecot.conf中修改 protocols = imap pop3 lmtp    支持的协议 login_trusted_networks = 192.168.10.0/24   //指定允许登录的网段地址 这样在使用outlook客户端登录的

centos install shutter (How to enable Nux Dextop repository on CentOS or RHEL)

http://ask.xmodulo.com/enable-nux-dextop-repository-centos-rhel.html Question: I would like to install a RPM package which is available only in Nux Dextop repository. How can I set up Nux Dextop repository on CentOS or RHEL? Nux Dextop is a third-par

centos install jdk

方法一:手动解压JDK的压缩包,然后设置环境变量 1.在/usr/目录下创建java目录  [[email protected] ~]# mkdir/usr/java [[email protected] ~]# cd /usr/java 2.下载,然后解压 [[email protected] java]# curl -O http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz [[email

centos Install Docker

安装必备软件 yum -y install iptables  iptables-services net-tools vim wget 安装Dockeryum -y install docker 下载centos镜像docker pull centos 查看centos 镜像docker images centos 运行一个Docker容器docker run -i -t centos /bin/bash 搜索Ubuntu镜像docker search Ubuntu 显示正在运行的容器(需要先