仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 430|回复: 8
打印 上一主题 下一主题

[CentOS(社区)] 来一发CentOS办事器搭建postfix邮件体系

[复制链接]
冷月葬花魂 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-14 20:45:58 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!
postfix体系的构造图,我们将依照这个图来安排我们的postfix的邮件办事器

每一个软件包的装置都是一步。





mysql数据库的装置


我这里用的版本是mysql-5.1.69.tar.gz在mysql的官方网站可以下载,并且用的体系是centos5.9
(1)解压mysql-5.1.69.tar.gz
[root@centos~]#tarzxvfmysql-5.1.69.tar.gz

(2)检讨创立mysql用户和组
[root@centos~]#idmysql检讨发明没有mysql用户
id:mysql:Nosuchuser
[root@centos~]#useradd-s/sbin/nologin-d/dev/nullmysql
useradd:warning:thehomedirectoryalreadyexists.
Notcopyinganyfilefromskeldirectoryintoit.

普通不须要mysql上岸,所以也没有给家目次

(3)mysql的编译装置
装置之前必需要有编译装置的对象gcc等
[root@centosmysql-5.1.69]#./configure--prefix=/usr/local/mysql--with-charset=utf8
./configure出了成绩‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

最初几行出了错。完全毛病信息以下:
checkingfortgetentin-lncurses...no
checkingfortgetentin-lcurses...no
checkingfortgetentin-ltermcap...no
checkingfortgetentin-ltinfo...no
checkingfortermcapfunctionslibrary...configure:error:Nocurses/termcaplibraryfound

缘由:‍
缺乏ncurses装置包ncurses供给字符终端处置库,包含面板和菜单。

处理方法:
下载装置响应软件包
[root@centosmysql-5.1.69]#yum-yinstallncurses-devel
假如涌现以下提醒证实configure胜利了

ThankyouforchoosingMySQL!

Remembertochecktheplatformspecificpartofthereferencemanual
forhintsaboutinstallingMySQLonyourplatform.
AlsohavealookatthefilesintheDocsdirectory.


make&&makeinstall
MYSQL装置到这里卡了良久,是否是你认为以为逝世机,法式装置毛病了?聪慧的你能够发明了,现实MYSQL曾经装置胜利了,它这步过段时光就会好了,但你晓得是甚么缘由吗?哈哈告知你吧“这是mysql在自我编译测试酿成的“。所以耐烦的等
make[2]:Enteringdirectory`/down/webinstall/mysql-5.1.57/mysql-test
make[3]:Enteringdirectory`/down/webinstall/mysql-5.1.57/mysql-test
make[3]:Nothingtobedonefor`install-exec-am.
makeINSTALL_TO_DIR="/usr/local/mysql/mysql-test"install_test_files
make[4]:Enteringdirectory`/down/webinstall/mysql-5.1.57/mysql-test
mysql设置装备摆设文件
[root@centosmysql-5.1.69]#cpsupport-files/my-medium.cnf/etc/my.cnf

mysql的开机启动
[root@centosmysql-5.1.69]#cpsupport-files/mysql.server/etc/init.d/mysqld
[root@centosmysql-5.1.69]#chmod700/etc/init.d/mysqld
[root@centosmysql-5.1.69]#chkconfig--list|grepmysqld
[root@centosmysql-5.1.69]#chkconfig--addmysqld



初始化数据库生成var目次
]#/usr/local/mysql/bin/mysql_install_db--user=mysql


修正/usr/local/mysql下文件属主和属组
除var目次的属主和属组都为mysql外,其他的只须要将属组设为mysql便可

[root@centos~]#chown-Rroot:mysql/usr/local/mysql/
[root@centos~]#chown-Rmysql:mysql/usr/local/mysql/var/
mysql/mysql-bin.000002test/
mysql-bin.000001mysql-bin.index
[root@centos~]#chown-Rmysql:mysql/usr/local/mysql/var/


启动mysql

/usr/local/mysql/bin/mysqld_safe--user=mysql&

