kickstart安装centos

 

             dhcp+tftp+nfs+kickstart全自动安装centos
            (本测试实验的所有包均为yum安装,不会yum的朋友请查看其他相关文档)
             本文为原创文章,如转载请注明出处
1.安装DHCP并配置,配置文件如下
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.1.0 netmask 255.255.255.0 {
 
        option routers                  192.168.1.200;
        option subnet-mask              255.255.255.0;
 
        option domain-name-servers      8.8.8.8;
        next-server     192.168.1.249;
        filename        "pxelinux.0";
        option time-offset              -18000; # Eastern Standard Time
        range dynamic-bootp 192.168.1.128 192.168.1.254;
        default-lease-time 21600;
        max-lease-time 43200;
}
2.安装tftp并配置
vi /etc/xinetd.d/tftp
disable=no
3.复制相关文件
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
cp /mnt/isolinux/{vmlinuz,initrd.img} /tftpboot/
mkdir /tftpboot/pxelinux.cfg
cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
chmod u+x /tftpboot/pxelinux.cfg/default
4.修改default文件全部内容如下:
default linux
prompt 1
timeout 6
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
 kernel vmlinuz
 append ks=nfs:192.168.1.249:/centosinstall/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 -
5.配置nfs服务:
vi /etc/exports
/centosinstall *(rw,sync)
6.将光盘的全部内容拷贝到/centosinstall下
7.安装kickstart程序
yum install system-config-kickstart*
在终端中运行system-config-kickstart进行配置,保存为文件ks.cfg
cp /root/ks.cfg /centosinstall/ks.cfg
修改/centosinstall/ks.cfg文件,全部内容如下:
#platform=x86, AMD64, 或 Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel #这句必须得添加
# Use graphical install
graphical
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang zh_CN
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.1.249 --dir=/centosinstall
key --skip #这里的意思是跳过输入序列号的选项
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
#Root password
rootpw --iscrypted $1$99lNdkE6$ygsGGG/KYjTZHbJ4SSwV91
 
# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=8 --resolution=640x480
# Disk partitioning information
part / --bytes-per-inode=4096 --fstype="ext3" --size=20000
part swap --bytes-per-inode=4096 --fstype="swap" --size=1024
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
 
%packages
@base
@chinese-support
@core
@development-libs
@development-tools
@dialup
@editors
@gnome-desktop
@gnome-software-development
@graphical-internet
@graphics
@java
@java-development
@kde-desktop
@kde-software-development
@legacy-software-development
@legacy-software-support
@office
@printing
@sound-and-video
@text-internet
@x-software-development
@base-x
keyutils
libhbaapi
trousers
fipscheck
device-mapper-multipath
fuse-libs
systemtap-sdt-devel
perl-XML-SAX
pth
perl-XML-Twig
perl-XML-Dumper
perl-TimeDate
perl-libxml-perl
tog-pegasus-devel
perl-Convert-ASN1
libstdc++44-devel
libassuan-devel
perl-XML-NamespaceSupport
perl-DateManip
libksba-devel
fipscheck-devel
sblim-cmpi-dhcp-devel
perl-Crypt-SSLeay
perl-Mozilla-LDAP
pth-devel
perl-LDAP
perl-XML-Grove
libpciaccess-devel
python-imaging
libhbaapi-devel
fuse-devel
libksba
perl-Archive-Zip
gcc44-c++
gcc44-gfortran
pexpect
dejagnu
imake
java-1.6.0-openjdk-devel
gcc-objc
ElectricFence
memtest86+
gcc-gnat
libgfortran44
gcc44
expect
java-1.6.0-openjdk
unifdef
nasm
gnome-bluetooth
gconf-editor
gnome-pilot-conduits
compiz
gnome-keyring-manager
dasher
libgnome-java
gob2
libgtk-java
libglade-java
libgconf-java
kdegraphics
libsane-hpaio
bsh-demo
kdeadmin
kdesdk-devel
compat-db
openssl097a
qt4
compat-readline43
compat-openldap
compat-slang
openmotif22
gtk+
kdepim
kdemultimedia
xorg-x11-xbitmaps
mesa-libGLw-devel
openmotif-devel
icon-naming-utils
mesa-libGLU-devel
icon-slicer
xorg-x11-server-sdk
libXp-devel
xorg-x11-server-Xnest
xorg-x11-server-Xvfb
8.启动相关服务
service dhcpd restart
service portmap restart
srevice nfs restart
service xinetd restart
9.在客户机上使用网卡启动等待安装即可!!!
小结:在ks.cfg的文件中%packages后面的为客户机所安装的软件列表,如果想与服务器的安装一样的话可以参考/root/anaconda-ks.cfg的相关行粘贴过去即可。
                                                                                                                                                   
 
                                                                                  
 

你可能感兴趣的:(kickstart)