最新消息:

多VLAN环境使用PXE自动化部署Linux

自动化 admin 7223浏览 0评论
系统:CentOS 5.5 X86_64
环境:HTTP+TFTP+DHCP+Kickstart
一、部署Nginx用于提供系统安装文件下载
#tar xvf nginx-1.1.3.tar.gz
#cd nginx-1.1.3
#./configure –prefix=/usr/local/nginx –user=www –group=www

 

#make && make install
准备系统安装盘ISO镜像文件,上传到/data/web/iso目录
创建镜像文件挂载目录:
mkdir -p /data/web/centos5.5
将ISO镜像进行挂载:
/bin/mount -o loop /data/web/iso/CentOS-5.5-x86_64-bin-DVD-1of2.iso /data/web/centos5.5
配置Nginx:在server中添加如下行,
        location ^~ /centos5.5 {
                root /data/web;
                access_log /dev/null;
                autoindex on;
                autoindex_exact_size off;
                autoindex_localtime on;
        }
检查Nginx配置文件:
# /etc/init.d/nginx check
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
启动Nginx:
# /etc/init.d/nginx start
# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      12250/nginx.conf
使用浏览器进行查看:
wpid-1cbefa03c382ac3f9d1350494bf54397_340735191
二、安装自动部署环境
TFTP+DHCP+Kickstart
# yum -y install system-config-netboot dhcp
启动服务:
# chkconfig –level 2345 tftp on
# /etc/init.d/xinetd start
三、配置DHCP,以用于多VLAN环境
这里有三个VLAN:
VLAN10:放置DHCP服务器(也是自动安装服务器),网段10.1.1.0/24,网关为10.1.1.1
VLAN20:网段10.1.2.0/24,网关为10.1.2.1
VLAN30:网段10.1.3.0/24,网关为10.1.3.1
# cat /etc/dhcpd.conf
ddns-update-style interim;
allow booting;  #要加这两项参数
allow bootp;
option subnet-mask              255.255.255.0;
next-server 10.1.1.2; #自动系统安装服务器(即DHCP服务器)
filename “/linux-install/pxelinux.0″; #tftp服务端的引导镜像
subnet 10.1.1.0 netmask 255.255.255.0 {
        option routers                  10.1.1.1;
        range 10.1.1.100 10.1.1.200;
}
subnet 10.1.2.0 netmask 255.255.255.0 {
        option routers                  10.1.2.1;
        range dynamic-bootp 10.1.2.100 10.1.2.200;
}
subnet 10.1.3.0 netmask 255.255.255.0 {
        option routers                  10.1.3.1;
        range dynamic-bootp 10.1.3.100 10.1.3.200;
}
启动DHCP服务:
# /etc/init.d/dhcpd start
然后需要在三层交换机上做DHCP中继;
四、创建自动化系统安装环境
# pxeos -a -i “Auto Install CentOS5.5 X86_64″ -p HTTP -D 0 -s 10.1.1.2 -L /centos5.5 -K http://10.1.1.2/scripts/kscfg/ks-centos5.5.cfg Auto_CentOS5.5
五、测试
客户机从网卡启动,按1将自动进行系统安装(图略)。
六、一些建议
1.在IDC环境自动安装服务器,建议使用服务器内网卡进行安装,避免安装服务器时的大量数据影响生产环境正常数据的处理。
2.客户端服务器多网卡时,为了不需要手工选择网卡,可以通过修改default文件(通过ksdevice=eth0)来指定一个固定网卡进行安装,详情可见:

转载请注明:爱开源 » 多VLAN环境使用PXE自动化部署Linux

您必须 登录 才能发表评论!