歡迎您光臨本站 註冊首頁

Kickstart無人值守批量安裝linux系統

←手機掃碼閱讀     火星人 @ 2014-03-08 , reply:0

藍色:輸入的命令部分

紅色:修改的配置文件

1、掛載系統安裝光碟到Kickstart伺服器 [root@localhost ~]# mkdir /kickstart [root@localhost ~]# mkdir /linuxinstall [root@localhost ~]# mkdir /tftpboot [root@localhost ~]# mkdir /tftpboot/pxelinux.cfg [root@localhost /]# mount /dev/cdrom /linuxinstall [root@localhost /]# vim /etc/fstab ...... /dev/cdrom /linuxinstall iso9660 defaults 0 0 ...... 2、設置yum倉庫源 [root@localhost ~]# cp /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/kickstart.repo

[root@localhost ~]# vim /etc/yum.repos.d/kickstart.repo ...... [kickstart] name=CentOS-$releasever - Media baseurl=file:///linuxinstall gpgcheck=0 enabled=1 ...... 3、安裝Kickstart需要的組件 [root@localhost ~]# yum install nfs* dhcp tftp* system-config-kickstart –y 4、設置nfs [root@localhost ~]# vim /etc/exports

...... /linuxinstall *(ro,sync) /kickstart *(ro,sync) /tftpboot *(ro,sync) ...... [root@localhost /]# exportfs -rv exporting *:/linuxinstall exporting *:/kickstart exporting *:/tftpboot 5、設置tftp [root@localhost /]# vim /etc/xinetd.d/tftp ...... disable = no(yes改成no) ......

6、配置DHCP [root@localhost ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf [root@localhost ~]# vim /etc/dhcpd.conf ......

ddns-update-style interim;

ignore client-updates;

allow booting; allow bootp;

subnet 192.168.159.0 netmask 255.255.255.0 {

option routers 192.168.159.2; option subnet-mask 255.255.255.0;

next-server 192.168.159.10;

filename "pxelinux.0";

range dynamic-bootp 192.168.159.128 192.168.159.254;

default-lease-time 21600;

max-lease-time 43200; } ...... 7、配置ks.cfg文件 #platform=x86, AMD64, 或 英特爾 EM64T # System authorization information auth --useshadow --enablemd5 # System bootloader configuration bootloader --location=mbr # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel

# Use graphical install graphical # Firewall configuration firewall --enabled # Run the Setup Agent on first boot firstboot --disable # System keyboard keyboard us # System language lang en_US # Installation logging level logging --level=info # Use NFS installation media nfs --server=192.168.159.10 --dir=/linuxinstall # Network information network --bootproto=dhcp --device=eth0 --onboot=on # Reboot after installation reboot

#Root password rootpw --iscrypted $1$9G/AkkmG$NtrFgqOQ4nAP.EUMXmxTP0 # SELinux configuration selinux --enforcing # Do not configure the X Window System skipx # System timezone timezone America/New_York # Install OS instead of upgrade install # Disk partitioning information part / --bytes-per-inode=4096 --fstype="ext3" --size=6000 part /boot --bytes-per-inode=4096 --fstype="ext3" --size=600 part swap --bytes-per-inode=4096 --fstype="swap" --size=1000 %packages @base @chinese-support

@core
@dialup @editors @gnome-desktop @games @graphical-internet @graphics @office @printing @sound-and-video @text-internet @base-x keyutils trousers fipscheck device-mapper-multipath libsane-hpaio xorg-x11-server-Xnest 8、配置支持pxe啟動 [root@localhost ~]# cp ks.cfg /kickstart/

[root@localhost ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/ [root@localhost ~]# cp /linuxinstall/images/pxeboot/vmlinuz /tftpboot/ [root@localhost ~]# cp /linuxinstall/images/pxeboot/initrd.img /tftpboot/ [root@localhost ~]# cp /linuxinstall/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default [root@localhost ~]# chmod a r /tftpboot/pxelinux.cfg/default [root@localhost ~]# vim /tftpboot/pxelinux.cfg/default default linux prompt 1 timeout 60 display boot.msg label linux kernel vmlinuz append ks=nfs:192.168.159.10://kickstart/ks.cfg initrd=initrd.img

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 - 9、啟動服務 [root@localhost /]# service dhcpd restart [root@localhost /]# chkconfig dhcpd on [root@localhost /]# service nfs restart [root@localhost /]# chkconfig nfs on

[root@localhost /]# service xinetd restart
[root@localhost /]# chkconfig xinetd on 10、測試

本文出自 「Darrenpan」 博客,請務必保留此出處http://darren.blog.51cto.com/1081720/746555


[火星人 ] Kickstart無人值守批量安裝linux系統已經有467次圍觀

http://coctec.com/docs/linux/show-post-46710.html