servicemysqldrestart
psaux|grepmysqld
netstat-anpt|grep3306

apache的装置

<p>
装置之前界说一个完全的主机名:
不然在启动apache的时刻会有如许的报错:
AH00558:httpd:Couldnotreliablydeterminetheserversfullyqualifieddomainname,using::1.SettheServerNamedirectivegloballytosuppressthismessage
编纂/etc/hosts文件
#Donotremovethefollowingline,orvariousprograms
#thatrequirenetworkfunctionalitywillfail.
127.0.0.1localhost.localdomainlocalhost
::1localhost6.localdomain6localhost6
192.168.87.128centos.wolf.orgcentos

编纂/etc/sysconfig/network文件,然后重启能力失效
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=centos.wolf.org

1,apache装置
tarxvfzhttpd-2.2.11.tar.gz
cdhttpd-2.2.11
./configure--prefix=/usr/local/apache--enable-so

#--prefix=<Install_Path>指明编译后的二进制文件装置到<Install_Path>目次,用现实装置路径调换<Install_Path>,如--prefix=/usr/local/apache-2.2.11,假如省略此设置装备摆设参数,默许装置到/usr/local/apache2目次。

#--enable-so指明编译静态加载模块(DSO)支撑到httpd二进制文件,此模块使得Apache的各功效模块可以与焦点离开编译、运转时静态加载。有了DSO支撑,进级和增长模块时只需编译相干的模块便可,不用从新编译全部体系。最新版本的Apache缺省编译此模块到httpd二进制文件,假如你在应用晚期版本的apache而且须要DSO支撑,能够要明白指出此选项。

#--enable-mods-shared=<MODULE-LIST>明白指明要以DSO方法编译的模块,<MODULE-LIST>为空格分隔的模块名列表、all或许most,all表现包括一切模块,most表现包括年夜部门模块,如--enable-mods-share="rewritedeflate",--enable-mods-share=most,后果同等于多个--enable-<FEATURE>=share

make&&makeinstall
/usr/local/apache/bin/apachectlrestart启动httpd

echo"/usr/local/apache/bin/apachectlstart">>/etc/rc.local参加开机

因为编译装置的时刻http办事默许的用户组和用户名是daemon,在这里我照样改成习气的apache
[root@centoshttpd-2.2.11]#idapache
uid=48(apache)gid=48(apache)groups=48(apache)context=root:system_r:unconfined_t:SystemLow-SystemHigh

[root@centoshttpd-2.2.11]#cd/usr/local/apache/conf/
[root@centosconf]#vimhttpd.conf

Userapache
Groupapache

碰到的成绩:
[root@centoshttpd-2.2.11]#servicehttpdrestart
Stoppinghttpd:[FAILED]
Startinghttpd:(98)Addressalreadyinuse:make_sock:couldnotbindtoaddress[::]:80
(98)Addressalreadyinuse:make_sock:couldnotbindtoaddress0.0.0.0:80
nolisteningsocketsavailable,shuttingdown
Unabletoopenlogs
[FAILED]

这是因为端口被占用了,所以致于要kill就好了
[root@centosapache]#psaux|grephttp
root102710.00.061228728pts/1R+14:450:00grephttp
daemon327570.00.1291441444?S14:190:00/usr/local/apache/bin/httpd-kstart
daemon327580.00.1291441444?S14:190:00/usr/local/apache/bin/httpd-kstart
daemon327590.00.1291441444?S14:190:00/usr/local/apache/bin/httpd-kstart
[root@centosapache]#kill-932757
[root@centosapache]#kill-932758
[root@centosapache]#kill-932759
[root@centosapache]#psaux|grephttp
root104470.00.061228752pts/1S+14:470:00grephttp
[root@centosapache]#/usr/local/apache/bin/apachectlstart
[root@centosapache]#/usr/local/apache/bin/apachectlstart
httpd(pid10463)alreadyrunning
[root@centosapache]#
[root@centosapache]#psaux|grephttp
root104630.00.1249361784?Ss14:470:00/usr/local/apache/bin/httpd-kstart
apache104640.00.1249361340?S14:470:00/usr/local/apache/bin/httpd-kstart
apache104650.00.1249361340?S14:470:00/usr/local/apache/bin/httpd-kstart
apache104660.00.1249361340?S14:470:00/usr/local/apache/bin/httpd-kstart


