pengjunling 发表于 2018-11-24 13:43:58

使用Kickstart+Apache+Dhcp+Pxe无人值守安装操作系统

  今天在班上,老板发了两台旧的服务器,让我和同事把系统装上。手上没有U盘,拿了个新光驱,光驱也坏了,这。。
  我们想到了用kicskstart来安装系统。刚好手里一台手提电脑,真机就是RedHat6.2(如果在手提电脑上做虚拟机也是可行的),下面我们开始来做服务。
  设备: 1台笔记本,1台机架式老式服务器(虽然老也是至强E5的),1张红帽系统光盘或者ISO镜像文件
  系统: RedHat 6.2
  安装的具体步骤如下 所示:
  1.安装Httpd:
  yum install -y httpd*
  2.挂载Rhel6.x的光盘,并复制光盘下的所有内容,到/var/www/html下:
  mount /dev/cdrom /media
  cp -rf /media/* /var/www/html
  3).安装tftp-server, 并启动tftp服务,同时启动 xinetd进程:
  1.rpm -ivh tftp-server-xxx.rpm
  2.vim /etc/xinetd.d/tftp
  #default:off
  #description:The tftp server servers files using the trivial file transfer \
  #protocol. The tftp prorocol is often used to boot diskless \
  #workstations,download configuration files to network-aware printers,\
  #and to start the installation process for some operatiing systems.
  service tftp
  {
  socket_type = dgram
  protocol = udp
  wait = yes
  user = root
  server = /usr/sbin/in.tftpd
  server_args = -s /tftpboot
  disable = no # disable 的值被改变原来为no
  per_source = 11
  cps = 100 2
  flags = IPV4
  }
  3.service xinetd restart
  这里就是把TFTP功能开启,YES改为NO即可。
  4)配置支持PXE启动程序
  建立tftpboot文件夹,如下所示(若已存在不用建立)
  mkdir /tftpboot(注:tftp配置文件看上面的配置文件路径在哪里)
  复制pxelinux.0文件至tftpboot文件夹中:
  cp /usr/lib/syslinux/pxelinux.0 /tftpboot
  把Linux第一张安装光盘上的/image/pxeboot/initrd.img和vmlinux复制到/tftpboot/中
  cp /var/www/html/image/pxeboot/initrd.img /tftpboot
  cp /var/www/html/pxeboot/vmlinux /tftpboot
  复制第一张光盘上的isolinux/*.msg到/tftpboot目录下:
  cp /var/www/html/isolinux/*.msg /tftpboot
  在tftpboot中新建一个pxelinux.cfg目录如下:
  mkidr pxelinux.cfg
  把第一张安装光盘上的isolinux.cfg复制到pxelinux.cfg目录中,同时更改文件为default:
  cd pxelinux.cfg
  cp /var/www/html/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
  ####default文件默认参数########
  default linux
  prompt 1
  timeout 600
  display boot.msg
  F1 boot.msg
  F2 options.msg
  F3 general.msg
  F4 param.msg
  F5 rescue.msg
  label linux
  kernel vmlinuz
  append initrd=initrd.img ks=http://192.168.1.200/ks.cfg
  label text
  kernel vmlinuz
  append initrd=initrd.img text
  label ks
  kernel vmlinuz
  append ks initrd=initrd.img
  label local
  localboot 1
  label memtest86
  kernel memtest
  append -
###########default文件默认参数##################

  5)安装Dhcp服务,同时修改配置:
  yum install -y dhcp
  然后复制到配置模板指定的目录中,并重新命名:
  cp /usr/share/doc/dhcp-x.0.1/dhcpd.conf.sample /etc/dhcpd.conf
  接着修改配置文件,添加一行:filename "/pxelinux.0"
  # vim /etc/dhcpd.conf
  ddns-update-style interim;
  ignore clinet-updates;
  next-server192.168.1.14; #PXE服务器IP地址
  filename "/pxelinux.0";
  ...
  ...
  最后启动DHCP服务如下:
  service dhcpd start
  6)安装Kickstart,同时配置KickStart
  首先需要安装KickStart工具包,命令如下:
  rpm -ivh system-config-kickstart-*.rpm
  在Gnone环境下配置kickstart.命令如下:
  system-config-kickstart
  8)保存到/var/www/html/ks.cfg
  重新引导即可,注意default文件的几个红色的参数



页: [1]
查看完整版本: 使用Kickstart+Apache+Dhcp+Pxe无人值守安装操作系统