linux下搭建pxe自動化安裝環境(2)
發表于:2013-12-16來源:IT博客大學習作者:yejr點擊數:
標簽:linux
這里需要注意的是,/etc/xinetd.d/tftp 文件中的 disable 改成 no。另外,我們也可以采用其他網絡方式安裝,常見的有 HTTP、NFS、FTP,在這里,我們采用熟悉的
這里需要注意的是,/etc/xinetd.d/tftp 文件中的 disable 改成 no。另外,我們也可以采用其他網絡方式安裝,常見的有 HTTP、NFS、FTP,在這里,我們采用熟悉的 HTTP 方式。
4. 配置httpd以及pxe自動安裝腳本
httpd的安裝不再多說,我們只需要把 pxe 自動化配置文件放到 DocumentRoot 指定的位置下,然后根據文件中配置的參數掛載iso影響文件。在這里,我們假定 DocumentRoot 就是默認的 /var/www/html。
以下是代碼片段:
[yejr@imysql.cn ~yejr]# cat /var/www/html/ks.cfg
#基礎設置
lang en_US
langsupport zh_HK zh_CN zh_TW --default=en_US
keyboard us
mouse
timezone Asia/Shanghai
rootpw yejr
selinux --disabled
reboot
text
install
#http安裝路徑
url --url http://192.168.1.12/as4u7/
zerombr yes
auth --useshadow --enablemd5
firewall --disabled
skipx
#定制安裝包
%packages --resolvedeps
@ admin-tools
@ system-tools
@ editors
@ emacs
@ compat-arch-support
@ chinese-support
@ development-tools
kernel
kernel-utils
curl
grub
sysstat
#初始化設置
%pre --interpreter /bin/sh
export PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin
DRIVER_INSTALL="`fdisk -l | grep -i '^Disk /dev/' | awk '{print $2, $3}' | sed 's/://g' | sed 's#/dev/##g' | awk 'BEGIN{ disk=""; size=0}{if(size == 0 || size > $2) {size = $2; disk = $1}}END{print disk}'`"
%post --interpreter /bin/sh
/sbin/chkconfig --level 2345 irqbalance on
/sbin/chkconfig --level 2345 psacct on
/sbin/chkconfig --level 2345 anacron off
/sbin/chkconfig --level 2345 apmd off
/sbin/chkconfig --level 2345 atd off
/sbin/chkconfig --level 2345 autofs off
/sbin/chkconfig --level 2345 gpm off
/sbin/chkconfig --level 2345 httpd off
/sbin/chkconfig --level 2345 identd off
/sbin/chkconfig --level 2345 ipchains off
/sbin/chkconfig --level 2345 iptables off
/sbin/chkconfig --level 2345 isdn off
/sbin/chkconfig --level 2345 keytable off
/sbin/chkconfig --level 2345 kudzu off
/sbin/chkconfig --level 2345 linuxconf off
/sbin/chkconfig --level 2345 lpd off
/sbin/chkconfig --level 2345 netfs off
/sbin/chkconfig --level 2345 nfslock off
/sbin/chkconfig --level 2345 pcmcia off
/sbin/chkconfig --level 2345 portmap off
/sbin/chkconfig --level 2345 random off
/sbin/chkconfig --level 2345 rawdevices off
/sbin/chkconfig --level 2345 rhnsd off
/sbin/chkconfig --level 2345 sgi_fam off
/sbin/chkconfig --level 2345 xfs off
/sbin/chkconfig --level 2345 xinetd off
/sbin/chkconfig --level 2345 ip6tables off
/sbin/chkconfig --level 2345 cups off
/sbin/chkconfig --level 2345 hpoj off
/sbin/chkconfig --level 2345 mdmpd off
/sbin/chkconfig --level 2345 firstboot off
/sbin/chkconfig --level 2345 arptables_jf off
/sbin/chkconfig --level 2345 mdmonitor off
/sbin/chkconfig --level 2345 smartd off
/sbin/chkconfig --level 2345 messagebus off
/sbin/chkconfig --level 2345 acpid off
/sbin/chkconfig --level 2345 rpcsvcgssd off
/sbin/chkconfig --level 2345 rpcgssd off
/sbin/chkconfig --level 2345 rpcidmapd off
/sbin/chkconfig --level 2345 cpuspeed off
/sbin/chkconfig --level 2345 sysstat off
mkdir -p /root/.ssh
/bin/rpm -e --nodpes mysqlclient10
/bin/rpm -e --nodpes mysql
/sbin/chkconfig sshd on
|
至此,所有配置已經完成,啟動相關服務,然后開始測試。
以下是代碼片段:
[yejr@imysql.cn ~yejr]# /etc/init.d/xinetd start
[yejr@imysql.cn ~yejr]# /etc/init.d/httpd start
[yejr@imysql.cn ~yejr]# /etc/init.d/dhcpd start
|
原文轉自:http://blogread.cn/it/article/227