php装置设置装备摆设


postfix正式装置


<spanstyle="text-align:center;text-transform:none;background-color:#ffffff;text-indent:0px;display:inline!important;font:bold20px/20px宋体;float:none;letter-spacing:normal;color:#555555;word-spacing:0px;-webkit-text-stroke-width:0px">在装置postfix之前有个很主要的任务要做,那就是将sendmail给删除失落,固然也能够不消删除sendmail,然则这类情形就要切换体系的mta为postfix.为何必定要这么做呢?缘由很简略异样作为mail办事的两个软件在mta的时刻会发生抵触,就像是一山不容二虎一样
[root@centos~]#rpm-e--nodepssendmail


一,创立用户和组
创立运转postfix办事的用户(postfix)、组(postfix、postdrop)
[root@centospostfix-2.10.0]#groupadd-g1001postfix
[root@centospostfix-2.10.0]#groupadd-g1002postdrop
[root@centospostfix-2.10.0]#useradd-M-u1001-gpostfix-s/sbin/nologinpostfix

[root@centospostfix-2.10.0]#useradd-M-u1002-gpostdrop-s/sbin/nologinpostdrop


二,编译装置

在postfix的README文档中这么说的。要想编译装置postfix支撑mysql,那末就要加上
-DHAS_MYSQL和-I这两个参数,还给了我们这个例子,其他的参数是添加平安和认证

CCARGS参数:为编译器供给额定的参数。“-I”选项指出尺度的额定头文件的寄存目次。例如,mysql和cyrus-sasl的头文件分离位于目次:/usr/local/mysql/lib/mysql、/usr/include/sasl。
AUXLIBS参数:指出位于尺度地位以外的额定函数库。假如须要链接SASL、MySQL或任何附加的函数库,并且它们不是寄存在尺度地位(/usr/lib/目次),则必需在AUXLIBS参数中指出这些函数库的路径。例如,mysql和cyrus-sasl的库文件分离位于目次:/usr/local/mysql/lib/mysql、/usr/lib/sasl2。



[root@centospostfix-2.10.0]#makemakefilesCCARGS=-DHAS_MYSQL-I/usr/local/mysql/include/mysql-DUSE_SASL_AUTH-DUSE_CYRUS_SASL-I/usr/include/saslAUXLIBS=-L/usr/local/mysql/lib/mysql-lmysqlclient-lz-lm-L/usr/lib/sasl2-lsasl2


依照以下的提醒输出相干的路径([]号中的是缺省值,”[]”后的是输出值,省略的表现采取默许值)(可全体采取默许值)
留意)生成别号二进制文件,这个步调假如疏忽,会形成postfix效力极低:
#newaliases


  • install_root:[/]/
  • tempdir:[/root/postfix-2.6.5]
  • config_directory:[/etc/postfix]
  • command_directory:[/usr/sbin]
  • daemon_directory:[/usr/libexec/postfix]
  • data_directory:[/var/lib/postfix]
  • 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]
  • sendmail_path:[/usr/sbin/sendmail]
  • setgid_group:[postdrop]






编译排错
(1)

dict_mysql.c:772:error:‘HOST’hasnomembernamed‘db’
dict_mysql.c:773:error:‘HOST’hasnomembernamed‘db’
dict_mysql.c:774:error:‘HOST’hasnomembernamed‘hostname’
dict_mysql.c:775:error:‘HOST’hasnomembernamed‘name’
dict_mysql.c:776:error:‘HOST’hasnomembernamed‘name’
make:***[dict_mysql.o]毛病1
make:***[update]毛病1
处理:
由于刚开端的时刻看一些文档外面路径用的是/usr/local/mysql/include,/usr/local/mysql/lib所以找不到mysql.h文件

