手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Kickstart 自动化安装Linux笔记

[日期:2012-11-10] 来源:Linux社区  作者:carllai [字体: ]

参考了各路大神的文章,结合自己实践过程,虽中间经历了些困难挫折,最终还是成功完成配置,实现了自动化安装Linux。

(重点参考灰度的 http://www.linuxidc.com/Linux/2012-11/73852.htm  )

安装环境,虚拟机VirtualBox虚拟2台机器,一台做kickstart服务器,一台做客户端

服务器系统为CentOS 6.3 X86_64, 安装光盘为CentOS 6.3 X86_64 DVD

网卡全部配置为“内部网络”

首先,需要用到的服务有,dhcpd, httpd, xinetd, tftp, 用yum 依次安装。

vim /etc/xinetd.d/tftp 修改tftp的守护进程配置文件,红色部分为修改的地方,

  1. service tftp 
  2.         disable                = no
  3.         socket_type            = dgram 
  4.         protocol                = udp 
  5.         wait                    = yes 
  6.       user                    = root 
  7.         server                  = /usr/sbin/in.tftpd 
  8.         server_args            = -u nobody -s /tftpboot 
  9.         per_source              = 11 
  10.         cps                    = 100 2 
  11.         flags                  = IPv4 

vim /etc/dhcp/dhcpd.conf 修改dhcp配置文件

  1. ddns-update-style interim;
  2. allow booting;
  3. allow bootp;
  4. ignore client-updates;
  5. set vendorclass = option vendor-class-identifier;
  6. subnet 192.168.0.0 netmask 255.255.255.0 {
  7.     option routers            192.168.0.1;
  8.     option subnet-mask        255.255.255.0;
  9.     range dynamic-bootp        192.168.0.10 192.168.0.50;
  10.     filename                  "/pxelinux.0";
  11.     default-lease-time        21600;
  12.     max-lease-time            43200;
  13.     next-server                192.168.0.1;
  14. }    

简单介绍:
Option routers指定网关;
Option domain-name-server指定DNS服务器;
Option subnet-mask指定掩码;
range dynamic-bootp指定分配给客户端的IP地址段;
Filename 指定启动镜像;
Next-server 指定TFTP服务器。

服务器的网卡ifcfg-eth0配置为静态IP:192.168.0.1, 子网掩码255.255.255.0, 网关192.168.0.1

设置开机启动服务,

chkconfig xinetd on

chkconfig dhcpd on

chkconfig httpd on

依次启动服务

service xinetd start

service dhcpd start

service httpd start

注意要关掉防火墙,selinux 设为permissive, 不然会导致PXE加载失败

挂载linux安装盘, mkdir -p /mnt/iso,  mount -o loop /dev/dvd /mnt/iso,

cp /mnt/iso/* /var/www/html, 将光盘内容全部复制到html根目录(采用httpd方式安装),

创建目录/tftpboot, 将Linux安装程序的内核、根文件系统文件及其他文件复制到tftp的根目录中,

罗列下/tftpboot目录下大概会用到的文件,

initrd.img (文件,从光盘/mnt/iso/isolinux/目录拷贝)

 pxelinux.0(文件,从/usr/share/syslinux目录拷贝,若无,则须安装syslinux)

 pxelinux.cfg(目录,自建,里面存放名为default的文件,该文件从/mnt/iso/isolinux/isolinux.cfg复制并改名为default)

 vmlinuz (文件,从/mnt/iso/isolinux/目录拷贝)

vesamenu.c32(文件,从/mnt/iso/isolinux/目录拷贝)

注意权限,chmod +x /tftpboot/pxelinux.cfg/default

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款