Chinaunix首页 | 论坛 | 博客
  • 博客访问: 386709
  • 博文数量: 80
  • 博客积分: 1750
  • 博客等级: 上尉
  • 技术积分: 1380
  • 用 户 组: 普通用户
  • 注册时间: 2011-11-13 11:35
文章分类
文章存档

2014年(3)

2013年(1)

2012年(54)

2011年(22)

分类: LINUX

2011-11-14 17:12:08

PXE自动化部署安装

系统环境: RHEL6.1_x86_64 iptables diabled
server: 192.168.0.4
系统镜像:rhel-server-6.1-x86_64-dvd.iso


将镜像通过http/ftp发布,此处使用ftp发布镜像
创建挂在点
mkdir /var/ftp/pub/iso
挂在镜像
mount -o loop /mnt/rhel-server-6.1-x86_64-dvd.iso /var/ftp/pub/iso
service vsftpd restart
chkconfig vsftpd on
1.生成kickstart安装脚本
a. yum install system-config-kickstart-2.8.6.3-1.el6.noarch
安装此软件后在Application-->System Tools --> Kickstart 采用图形化生成kickstart安装脚本
b. 或者在/root/目录里的anaconda-ks.cfg文件为kickstart的模板,将根据要求修改,生成
kickstart安装脚本,改名为ks.cfg
将生成的脚本放置在/var/www/html/目录,并确保其可以发布,即可用访问
到.
以下为一个简化的kickstart安装脚本
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url=""
# Root password
rootpw --iscrypted $1$u8pJnYgb$ZE0rVkip891Pdf/VYe6Wm0
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System authorization information
auth --useshadow --passalgo=md5
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone --isUtc Asia/Shanghai
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=100
part swap --fstype="swap" --size=1024
part / --fstype="ext4" --grow --size=1

%packages
@base
%end
2. 配置tftp服务
yum install xinetd tftp-server -y
cd /var/lib/tftpboot/
cp /usr/share/syslinux/pxelinux.0 .
cp /var/ftp/pub/iso/isolinux/* .
Mkdir pxelinux.cfg
cp isolinux.cfg pxelinux.cfg/default
vim pxelinux.cfg/default
....
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=
label rescue
menu label ^Rescue installed system
kernel vmlinuz
append initrd=initrd.img rescue

service xinetd start
chkconfig tftp on
3.配置dhcp服务
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
# option definitions common to all supported networks...
option domain-name "example.com";
option domain-name-servers 192.168.0.4;
default-lease-time 600;
max-lease-time 7200;

# Use this to enble / disable dynamic dns updates globally.
ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# This is a very basic subnet declaration.
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.20;
option routers 192.168.0.4;

}
filename "pxelinux.0";
next-server 192.168.0.4;

service dhcpd restart
chkconfig dhcp on



....GOOD LUCK!

阅读(1606) | 评论(0) | 转发(0) |
0

上一篇:drbd分布式块复制

下一篇:serync单相同步

给主人留下些什么吧!~~