后来改成/usr/local/mysql/include/mysql,/usr/local/mysql/lib/mysql毛病就处理了


(2)
Installtheappropriatedb*-develpackagefirst.
装置要想mysql支撑就要装置edb*-devel

[root@centospostfix-2.10.0]#yuminstall-ydb*-devel


(3)
xsasl_cyrus_server.c:606:error:XSASL_CYRUS_SERVERhasnomembernamedusername
xsasl_cyrus_server.c:607:error:XSASL_CYRUS_SERVERhasnomembernamedusername
make:***[xsasl_cyrus_server.o]Error1
make:***[update]Error1

缺乏cyrus认证包:有cyrus-sasl-md5cyrus-sasl-libcyrus-sasl-plaincyrus-saslcyrus-sasl-devel
[root@centospostfix-2.10.0]#yuminstall-ycyrus-sasl-md5cyrus-sasl-libcyrus-sasl-plaincyrus-saslcyrus-sasl-devel


(4)
bin/postconf:errorwhileloadingsharedlibraries:libmysqlclient.so.16:cannotopensharedobjectfile:Nosuchfileordirectory
处理办法:
这里说找不到mysql的同享库,须要将路径参加/etc/ld.so.conf#echo"/usr/local/mysql/lib/mysql">>/etc/ld.so.conf#ldconfig
[root@centospostfix-2.10.0]#cp/usr/local/mysql/lib/mysql/libmysqlclient.so.16/usr/lib/
exportLD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mysql/lib/mysql/


[root@centospostfix-2.10.0]#/usr/sbin/postfixstart
postfix/postfix-script:fatal:thePostfixmailsystemisalreadyrunning
[root@centospostfix-2.10.0]#netstat-antup|grep25
tcp000.0.0.0:250.0.0.0:*LISTEN32713/master


<spanclass="Apple-converted-space">postfix正式设置装备摆设

postfix的设置装备摆设文件/etc/postfix/main.cf
小魔女 该用户已被删除
沙发
发表于 2015-1-16 22:31:45 | 只看该作者

来一发CentOS办事器搭建postfix邮件体系

甚至目前许多应用软件都是基于它的。可是没有哪一个系统是十分完美的。
飘飘悠悠 该用户已被删除
板凳
发表于 2015-1-25 19:46:36 | 只看该作者
不同于Windows?系统需要花钱购买,因为Linux的核心是免费的,自由使用的,核心源代码是开放的。
金色的骷髅 该用户已被删除
地板
发表于 2015-2-4 01:08:59 | 只看该作者
如果你有庞大而复杂的测试条件,尽量把它剪裁得越小越好。可能你会遇到这种情况,对于一个问题会出现不同内容回答,这时你需要通过实践来验证。
若天明 该用户已被删除
5#
发表于 2015-2-9 10:32:53 | 只看该作者
其实老师让写心得我也没怎么找资料应付,自己想到什么就写些什么,所以不免有些凌乱;很少提到编程,因为那些在实验报告里已经说了,这里再写就多余了。
活着的死人 该用户已被删除
6#
发表于 2015-2-27 09:05:40 | 只看该作者
生成新的unispimsp.ksc。”另外得到回复后如果问题解决,向帮助过你的人发个说明,让他们知道问题是怎样解决的。
变相怪杰 该用户已被删除
7#
发表于 2015-3-9 08:36:57 | 只看该作者
Linux最大的特点就是其开源性,这一点是十分难得的,这也是它能够存在到现在的原因之一。
老尸 该用户已被删除
8#
发表于 2015-3-17 00:10:18 | 只看该作者
你需要提供精确有效的信息。Linux这并不是要求你简单的把成吨的出错代码或者数据完全转储摘录到你的提问中。
莫相离 该用户已被删除
9#
发表于 2015-3-23 12:00:04 | 只看该作者
Linux的成功就在于用最少的资源最短的时间实现了所有功能,这也是符合人类进化的,相信以后节能问题会日益突出。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-9-27 23:34

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表