Centos6.5無人值守安裝

jopen 10年前發布 | 54K 次閱讀 CentOS

Centos6.5無人值守安裝 vsftpd+dhcp+nfs+tftp

步驟

1、mount /dev/sr0 /media/

2、安裝所需要的軟件

安裝并配置tftp服務

yum install tftp tftp-server vsftpd dhcp syslinux nfs-utils
vim /etc/xinetd.d/tftp
            service tftp
    {
        disable = no
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
    }
配置dhcp
# dhcpd.conf
    #
    # Sample configuration file for ISC dhcpd
    #

    allow booting;
    allow bootp;


    # A slightly different configuration for an internal subnet.
    subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.50 192.168.1.60;
    option domain-name-servers KangChangWei;
    option domain-name "KangChangWei";
    option routers 192.168.1.1;
    default-lease-time 600;
    max-lease-time 7200;
    filename "pxelinux.0";
    next-server 192.168.1.101;
    }
以上IP可以根據自己所在的網絡修改

3、復制所需要的啟動文件

cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
 cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot
 cp /media/images/pxeboot/initrd.img /var/lib/tftpboot/
 cp /media/images/pxeboot/vmlinuz /var/lib/tftpboot/

mkdir /var/lib/tftpboot/pxelinux.cfg
 cp  /media/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

編輯
 Vim /var/lib/tftpboot/pxelinux.cfg/default

default linux
#default vesamenu.c32
prompt 1
timeout 600

display boot.msg

menu background splash.jpg
menu title Welcome to CentOS 6.5!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000

label linux
  menu label ^Install or upgrade an existing system
  menu default
  kernel vmlinuz
  append initrd=initrd.img ks=ftp://192.168.1.101/pub/ks.cfg
label vesa
  menu label Install system with ^basic video driver
  kernel vmlinuz
  append initrd=initrd.img xdriver=vesa nomodeset
label rescue
  menu label ^Rescue installed system
  kernel vmlinuz
  append initrd=initrd.img rescue
label local
  menu label Boot from ^local drive
  localboot 0xffff
label memtest86
  menu label ^Memory test
  kernel memtest
  append -
4、共享光盤
vim /etc/export
/media *(ro,sync)
啟動nfs服務
[root@kcw ~]# /etc/init.d/rpcbind restart
停止 rpcbind:                                             [確定]
正在啟動 rpcbind:                                         [確定]
[root@kcw ~]# /etc/init.d/nfs restart
關閉 NFS 守護進程:                                        [確定]
關閉 NFS mountd:                                          [確定]
關閉 NFS 服務:                                            [確定]
Shutting down RPC idmapd:                                  [確定]
啟動 NFS 服務:                                            [確定]
啟動 NFS mountd:                                          [確定]
啟動 NFS 守護進程:                                        [確定]
正在啟動 RPC idmapd:                                      [確定]
查看nfs輸出
[root@kcw ~]# showmount -e localhost
Export list for localhost:
/media *
生成ks.cfg文件安裝工具
[root@kcw ~]# yum install system-config-kickstart
然后運行
system-config-kickstart
來修改頁面得到自己安裝的客戶端

我這里省略。。

這有個做好的ks.cfg

內容如下:

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
key --skip
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
nfs --server=192.168.1.101 --dir=/media
# Root password
rootpw --iscrypted $1$9ElloIHk$pO.NfjND/6K88z3CiIvPc.
# Network information
network  --bootproto=dhcp --device=eth0 --onboot=on
# System authorization information
auth  --useshadow  --passalgo=md5
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang zh_CN
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone  Asia/Shanghai
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all  
# Disk partitioning information
part swap --size 2048 
part /boot --size 200 
part pv.01 --size 30000 
volgroup vol0 pv.01
logvol / --vgname=vol0 --size=25000 --name=root
#logvol /home --vgname=vol0 --size=500 --name=home

%post
#wget ftp://192.168.1.101/pub/yum.repo -P /etc/yum.repos.d/
%packages
@ Desktop
@ Console internet tools
@ Desktop Platform
@ Development Tools
@ General Purpose Desktop
@ Graphical Administration Tools
@ Internet Browser
@ Network file system client
@ Printing client
@ X Window System
@ Chinese Support
注意我這塊root密碼是redhat

我這里分區時lvm分區根據你的需求也可以修改

然后把ks.cfg放到你的vsftpd默認可以訪問的目錄里

即:

[root@kcw ~]# cd /var/ftp/pub/
[root@kcw pub]# ls
ks.cfg
[root@kcw pub]# pwd
/var/ftp/pub
注意先測試你的這個文件能不能訪問打開IE

輸入ftp://192.168.1.101/pub/ks.cfg

看能否看到內容!

做完重啟dhcp vsftpd xine xinetd nfs

然后重新開臺電腦開機設置從網卡引導看能否啟動成功并且自動安裝

我這塊等待默認600秒 自動安裝

開機引導到boot:時按回車安裝



來自:http://my.oschina.net/leo1989/blog/311727

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!