Note:以下所有命令及涉及到的脚本均在RHEL 6.6 / VMWare上测试通过。
主机配置:eth0为对外服务网卡,eth1为VMWare local模式连接,用于KickStart安装系统使用。
(一) 安装所需的软件包
为了避免缺失依赖包带来的麻烦,建议采用安装DVD做为repo源。
[root@KioskStar pub]# mount /dev/sr0 /media/cdrom
[root@KioskStar pub]# mkdir /var/ftp/pub/inst_img
[root@KioskStar pub]# cp –p –R /media/cdrom /var/ftp/pub/inst_img
[root@KioskStar pub]# umount /media/cdrom
[root@KioskStar pub]# vi /etc/yum.repos.d/local_dvd.repo
[rhel-cd]
name=RedHat_OS_DVD
baseurl=file:///var/ftp/pub/inst_img
enabled=1
gpgcheck=0
[root@KioskStar pub]#
[root@KioskStar pub]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager.
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: epel rhel-cd
Cleaning up Everything
[root@KioskStar pub]# yum update
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Update Process
epel/metalink | 6.1 kB 00:00
epel | 4.3 kB 00:00
epel/primary_db | 5.7 MB 00:06
rhel-cd | 4.1 kB 00:00 ...
rhel-cd/primary_db | 3.1 MB 00:00 ...
No Packages marked for Update
[root@KioskStar pub]#
安装所需软件包:
# yum install dnsmasq syslinux tftp-server vsftpd system-config-kickstart -y
(二) Config tftp / PXE
# cp -r /usr/share/syslinux/* /var/lib/tftpboot
# mkdir /var/lib/tftpboot/pxelinux.cfg
# touch /var/lib/tftpboot/pxelinux.cfg/default
编辑/etc/dnsmasq.conf内容:
interface=eth1,lo
#bind-interfaces
domain=rhel.lan
# DHCP range-leases
dhcp-range= eth1,192.168.140.105,192.168.140.150,255.255.255.0,1h
# PXE
dhcp-boot=pxelinux.0,pxeserver,192.168.140.100
# Gateway
# dhcp-option=3,192.168.1.1
# DNS
dhcp-option=6,92.168.140.100
pxe-prompt="Press F8 for menu.", 60
pxe-service=x86PC, "Install RHEL from network server", pxelinux
enable-tftp
tftp-root=/var/lib/tftpboot
编辑/var/lib/tftpboot/pxelinux.cfg/default内容:
PROMPT 0
TIMEOUT 300
### TUI
#DEFAULT vmlinuz
### GUI
UI vesamenu.c32
menu title ########## PXE Boot Menu ##########
label 1
menu label ^1) Install RHEL x64 with Local Repo
kernel vmlinuz
append inst.ks=ftp://192.168.140.100/pub/anaconda-ks.cfg method=ftp://192.168.140.100/pub/inst_img initrd=initrd.img i nst.vnc inst.vncpassword=hpinvent
label 2
menu label ^2) Boot from local drive
(三) 调整关闭Service
为了方便配置,减少配置防火墙的工作,本文档中关闭了selinux和firewall,在企业生产环境中视情况而定,看看是否需要进行对应配置。
# echo 0 > /selinux/enforce
# vi /etc/selinux/config
修改SELINUX=enforcing为SELINUX=disabled
# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
#for SVRES in 3 4 5
do
chkconfig --level $SVRES dnsmasq on
chkconfig --level $SVRES vsftpd on
chkconfig --level $SVRES ip6tables off
chkconfig --level $SVRES iptables off
done
# chkconfig --list | grep -e tables -e dnsmasq -e vsftpd
# service ip6tables stop
# service iptables stop
# service dnsmasq start
# service vsftpd start
(四) 客户端自动安装场景测试记录
以下过程无需人工介入。
pic-1.jpg pic-2.jpg pic-3.jpg
后面安装过程自动完成。
网友评论