本文轉載自sinykk博客http://sinykk.iteye.com/blog/1030270
本次裝的extmail參考官方教程,但有些地方進行了修改
http://wiki.extmail.org/extmail_solution_for_linux_centos-5【在配置時第十一步時不要關掉IMAP服務,因爲現在很多人還是喜歡用IMAP】
服務器上郵nginx apache兩種服務器組成。apache只爲郵件服務器,地址爲ai9475.com:9000/
域名配置
----------------------------------------------------------------------------------
主機名 (A)(最多允許20條) IP 地址 TTL 操作 幫助
pop3.ai9475.com 122.225.96.117 3600 修改 - 刪除
smtp.ai9475.com 122.225.96.117 3600 修改 - 刪除
imap.ai9475.com 122.225.96.117 3600 修改 - 刪除
別名 (CNAME)(最多允許20條) 別名主機 TTL 操作 幫助
mail.ai9475.com ai9475.com 3600 修改 - 刪除
添加新的別名 注:只提交新加紀錄
郵件交換記錄 (MX)(最多允許20條) 目標主機 優先級 TTL 操作 幫助
ai9475.com ai9475.com 10 3600 修改 - 刪除
如果不配置smpt,pop3,在smpt,pop3中填IP也可以訪問
----------------------------------------------------------------------------------
extmail 本身已支持imap服務
----------------------------------------------------------------------------------
叄、製作_yum_倉庫
# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm 在這步時。因爲文件不存在了,所以通過WGET下載一個放在本地上運行
加載EMOS-1.5的光盤,請把emos的光盤放到光驅中
在這一步時,我不在服務器邊只能
#mount -o loop -t iso9660 /root/rpm/EMOS_1.5_x86_64.iso /mnt/EMOS
# createrepo . 在這步會出現 -bash: createrepo:,是因爲未安裝createrepo yum install createrepo即可
===============================================
玖、配置管理後臺-extman
導入初始數據後,需要將數據庫中的域名改成你自己的
重啓postfix 時關閉出錯,但重啓成功,沒事,多restart一下就看到兩個OK了
# service postfix restart
===============================================
[root@localhost docs]# /usr/sbin/authtest -s login [email protected] extmail
Authentication FAILED: Operation not permitted
通過 /var/log/maillog可以看到
May 5 11:24:01 localhost authdaemond: Installing libauthmysql
May 5 11:24:01 localhost authdaemond: file not found
May 5 13:33:27 localhost postfix/postfix-script[4308]: fatal: the Postfix mail system is not running
重啓了courier-authlib
[root@localhost extmail]# /usr/sbin/authtest -s login [email protected] extmail
Authentication FAILED: Input/output error
這個錯誤是在第伍、配置courier-authlib 修改 vi /etc/authlib/authmysqlrc 時出錯,我把後面的/給刪除了,注意裏面mysql.sock的位置
===============================================
問題
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /var/www/extsuite/extman/libs /usr/lib/perl5/site_perl/5.8.8/i
解決:
只需要安裝perl-DBD-MySQL即可解決此問題。
yum install perl-DBD-MySQL
===============================================
http://122.225.96.117:9000/extmail/cgi/index.cgi
登陸管理員後不能看到所有用戶:
我進入extman後只有如下菜單
索引 | 域列表 | 添加用戶 | 添加別名 | 添加域 | 添加管理員 | 羣發郵件 | 圖形日誌
域列表 => 對應域名 注意看有一支筆,點那個綠色的筆即可。
===============================================
extmail登錄提示不正確的用戶名或密碼
安裝mail服務器,參考extmail論壇資料安裝後,extman可以登陸,而extmail登錄提示不正確的用戶名或密碼。前段時間,一直沒有找到此問題的解決辦法。昨天終於發現了問題所在,先打開mysql的debug。在/etc/my.cnf裏的[mysqld]下加上log=/var/lib/mysql /sql.log。然後tail -f /var/lib/mysql/sql.log。再在web界面登錄,這日記就會紀錄相關信息。我發現了我的問題所在了。我在登錄界面裏域名框裏用的是 ip地址。換成域名,問題解決。
===============================================
拾、配置cyrus-sasl
smtp認證測試失敗
535 5.7.8 Error: authentication failed: authentication failure
用戶名寫錯了,我用了例子中的用戶名,其實應該用我自己在後臺添加的用戶
其日誌: SASL LOGIN authentication failed: authentication failure
最後找到問題。是自己用戶名和密碼使用錯誤(大汗)
======================================================
沒有產生maillog或者maillog不更新
到你的/etc/syslog.conf文件看一下,看是不是“-/var/log/maillog”將前面的“-”去掉,重啓syslog服務。
===============================================
在測試IMAP服務時FOXMAIL裏用戶名要填 [email protected] 是一個完整的
在IPAD,IPHONE裏設置SMTP時要填寫用戶名和密碼,並且填完整後要先選擇SSL,這樣才能找到IMAP.AI9475.COM主機
=====================================
綁定多域名下配置FOXMAI方式
如登陸服務器爲 mail.ai9475.com
用戶名爲 [email protected]
那麼在FOXMAIL。中用戶名地方都用[email protected]
而在POP3,IMAP,SMTP中設置爲 pop3.ai9475.com即可
=========================================
系統信息 Connection refused
因爲保存在/etc/rc.local 時出現了亂碼,導致服務器啓動時沒有啓動相關數據
主要雙引號問題
/usr/local/mailgraph_ext/mailgraph-init start
/var/www/extsuite/extman/daemon/cmdserver -v -d
=====================================
讓extmail支持 smtp SSL ,但是安裝時要安裝tsl如下:
-----
=============================
Jun 15 11:04:44 localhost postfix/pipe[30147]: 905A068B04D2: to=<[email protected]>, relay=maildrop, delay=50936, delays=50935/0.24/0/1.2, dsn=4.3.0, status=deferred (temporary failure. Command output: maildrop: Invalid home directory permissions - world writable. )
解決方法:
1、查看/home/domains的權限及文件擁有者是否是 vuser/vgroup
2、/home/domains權限不能太高 ,改爲 chmod -R 700 /home/domains
=====================================
2011-11-14 又全新安裝extmail又出現更多問題
=====================================
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /var/w
yum install perl-DBD-MySQL
=====================================
由於數據庫版本不同,導入 extmail.sql 數據庫時報錯:
ERROR 1064 (42000) at line 50: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM COMMENT='Ext/Webman - Admin Accounts'' at line 15
用文本編輯器打開extmail.sql,將數據庫文件內的所有 TYPE=MyISAM 替換爲 ENGINE=MyISAM ,保存退出。
丟棄導入到一半出錯的數據庫 extmail 。
mysql -u root -p
mysql> drop database extmail;
重新導入數據庫。
=============================================================
Starting httpd: (13)Permission denied: make_sock: could not bind to address 0.0.0.0:8000
這是linux的這安全機制
setenforce 1 設置SELinux 成爲enforcing模式
setenforce 0 設置SELinux 成爲permissive模式
如果要徹底禁用SELinux 需要在/etc/sysconfig/selinux中設置參數selinux=0 ,或者在/etc/grub.conf中添加這個參數
查看一下預定義
#semanage port -l
可以看出8000已經被使用
--------------------------------
關閉selinux狀態:(使用無啓重啓系統的方法)
詳見:http://blog.itechol.com/space-33-do-blog-id-5088.html
[root@cacti-test httpd]# setenforce 0 關閉命令
[root@cacti-test httpd]# getenforce 重新查看selinux狀態
Permissive
嘗試再次啓動apache
==============================
因爲系統有NGINX,使用了80端口,所以HTTPD只有用8000了
使用到端口的地方分別爲
Listen 8000
NameVirtualHost *:8000
<VirtualHost *:8000>
==============================================================================
DBI connect('database=extmail;host=localhost;mysql_socket=/var/lib/mysql/mysql.sock','webman',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) at /var/www/extsuite/extman/libs/Ext/Mgr/MySQL.pm line 45
vi /var/www/extsuite/extman/webman.cf
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
此處修改爲:
SYS_MYSQL_SOCKET = /tmp/mysql.sock
改後要記得重啓postfix
-----------2012.2.8--------------------
這次在這個問題上折騰了一天多,裝了yum install perl-DBD-MySQL,但這個並沒有解決問題,最後重啓後可用的
==============================================================================
535 5.7.8 Error: authentication failed: generic failure
因爲sasl 的目錄有2個,分別是 /usr/lib/sasl2 跟 /usr/lib64/sasl2
最後通過修改 /usr/lib64/sasl2/smtpd.conf 跟 /usr/lib64/sasl2/smtpd.conf 內容爲:
pwcheck_method: saslauthd
log_level: 3
mech_list: PLAIN LOGIN
saslauthd_path: /var/run/saslauthd/mux
並重啓 sasl 服務,跟 postfix 服務後
==============================================
裝到後面因爲有事情把服務器重啓了,最後安裝軟件時報找不到數據源,然後在網站下載軟件再裝,又遇到依賴關係,最後才發現因重啓了電腦,所以之前掛載的ISO文件不在了,所以報找不到源
==================================================
SMTP rcpt error
這個問題一直沒有解決,因爲服務器裏是/tmp/mysql.sock,而EXTMAIL一直找/var/lib/mysql/mysql.sock,中途我改了 /etc/my.cnf裏的路徑 爲/var/lib/mysql/mysql.sock也不行
最後改了調試了許久都不行,最後又重裝了MYSQL,EXTMAIL,並將mysql.sock指定到/var/lib/mysql/mysql.sock才行的
/usr/local/mysql/bin/mysqld_safe & --socket=/var/lib/mysql/mysql.sock
============================================
2、確定你的mysql.sock是不是在那個位置,
mysql -u 你的mysql用戶名 -p -S /var/lib/mysql/mysql.sock
也可以
mysqladmin --socket=/var/lib/mysql/mysql.sock version -uroot -p
========================
php編譯時
-o sapi/fpm/php-fpm
/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [sapi/fpm/php-fpm] Error 1
---
今天在編譯一個程序的時候出現如下錯誤:/usr/bin/ld: cannot find -l*
把解決方法在此貼一下,方便以後查閱。
原因:庫文件缺失。
方法一:可用yum install libtool-l*來安裝
方法二:當方法一不能成功時,可從其他機器拷貝文件到本機/usr/lib64/。具體文件:/usr/lib64/目錄下與lib*相關文件(主要是二個:lib*.a和lib*.so);
==================================================
yum list
Error: requested datatype primary not available
弄了幾次都出現同樣的錯誤,最後重啓服務器再yum clean all yum list
==================================================
postfix在進行sasl驗證時,/var/log/maillog文件出現如下錯誤:
Mar 21 13:52:04 149 postfix/smtpd[26855]: warning: SASL authentication failure: cannot connect to saslauthd server: No such file or directory
Mar 21 13:52:04 149 postfix/smtpd[26855]: warning: SASL authentication failure: Password verification failed
Mar 21 13:52:04 149 postfix/smtpd[26855]: warning: localhost.localdomain[127.0.0.1]: SASL plain authentication failed: generic failure
同時 /var/log/messages 日誌報錯:
unable to dlopen /usr/lib/sasl2/liblogin.so.2: /usr/lib/sasl2/liblogin.so.2: wrong ELF class: ELFCLASS32
因爲sasl 的目錄有2個,分別是 /usr/lib/sasl2 跟 /usr/lib64/sasl2
最後通過修改 /usr/lib64/sasl2/smtpd.conf 跟 /usr/lib64/sasl2/smtpd.conf 內容爲:
pwcheck_method: authdaemond
log_level: 3
mech_list: PLAIN LOGIN
authdaemond_path:/var/spool/authdaemon/socket
並重啓 sasl 服務,跟 postfix 服務後
問題解決!!!!!
service saslauthd restart
saslauthd postfix restart
=======================
[root@localhost yum.repos.d]# yum install courier-imap
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package courier-imap.x86_64 0:4.6.0-1 set to be updated
--> Processing Dependency: courier-authlib-devel >= 0.60.6.20080629 for package: courier-imap
--> Processing Dependency: libcourierauthsasl.so()(64bit) for package: courier-imap
--> Processing Dependency: libcourierauth.so()(64bit) for package: courier-imap
--> Running transaction check
--> Processing Dependency: libcourierauth.so.0()(64bit) for package: maildrop
.................................
maildrop-2.0.4-4hzq.x86_64 from installed has depsolving problems
--> Missing Dependency: libcourierauth.so.0()(64bit) is needed by package maildrop-2.0.4-4hzq.x86_64 (installed)
Error: Missing Dependency: libcourierauth.so.0()(64bit) is needed by package maildrop-2.0.4-4hzq.x86_64 (installed)
You could try using --skip-broken to work around the problem
You could try running: package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.
最後沒有辦法
yum remove courier-authlib
yum install courier-authlib
yum install courier-authlib-mysql
yum install maildrop
-----------------------------------------
好下方法是網上提供的,我用了沒有效果
解決:
yum --skip-broken update
rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
Error:There are unfinished transactions remaining. You mightconsider running yum-complete-transaction first to finish them
#yum install yum-utils
# yum-complete-transaction
Yum is telling you that there's an incoplete transaction - running 'yum-complete-transaction' first should clear it up.
=============================================
輸入該命令:
[root@ ~]# rpm --import http://dag.wieers.com/rpm/packages/PRM-GPG-KEY.dag.txt
出現以下錯誤:
error: http://dag.wieers.com/rpm/packages/PRM-GPG-KEY.dag.txt: import read failed(-1).
warning: u 0x8aa18e8 ctrl 0x8aa2708 nrefs != 0 (dag.wieers.com http)
解決辦法以一:換一個url
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt 【測試可以用】
解決辦法以二(可行):先從網絡上下載到本地,再安裝
wget http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm --import RPM-GPG-KEY.dag.txt
===========================================================
Feb 8 16:26:51 localhost imapd-ssl: [email protected]: Account's mailbox directory is not owned by the correct uid or gid
這個問題應該是我受網上的人影響配置了/var/www/extsuite/extman/webman.cf修改了裏面的SYS_DEFAULT_GID = 2525 //即postfix組gid,這個不能改成2525,要默認爲1000
這個問題最後我在系統後具體用戶上下的 “改組ID(建議不修改)改爲1000”
要記住
用戶ID(建議不修改)
組ID(建議不修改)
都保持1000不變
===========================================================
請問如何修改ssh端口?
# vi /etc/ssh/sshd_config
找到port 22行, 前面有#表示註釋,去掉,保存後重啓SSH
/etc/rc.d/init.d/sshd restart
查看端口 netstat -anlt