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