KickStart無人值守安裝

PXE+DHCP+FTP+KickSsart

看完很多文檔並動手安裝,以下是我所理解的無人值守安裝系統實現原理及過程:
執行PXE+KickStart 安裝條件:1.DHCP服務器 2.TFTP服務器 3.KickStart 所生成的ks.cfg配置文件 4.一臺存放系統安裝文件的服務器,如NFS,HTTP,FTP等服務器 5.一個帶有PXE支持網卡的主機
客戶端支持PXE的電腦開機(預先打開網卡PXE功能,網絡引導)pxe是一種引導方式---> DHCP給該PXE client分配一個IP地址,並指明tftp文件服務器 ---> 客戶端會去tftp服務器上(/tftpboot 文件夾下面)下載到 pxelinux.0這樣一個文件,並拿到pxelinux.cfg文件夾下的default配置文件 ---> 根據該配置文件加載內核等操作,同時該配置文件中可以指明ks.cfg文件的地址,這樣實現全程無人值守安裝!
1.tftp服務器配置
[root@localhost Server]# rpm -ivh tftp-server-*.rpm
[root@localhost ~]# cat /etc/xinetd.d/tftp
# default: off
# de.ion: 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             = -s /tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
[root@localhost ~]# service xinetd restart
2.DHCP服務器配置
[root@localhost ~]#yum install dhcp*
[root@localhost ~]#cp /usr/share/doc/dhcp-3.*/dhcpd.conf.sample /etc/dhcpd.conf
[root@localhost ~]# cat /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
next-server 192.168.1.20;  #####PXE服務器IP地址
filename "pxelinux.0";
subnet 192.168.1.0 netmask 255.255.255.0 {
# --- default gateway
        option routers                  192.168.1.1;
        option subnet-mask              255.255.255.0;
#       option nis-domain               "domain.org";
#       option domain-name              "domain.org";
        option domain-name-servers      192.168.1.1;
        option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.168.1.1;
# --- 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 192.168.1.2 192.168.1.10;
        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;
#       }
}
[root@localhost ~]# /etc/init.d/dhcpd restart
3.準備相關文件
安裝目錄樹,ks.cfg,initrd.img,pxelinux.0,pxelinux.cfg,vmlinuz
A--把安裝目錄樹拷貝到一個共享目錄中,例如,/var/ftp/pub下面,用ftp共享
[root@localhost ~]# yum install vsftpd
[root@localhost ~]# /etc/init.d/vsftpd restart
[root@localhost ~]# mount /dev/mount /mnt
[root@localhost ~]# cp -rf /mnt/*  /var/ftp/pub
B--[root@localhost ~]#mkdir -p tftpboot
[root@localhost ~]#cp /usr/lib/syslinux/pxelinux.0 /tftpboot
[root@localhost ~]#cp /var/ftp/pub/images/pxeboot/{initrd.img,vmlinuz} /tftpboot
[root@localhost ~]#cp /var/ftp/pub/isolinux/*.msg  /tftpboot
[root@localhost ~]#mkdir /tftpboot/pxelinux.cfg
[root@localhost ~]#touch /tftpboot/pxelinux.cfg/default
[root@localhost ~]#cd /tftpboot/pxelinux.cfg
[root@localhost ~]#cp /var/ftp/pub/isolinux/isolinux.cfg  /tftpboot/pxelinux.cfg/default
4、配置KickStart
[root@localhost ~]#yum install system-config-kickstart
1在gnome環境下[root@localhost ~]#system-config-kickstart 對系統進行一些基本的配置如,選擇時區,設置root密碼,及安裝選項
2下面選擇ftp安裝
3選擇批量安裝的分區信息,創建4個分區 /、/boot、/data、swap
4網絡配置,使用靜態分配地址
5軟件包安裝根據自己需求選擇
6最後保存ks.cfg文件,把ks.cfg保存到/var/ftp/下(修改ks.cfg文件添加一行 key --skip  一定要有這一行,用來跳過註冊碼輸入的,不然會失敗,本人在這裏卡了好多次!)
7修改default文件內容:
[root@localhost ~]# cat /tftpboot/pxelinux.cfg/default
default linux
prompt 1
timeout 60
display boot.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img text ks=ftp://192.168.1.20/ks.cfg
6、關閉防火牆及SLinux
7、客戶端引導安裝
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章