CentOS Kickstart 기반 자동화 설치

환경 준비
맞 춤 형 시스템
CentOS-6.4-x86_64
공식 다운로드 주소 -http://wiki.centos.org/Download
패 키 지 를 설치 하 다
인터넷 기술 대리, export httpproxy=ip:port
1
yum -y install createrepo mkisofs

제작 공정
디 렉 터 리 구조
CentOS 원본 미 러 내용 을 복사 하여 간소화 하지 않 습 니 다.
1
2
3
4
mkdir /mnt/centos
mount /dev/sr0 /mnt/centos
mkdir /tmp/iso
cp -r /mnt/centos/* /tmp/iso

Kickstart 프로필 추가
파일 경로 와 설치 방식 을 자 유 롭 게 정의 할 수 있 습 니 다.
1
2
3
4
5
6
7
8
9
10
11
12
cd /tmp/iso/isolinux
#    ,  ks=  
vi isolinux.cfg

label linux
  menu label ^Install or upgrade an existing system
  menu default
  kernel vmlinuz
  append initrd=initrd.img ks=cdrom:/isolinux/ks.cfg

#    Kickstart    
vi ks.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#  Kickstart     CentOS   - http://wsgzao.github.io/post/kickstart/
#Kickstart file automatically generated by anaconda.
#version=DEVEL

#Install OS instead of upgrade
#     ,     
install

#Use text mode install
#       
text

#Use network installation
#      
#url --url=ftp://ip/centos
#Local installation Use CDROM installation media
#       
cdrom

#Installation Number configuration
#   RedHat   ,     key,       ,                   key
#key –skip

#System language
#    
#lang en_US.UTF-8
lang zh_CN.UTF-8

#System keyboard
#    
keyboard us

#Network information
#    
#network --device eth0 --bootproto dhcp --onboot yes

#Root password 
#root  
rootpw chinaums

#Firewall configuration
#     
firewall --disabled

#SELinux configuration 
#  selinux
selinux --disabled

#Run the Setup Agent on first boot
#               
firstboot --disable

#System authorization information
#      ,useshadow        ,--passalgo        
authconfig --enableshadow --passalgo=sha512

#System timezone 
#       
timezone --isUtc Asia/Shanghai

#System bootloader configuration
#  bootloader     ,        ,            ,        
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"

#Clear the Master Boot Record
#  MBR    
zerombr yes

#Partition clearing information
#          
clearpart --all --initlabel

#Disk partitioning information 
#     

#    200M       /boot   ext4
part /boot --fstype=ext4  --size=200 --ondisk=sda

#    20000M   SWAP  
part swap --size=20000 --ondisk=sda

#  /  
part / --fstype=ext4 --grow --size=1 --ondisk=sda

#Reboot after installation
#        
reboot --eject

#This packages is for CentOS 6.4
# CentOS 6.4      
%packages
@base
@core
@chinese-support
@server-policy
telnet

#          
%post
#config service 
#     
service NetworkManager stop
chkconfig NetworkManager off
service network restart

#eject cdrom
#         
#eject

#reboot
#        
#reboot -f 

#       
%end

의존 관계 와 ISO 파일 생 성
경로 와 명령 의 정확성 에 주의 하 십시오.
1
2
3
cd /tmp/iso
createrepo -g repodata/*comps.xml . 
mkisofs -o /tmp/CentOS-6.4_64_auto.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table  -joliet-long  -R -J -v -T /tmp/iso/

테스트 및 제안
참고 문헌 두 편 을 추천 하 며, 먼저 가상 컴퓨터 에서 테스트 검증 을 반복 한 다음 물리 기 배치 에 도착 하 는 것 을 권장 합 니 다.

좋은 웹페이지 즐겨찾기