配置系統(tǒng)每次啟動時自動啟動postfix
想要自己架設郵件服務器嗎?如果sendmail讓你頭痛萬分,現(xiàn)在你有更好的選擇 —— Postfix。安全的結(jié)構(gòu)設計與優(yōu)異的可靠性,使它廣受專家的好評與贊賞。下面就讓我來看看postfix郵件服務器具體的安裝過程,以下介紹啟動postfix。
一、源代碼包的安裝
1.獲取postfix的源代碼包
從postfix官方站點www.postfix.org取得postfix的源代碼包postfix-19991231-pl08.tar.gz。將其拷貝到/tmp
2.解開源代碼包,將生成/tmp/postfix-19991231-pl08目錄。tarxvzfpostfix-19991231-pl08.tar.gz
3.編譯源代碼包,cd/tmp/postfix-19991231-pl08make
4.建立一個新用戶“postfix”,該用戶必須具有唯一的用戶id和組id號,同時應該讓該用戶不能登錄到系統(tǒng),也即不為該用戶指定可執(zhí)行的登錄外殼程序和可用的用戶宿主目錄。我們可以先用adduserpostfix添加用戶再編輯/etc/passwd文件中的相關條目如下所示:
postfix:*:12345:12345:postfix:/no/where:/no/shell
5.確定/etc/aliases文件中包含如下的條目:postfix:root
6.以root用戶登錄,在/tmp/postfix-19991231-pl08目錄下執(zhí)行命令:./INSTALL.sh
7.啟動postfix#postfixstart
8.關于maildrop目錄權(quán)限的說明:
postfix可以使用一個所有用戶都可寫的(也即目錄權(quán)限為1773)的maildrop目錄來讓本地用戶提交郵件。這種方法避免了使用set-uid或set-gid軟件,并且在郵件系統(tǒng)不可用時,用戶仍然可以提交郵件。其他用戶沒有訪問該目錄中的隊列文件的權(quán)限。接收來自網(wǎng)絡的郵件時postfix不使用maildrop目錄。但是,由于該目錄的權(quán)限是733,其他用戶可以
建立一個硬連接到該目錄中的文件從而導致該郵件被投遞多次或無法刪除,也就是說這將導致安全性問題。如果你想要使用這種方式來讓用戶提交郵件,就要在INSTALL.sh腳本問你是否需要set-gid時回答no。如果你的系統(tǒng)有多個用戶的話,最好取消以上的方式而采用利用set-gid用戶權(quán)限提交郵件的方式。這時,我們首先需要建立一個組id唯一的組"maildrop"并且確定該組中沒有用戶成員。然后在INSTALL.sh問你是否需要set-gid時指定"maildrop"。提示:在安裝postfix之前,請刪除已經(jīng)安裝的sendmail。
二、rpm包的安裝
1.獲取postfix的rpm軟件包。我們可以從http://www.alltrading.es/postfix/RPMS/i386/獲得postfix的rpm軟件包。當前的最新版本是postfix-20000531-2.i386.rpm。
2.備份你的/etc/aliases和/etc/aliases.db,因為postfix要使用該別名數(shù)據(jù)庫。
3.用以下命令查看系統(tǒng)是否安裝了sendmail:[root@mail/root]#rpm-qa|grepsendmailsendmail-doc-8.9.3-15sendmail-8.9.3-15sendmail-cf-8.9.3-15
4.用以下命令強行卸載sendmail:[root@mail/root]#rpm-esendmailsendmail-cfsendmail-doc--nodeps
5.用以下命令殺死運行中的sendmail進程:[root@mail/root]#killallsendmail
6.安裝postfix:
[root@mail/root]#rpm-Uvhpostfix-20000531-2.i386.rpm
postfix##################################################
postfix-script:warning:creatingmissingPostfixpiddirectory
postfix-script:warning:creatingmissingPostfixincomingdirectory
postfix-script:warning:creatingmissingPostfixactivedirectory
postfix-script:warning:creatingmissingPostfixbouncedirectory
postfix-script:warning:creatingmissingPostfixdeferdirectory
postfix-script:warning:creatingmissingPostfixdeferreddirectory
postfix-script:warning:creatingmissingPostfixsaveddirectory
postfix-script:warning:creatingmissingPostfixcorruptdirectory
postfix-script:warning:creatingmissingPostfixpublicdirectory
postfix-script:warning:creatingmissingPostfixprivatedirectory
[root@mail/root]#
7.啟動postfix
[root@mail/root]#/etc/rc.d/init.d/postfixstart
三、配置系統(tǒng)每次啟動時自動啟動postfix
1.如果你安裝的是postfix的源代碼包,可以在/etc/rc.d/rc.local文件中加入如下的語句讓系統(tǒng)每次啟動時自動啟動postfix:[f/usr/libexec/postfix];then/usr/libexec/postfixstartfi
2.如果你安裝的是postfix的rpm包,可以通過setup命令來設置在系統(tǒng)啟動時啟動postfix。
【編輯推薦】