腳本自動安裝postfix源碼

網上看到一些安裝郵件系統文章都是一步步編譯安裝的。覺得比較麻煩。從網上查了一些文檔,終於找到一篇 xiexin的文章,略作修改完成了postfix的源碼包非交互自動安裝。

1.我是源碼包安裝的mysql,安裝完mysql後,要做如下操作:

echo "$mysql_install_directory/lib" >> /etc/ld.so.conf

ldconfig

不然postfix安裝過程中會提示找不到mysqlclient.so.xx

2.要安裝好openssl-devel,db4的包,這個光盤上都有,爲方便操作可以把光盤做成yum源來安裝,這些基本的包的安裝不影響對整個郵件系統的理解,沒必要都用源碼。

3.正式安裝腳本如下:

#!/bin/bash
postfixver=postfix-2.8.2
######################build_account##############
groupadd postdrop
groupadd -g 1000 postfix
useradd -u 1000 -g postfix -s /sbin/nologin -G postdrop postfix
###################setup_postfix#################
tar zxvf $postfixver.tar.gz
cd $postfixver
chmod 755 ./postfix-install
make makefiles \
CCARGS='-DHAS_MYSQL -I/usr/local/mysql/include -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DUSE_TLS -I/usr/include' AUXLIBS='-L/usr/local/mysql/lib -lmysqlclie
nt -lz -lm -L/usr/lib -lssl -lcrypto'
make
./postfix-install -non-interactive \
install_root=/ tempdir=/tmp \
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

注:其中“make makefiles根據自己的需要進行修改”;“postfix-install”要賦予執行權限;我是按照默認安裝目錄做的配置,可根據需要把postfix相關文件制定安裝到某個目錄。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章