码迷,mamicode.com
首页 > 其他好文 > 详细

kickstart自动化系统安装

时间:2014-05-13 12:18:53      阅读:375      评论:0      收藏:0      [点我收藏+]

标签:kickstart   自动化安装   

                          kickstart自动化linux系统安装

一、系统环境


 redhate 6.3

IP:10.240.240.210,  Gateway: 10.240.240.1


二 、使用yum方式安装软件包


 yum install -y tftp* xinetd "*dhcp*" nfs-utils-*


三、配置dhcp服务器


 配置DHCP服务器的配置文件

 [root@localhost tftpboot]# vi /etc/dhcpd.conf  

  # DHCP Server Configuration file.

  #   see /usr/share/doc/dhcp*/dhcpd.conf.sample

  #   see ‘man 5 dhcpd.conf‘

  ddns-update-style interim;

  ignore client-updates;

  filename "/pxelinux.0";

  next-server 10.240.240.210;

  allow booting;

  allow bootp;


  subnet 10.240.240.0 netmask 255.255.255.0 {


  # --- default gateway

          option routers                  10.240.240.1;

          option subnet-mask              255.255.255.0;


          option nis-domain               "jiayuan.com";

          option domain-name              "jiayuan.com";

          option domain-name-servers      10.240.210.98;


          option time-offset              -18000; # Eastern Standard Time

  #       option ntp-servers              10.240.210.98;

  #       option netbios-name-servers     10.240.210.98;

  # --- Selects point-to-point node (default is hybrid). Don‘t change this unless

  # -- you understand Netbios very well

  #       option netbios-node-type 2;


          range dynamic-bootp 10.240.240.220 10.240.240.240;

          default-lease-time 21600;

          max-lease-time 43200;


          # we want the nameserver to appear at a fixed address

         host ns {

                 next-server marvin.redhat.com;

                 hardware ethernet 12:34:56:78:AB:CD;

                 fixed-address 207.175.42.254;

         }

  }


四、配置tftp服务器

  配置tftp服务器的配置文件

  [root@localhost tftpboot]# vi /etc/xinetd.d/tftp


  # default: off

  # description: The tftp server serves files using the trivial file transfer \

  #       protocol.  The tftp protocol is often used to boot diskless \

  #       workstations, download configuration files to network-aware printers, \

  #       and to start the installation process for some operating systems.

  service tftp

  {

       socket_type             = dgram

       protocol                = udp

       wait                    = yes

       user                    = root

       server                  = /usr/sbin/in.tftpd

       server_args             = -u nobody -s /tftpboot #指定目录

       disable                 = no  #将yes改为no

       per_source              = 11

       cps                     = 100 2

       flags                   = IPv4

  }


五、配置NFS服务器,添加共享目录

  [root@localhost ~]# vi /etc/exports  

  /mnt/cdrom *(ro,sync)

  /tftpboot *(ro,sync)

六、复制pxelinux.0、initrd.img、vmlinuz、isolinux/*.msg 到/tftpboot/目录下


1、正常情况下linux系统没有安装syslinux包,需要安装syslinux包

  yum install -y syslinux

  syslinux包安装完后会在/usr/share/syslinux/

  先 cp -r /usr/share/syslinux/ /usr/lib/


2、新建一个/mnt/cdrom目录,把镜像的iso文件挂载到/mnt/cdrom下


3、如果没有/tftpboot/目录先建立一个

  mkdir /tftpboot/

  cp /usr/lib/syslinux/pxelinux.0 /tftpboot/  

  cp /mnt/cdrom/images/pxeboot/{initrd.img,vmlinuz} /tftpboot/  

  cp /mnt/cdrom/isolinux/*.msg /tftpboot

4、配置default文件

 mkdir /tftpboot/pxelinux.cfg

 touch /tftpboot/pxelinux.cfg/default

 vi /tftpboot/pxelinux.cfg/default

  default linux

  prompt 1

  timeout 600

  display boot.msg

  label linux

    kernel vmlinuz

    append initrd=initrd.img nofb text  ks=nfs:10.240.240.210:/tftpboot/ks.cfg

 label text

   kernel vmlinuz

   append initrdinitrd=initrd.img text

 label ks

   kernel vmlinuz

   append ks initrdinitrd=initrd.img

 label local

   localboot 1

 label memtest86

   kernel memtest

   append -


Pxe已经完成了,想用ks完成全自动安装的可以往下看。


七、使用kickstarter配置安装文件。


 [root@localhost tftpboot]# pwd

  /tftpboot

 [root@localhost tftpboot]# ls

  boot.msg  initrd.img  pxelinux.0  pxelinux.cfg  vmlinuz


 [root@localhost tftpboot]# vi ks.cfg  

  install

  nfs --server=10.240.240.210 --dir=/mnt/cdrom

  text

  key --skip

  keyboard us

  lang en_US.UTF-8

  skipx

  network --device eth0 --bootproto dhcp

  rootpw root

  firewall --disabled

  authconfig --enableshadow --enablemd5

  selinux --disabled

  timezone --utc Asia/Shanghai

  bootloader --location=mbr --driveorder=sda

  zerombr yes

  clearpart --all


  part /boot --fstype ext4 --size=200

  part /     --fstype ext4 --size=20000

  part swap  --fstype swap --size=8192

  part /u01  --fstype ext4 --grow --size=200

  reboot


 %packages

 @base

 @core

 @server-policy

 ipmitool

 OpenIPMI

 openssh-clients

 net-snmp

 %post



八、把/tftpboot/ 目录的权限修改为最大

  chmod 777 /tftpboot/ -R


九、关闭防火墙并启动相关的服务

 1、关闭防火墙

  service iptables stop


 2、关闭selinux (关闭后重启机器)

   vi /etc/selinux/config

   SELINUX=disabled


 3、启动服务

  service dhcpd start

  service xinetd start

  service rpcbind start  

  service nfslock start

  service nfs start

 4、把上面的服务写到启动项

  vi /etc/rc.local

  service iptables stop

  service dhcpd start

  service xinetd start

  service rpcbind start  

  service nfslock start

  service nfs start


本文出自 “zhanguo1110” 博客,请务必保留此出处http://zhanguo1110.blog.51cto.com/5750817/1410143

kickstart自动化系统安装,布布扣,bubuko.com

kickstart自动化系统安装

标签:kickstart   自动化安装   

原文地址:http://zhanguo1110.blog.51cto.com/5750817/1410143

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!