Postfix配置Step By Step(一)
2008-01-05 20:42
330 查看
很早就想试下Linux下的Postfix服务,也看了网上很多相关的教程,但是每当我看到那长长的篇幅就打退堂鼓了,但是有些东西在技术的道路上始终是要经历和面对的,这些天就一直在鼓捣着这东东,现在把自已的经历写出来,希望能对大家有点用.对于大侠来讲,这些算不了什么,但至少相对我这种还在Linux门外徊徘的人来说,它是我学习的一个历程.其中 蓝色字体需用户输入,白色字体是系统显示,红色字体是我加入的说明。
系统相关
http://search.cpan.org/search ,然后在搜索栏中输入下列相关的模块,如要下载URI,方法见下图,其它的类同. 安装时请按从前往后从左向右的先后顺序进行。
卸载系统原有组件
因为这里的安装方式都是采用源码,所以如果系统中存在旧有的版本,则会引起冲突,这里要做的是把一些和源码包冲突的软件卸载.在使用命令进行查询时,当执行完命令后没有提示则表示系统未安装查询的组件,否则请卸载查询出来的组件。
1:安装
安装这个软件的原因是因为后面的Perl组件包中必须要有它的支持才能进行下去,所以这个是不能省的. 1:安装
安装Apache有两个要注意的地方,因为我这里用的Postfix的后台管理是extman这个程序,而它是通过CGI的方式来进行管理的,所以这里启用了suexec的功能,还有一个是关于网站的存放路径的,如果不指定,那么在启用suexec后会出现 suexec-docroot的错误。 1:安装
GD库的主要作用是配置相关的图形及字符的正确显示,包括类似验证码的功能和后面的图形日志的显示. 1:安装libpng
系统相关
hostname //主机名称 cat /proc/version //系统版本 ifconfig eth0 //IP地址软件相关
http://search.cpan.org/search ,然后在搜索栏中输入下列相关的模块,如要下载URI,方法见下图,其它的类同. 安装时请按从前往后从左向右的先后顺序进行。
1 | 2 | 3 | 4 | 5 |
BerKeleyDB | Comperss-Raw-zlib | IO-Compress-Base | IO-Compress-Zlib | Compress-Zlib |
IO-Zlib | Array-Compcre | Sub-Updevel | Test-Simple | Test-Exception |
Tree-Dag-Node | Test-Warn | Net-SsLeay | IO-Socket-SSL | IO-String |
Algorithm-Diff | Text-Diff | Archive-Tar | Archive-Zip | DBI |
DBD-Mysql | IO-Socket-INET6 | IP-country | File-Temp | NetAddr-IP |
NET-CIDR-Lite | NET-IP | NET-Ident | Digest-SHA | Digest-SHAL |
Digest-HMAC | NET-DNS | Version | NET-DNS-Resolver -Programmable | HTML-Tagset |
HTML-Parser | Extutils-CBuilder | Encode-Detect | Extutils-Parsexs | Error |
GD | GD-securityImage | GD-securityImage -util | Unix-Syslog | Sys-Hostname -Long |
Regexp-Common | URI | Mail-SPF | Mail-SPF-Query | TimeDate |
Pod-Escapes | Pod-Simple | Test-Pod | MailTools | Mail-DKIM |
Crypt-Openssl- Random | Crypt-Openssl-RSA | Mail-DomainKeys | MIME-Tools | Libww-Perl |
SpamAssassin | Convery-TNEF | Convert-UUlib | NET-Server | Time-HiRes |
File-Tail | Log-Log4perl | 22.1 Socket6-0.19 | 41.1 PerlMagick |
因为这里的安装方式都是采用源码,所以如果系统中存在旧有的版本,则会引起冲突,这里要做的是把一些和源码包冲突的软件卸载.在使用命令进行查询时,当执行完命令后没有提示则表示系统未安装查询的组件,否则请卸载查询出来的组件。
rpm -qa | grep httpd //查询是否已安装软件 rpm -qa | grep mysql rpm -qa | grep php rpm -qa |grep sasl rpm -e --nodeps cyrus-sasl-md5-2.1.19-5.EL4 cyrus-sasl-2.1.19-5.EL4 \ cyrus-sasl-plain-2.1.19-5.EL4 cyrus-sasl-devel-2.1.19-5.EL4 //卸载SASL rpm -qa |grep sendmail service sendmail stop rpm -e --nodeps sendmail
rpm -qa |grep perl rpm -e --nodeps perl-XML-NamespaceSupport-1.08-6 \ perl-XML-Twig-3.13-6 perl-XML-LibXML-1.58-1 perl-URI-1.30-4 \ perl-DateManip-5.42a-3 perl-HTML-Parser-3.35-6 perl-libwww-perl-5.79-5 \ perl-libxml-perl-0.07-30 perl-XML-Encoding-1.01-26 perl-Digest-SHA1-2.07-5 \ perl-Net-DNS-0.48-1 perl-Convert-ASN1-0.18-3 perl-XML-Grove-0.46alpha-27 \ perl-LDAP-0.31-5 perl-XML-LibXML-Common-0.13-7 perl-Filter-1.30-6 \ perl-Parse-Yapp-1.05-32 perl-XML-Dumper-0.71-2 perl-Time-HiRes-1.55-3 \ perl-XML-SAX-0.12-7 perl-Crypt-SSLeay-0.51-5 perl-HTML-Tagset-3.03-30 \ perl-XML-Parser-2.34-5 perl-libxml-enno-1.02-31 perl-Digest-HMAC-1.01-13一:增加系统相关的用户和组 其中用户和组的作用相信大家看了前面的软件相关大概可以看出其作用了,其中vmail是用来登录Webmail的帐号,而postdrop则是在邮件中起postdrop的作用。
groupadd mysql groupadd vmail groupadd postfix groupadd postdrop groupadd amavis groupadd clamav groupmod -g 1001 vmail useradd mysql -g mysql useradd vmail -g vmail -u 1001 useradd postfix -g postfix useradd amavis -g amavis useradd clamav -g clamav二:安装Mysql
1:安装
mv mysql-5.0.41-linux-i686 /usr/local/mysql cd /usr/local/mysql/ chown -R root . //注意这些地方的点号 chown -R mysql data chown -R mysql data/mysql/. chgrp -R mysql . cp ./support-files/my-medium.cnf /etc/my.cnf ./scripts/mysql_install_db --user=mysql2:启动及共享链接库
bin/mysqld_safe --user=mysql & /usr/local/mysql/bin/mysqlshow -p echo "/usr/local/mysql/lib" >> /etc/ld.so.conf ldconfig -v //加入动态链接库中3:加入到自动运行队列
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld chmod 700 /etc/rc.d/init.d/mysqld chkconfig --add mysqld chkconfig --level 345 mysqld on export PATH=$PATH:/usr/local/mysql/bin三:安装Openssl 因为Openssl在这里的作用不是很明显,而且系统中默认一般都自带有,所以这里没有采用源码的方式安装,在这里只是做一次查询,如果想用源码的方式,这个和普通的编译方式一样,没什么特别要求的地方.
rpm -qa |grep ssl四:安装BerkeleyDB
安装这个软件的原因是因为后面的Perl组件包中必须要有它的支持才能进行下去,所以这个是不能省的. 1:安装
tar zxvf db-4.5.20.tar.gz cd db-4.5.20/build_unix ../dist/configure --prefix=/usr/local/BerkeleyDB make make install2:禁用和移除旧版本文件
mv /usr/include/db4 /usr/include/db4.off rm /usr/include/db_cxx.h rm /usr/include/db.h rm /usr/include/db_185.h3:链接新文件到动态库
ln -sv /usr/local/BerkeleyDB/include /usr/include/db4 ln -sv /usr/local/BerkeleyDB/include/db.h /usr/include/db.h ln -sv /usr/local/BerkeleyDB/include/db_cxx.h /usr/include/db_cxx.h echo "/usr/local/BerkeleyDB/lib" >> /etc/ld.so.conf ldconfig -v五:安装Apache
安装Apache有两个要注意的地方,因为我这里用的Postfix的后台管理是extman这个程序,而它是通过CGI的方式来进行管理的,所以这里启用了suexec的功能,还有一个是关于网站的存放路径的,如果不指定,那么在启用suexec后会出现 suexec-docroot的错误。 1:安装
tar zxvf httpd-2.2.4.tar.gz cd httpd-2.2.4 ./configure --prefix=/usr/local/httpd --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 install2:加入到自动运行队列
echo "/usr/local/httpd/bin/apachectl start" >> /etc/rc.local六:安装GD库
GD库的主要作用是配置相关的图形及字符的正确显示,包括类似验证码的功能和后面的图形日志的显示. 1:安装libpng
tar zxvf libpng-1.2.16.tar.gz cd libpng-1.2.16 ./configure --prefix=/usr/local/png make make install ln -sv /usr/local/png/lib/* /usr/lib/2:安装jpeg
mkdir /usr/local/jpeg mkdir /usr/local/jpeg/bin mkdir /usr/local/jpeg/lib mkdir /usr/local/jpeg/include mkdir /usr/local/jpeg/man mkdir /usr/local/jpeg/man/man1 tar zxvf jpegsrc.v6b.tar.gz cd jpeg-6b/ ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static make make install ln -sv /usr/local/jpeg/lib/* /usr/lib/3:安装freetype
tar zxvf freetype-2.3.2.tar.gz cd freetype-2.3.2 ./configure --prefix=/usr/local/freetype2 make make install4:安装fontconfig
tar zxvf fontconfig-2.4.0.tar.gz cd fontconfig-2.4.0 ./configure --prefix=/usr/local/fontconfig \ --with-freetype-config=/usr/local/freetype2/bin/freetype-config make make install5:安装xmkmf
//安装xmkmf的原因是编译xpm时要用来这个工具 rpm -ivh freetype-devel-2.1.9-1.i386.rpm rpm -ivh fontconfig-devel-2.2.3-7.i386.rpm rpm -ivh xorg-x11-devel-6.8.1-23.EL.i386.rpm6:安装xpm
//在rhel5中有直接的rpm包,librxpm.rpm libxpm-devel.rpm tar zxvf xpm-3.4k.tar.gz cd xpm-3.4k xmkmf -a make make install7:安装gd
tar zxvf gd-2.0.34.tar.gz cd gd-2.0.34 ./configure --prefix=/usr/local/gd --with-png=/usr/local/png/ \ --with-jpeg=/usr/local/jpeg/ --with-freetyp=/usr/local/freetype2/ \ --with-fontconfig =/usr/local/fontconfig/--with-xpm cp /usr/local/png/include/png.h ./ cp /usr/local/png/include/pngconf.h ./ make make install七:安装courier-authlib 1:安装
tar jxvf courier-authlib-0.59.3.tar.bz2 cd courier-authlib-0.59.3 ./configure --with-redhat --with-authmysql=yes \ --with-mailuser=vmail --with-mailgroup=vmail --with-mysql-libs=/usr/local/mysql/lib \ --with-mysql-includes=/usr/local/mysql/include \ --prefix=/usr/local/authlib --without-stdheaderdir make make install make install-configure grep "authdaemonvar" \ /usr/local/authlib/etc/authlib/authdaemonrc //找出配置文件中authdaemonvar的设置 ##NAME: authdaemonvar:2 # authdaemonvar is here, but is not used directly by authdaemond. It's authdaemonvar=/usr/local/authlib/var/spool/authdaemon2:更改相关配置文件
vi /usr/local/authlib/etc/authlib/authdaemonrc authmodulelist="authmysql" //第27行 authmodulelistorig="authmysql" //第34行 DEBUG_LOGIN=2 //第75行
//此文件中请不要使用空格符,应使用TAB键 vi /usr/local/authlib/etc/authlib/authmysqlrc MYSQL_SERVER localhost //26行 MYSQL_USERNAME extmail //27行 MYSQL_PASSWORD extmail //28行 MYSQL_DATABASE extmail //68行 MYSQL_SOCKET /tmp/mysql.sock //49行 MYSQL_USER_TABLE mailbox //75行 MYSQL_CLEAR_PWFIELD password //84行 DEFAULT_DOMAIN test.com //97行 MYSQL_UID_FIELD '1001' //105行 MYSQL_GID_FIELD '1001' //111行 MYSQL_LOGIN_FIELD username //120行 MYSQL_HOME_FIELD concat('/var/mailbox/',maildir) //125行 MYSQL_NAME_FIELD name //131行 MYSQL_MAILDIR_FIELD concat('/var/mailbox/',maildir) //142行 MYSQL_QUOTA_FIELD concat(quota,'S') //157行3:共享链接库
echo "/usr/local/authlib/lib/courier-authlib" >> /etc/ld.so.conf ldconfig -v4:启动及加入到自动运行队列
cp courier-authlib.sysvinit /etc/init.d/courier-authlib chmod 755 /etc/init.d/courier-authlib chkconfig --add courier-authlib chkconfig --level 2345 courier-authlib on service courier-authlib start chmod +x /usr/local/authlib/var/spool/authdaemon八:安装SASL 1:安装
tar zxvf cyrus-sasl-2.1.21.tar.gz cd cyrus-sasl-2.1.21 ./configure --prefix=/usr/local/sasl2 \ --disable-anon -enable-plain --enable-login --enable-sql \ --with-mysql=/usr/local/mysql --with-mysql-includes=/usr/local/mysql/include \ --with-mysql-libs=/usr/local/mysql/lib \ --with-authdaemond=/usr/local/authlib/var/spool/authdaemon/socket patch -p1 < sasl.patch //只在出现下面的错时才用 make make install如果在编译的过程中出现如"client.c:64: error: static declaration of 'global_callbacks' follows non-static declaration saslint.h:112…",需要加一个补丁程序,然后再执行编译过程。我的在rhel4下没出现错误,但在rhel5下出现错误.文件的内容如下:
vi sasl.patch --- cyrus-sasl-2.1.20/lib/client.c~ 2003-11-11 11:26:06.000000000 -0500 +++ cyrus-sasl-2.1.20/lib/client.c 2005-05-31 22:34:14.000000000 -0400 @@ -61,7 +61,7 @@ static cmech_list_t *cmechlist; /* global var which holds the list */ -static sasl_global_callbacks_t global_callbacks; +sasl_global_callbacks_t global_callbacks; static int _sasl_client_active = 0;2:共享链接库
mv /usr/lib/sasl2 /usr/lib/sasl2.OFF ln -sv /usr/local/sasl2/lib/* /usr/lib ln -sv /usr/local/sasl2/lib/* /usr/local/lib ln -sv /usr/local/sasl2/include/sasl/* /usr/local/include mkdir -pv /var/state/saslauthd echo "/usr/local/sasl2/lib" >> /etc/ld.so.conf echo "/usr/local/sasl2/lib/sasl2" >> /etc/ld.so.conf ldconfig -v3:启动及加入到自动运行队列
echo "/usr/local/sasl2/sbin/saslauthd -a shadow pam">>/etc/rc.local /usr/local/sasl2/sbin/saslauthd -a shadow pam4:新建配置文件
vi /usr/local/lib/sasl2/smtpd.conf pwcheck_method:authdaemond mech_list:PLAIN LOGIN log_level:3 authdaemond_path:/usr/local/authlib/var/spool/authdaemon/socket过程写得比较详细,所以感觉有点长,慢慢来吧,下回再继续了。本文出自 “虚拟的现实” 博客,转载请与作者联系!
相关文章推荐
- Postfix配置Step By Step(二)
- Postfix配置Step By Step(三)
- Step By Step在VS2008中完整配置Ajax Toolkit的使用(配图)
- Oracle高级复制的创建配置步骤-Step by Step
- 在VMWare中配置SQLServer2005集群 Step by Step(三)——配置域服务器
- 在VMWare中配置SQLServer2005集群 Step by Step(一)——环境
- 在VMWare中配置SQLServer2005镜像 Step by Step(一)——前言&预安装
- 在VMWare中配置SQLServer2005同步复制Step by Step(二)——安装配置
- josso for tomcat配置 step by step
- Dataguard配置Step by Step
- Enterprise Library Step By Step系列(十五):配置应用程序块——设计篇
- 配置oracle stream(step by step setup database level Streams Replication)
- SSH2 Step by Step- Step 1 Struts2初步配置学习
- Windows系统配置Java Web开发环境Step by Step
- 在VMWare中配置SQLServer2005集群 Step by Step(四)——集群安装
- 在VMWare中配置SQLServer2005集群 Step by Step(一)——环境
- Enterprise Library Step By Step系列(一):配置应用程序块——入门篇
- 配置NFS服务step by step
- Enterprise Library Step By Step系列(二):配置应用程序块——进阶篇
- 在VMWare中配置SQLServer2005同步复制Step by Step(二)——安装配置