kickstart無人值守安裝系統

1.搭建環境

[root@centos ~]# cat /etc/redhat-release 
CentOS release 6.5 (Final)
[root@centos ~]# uname -a
Linux centos 2.6.32-431.20.3.el6.x86_64 #1 SMP Thu Jun 19 21:14:45 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux


2.kickstart原理



3.安裝http服務

[root@kickstart ~]# yum install -y http*
[root@kickstart ~]# mkdir -p /var/www/html/iso
[root@kickstart ~]# /etc/init.d/httpd start


4.安裝tftp服務

[root@kickstart ~]# yum install xinetd tftp tftp-server -y
[root@kickstart ~]# vim /etc/xinetd.d/tftp 
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot -c
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
[root@kickstart ~]# /etc/init.d/xinetd start
[root@centos ~]# yum install -y syslinux
[root@centos ~]# mkdir -p /tftpboot/pxelinux.cfg
[root@centos ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/
[root@centos ~]# cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default 
[root@centos ~]# cp /mnt/p_w_picpaths/pxeboot/initrd.img /tftpboot/
[root@centos ~]# cp /mnt/p_w_picpaths/pxeboot/vmlinuz /tftpboot/
[root@centos ~]# cp /mnt/isolinux/vesamenu.c32 /tftpboot/
[root@centos ~]# chmod +w /tftpboot/pxelinux.cfg/default 
[root@centos ~]# vim /tftpboot/pxelinux.cfg/default
label kickstart
  menu label ^Kickstart
  menu default
  kernel vmlinuz
  append initrd=initrd.img ks=http://192.168.1.10/ks.cfg


5.安裝DHCP

[root@centos ~]# yum install -y dhcp
[root@centos ~]# vim /etc/dhcp/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers                  192.168.1.10;
option subnet-mask              255.255.255.0;
option time-offset              28800; 
range dynamic-bootp 192.168.1.100 192.168.1.200;
default-lease-time 21600;
max-lease-time 43200;
next-server  192.168.1.10;   
filename "pxelinux.0";        
}
[root@centos ~]# /etc/init.d/dhcpd start


6.配置ks.cfg

[root@kickstart html]# pwd
/var/www/html
[root@kickstart html]# mount /dev/cdrom iso/
[root@kickstart html]# vim ks.cfg 
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://192.168.1.10/iso"
# Root password
rootpw --plaintext 12345678
# System authorization information
auth  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# 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
# Network information
network  --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all  
# Disk partitioning information
part /boot --fstype="ext4" --size=100
part swap --fstype="swap" --size=1024
part / --fstype="ext4" --grow --size=1
%packages
@base
@compat-libraries
@debugging
@development
@dial-up
@hardware-monitoring
@performance
%end


7.啓動服務

[root@kickstart ~]# setenforce 0
[root@kickstart ~]# getenforce  
Permissive
[root@kickstart ~]# /etc/init.d/iptables stop
[root@kickstart ~]# /etc/init.d/httpd start
[root@kickstart ~]# /etc/init.d/xinetd start
[root@kickstart ~]# /etc/init.d/dhcpd start


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章