这两天在学习如何通过kickstart配置进行RHEL 5 系统安装 kickstart 1. 学习配置环境如下 VMware虚拟机 构建需要安装的服务器 网络安装服务器 使用Apache 2.2.3 构建放置安装文件的http server 系统安装镜像 rhel-server-5.3-x86_64-dvd.iso 已经解压到http server的redhat目录中 http://192.168.0.10/redhat/ 2. 在已有的Linux系统中用kickstart向导创建kickstart配置文件或者在/root目录下找到 anaconda-ks.cfg文件,作为修改的模板,这个文件就是在普通安装Linux的时候产生的,如下 [root@RHEL5-64bit ~]# ls anaconda-ks.cfg Desktop install.log install.log.syslog cat anaconds-ks.cfg 如下 # Kickstart file automatically generated by anaconda. install cdrom key --skip lang en_US.UTF-8 keyboard us xconfig --startxonboot network --device eth0 --bootproto static --ip 192.168.0.90 --netmask 255.255.255.0 --gateway 192.168.0.1 --nameserver 192.168.0.1 --hostname RHEL5-64bit rootpw --iscrypted $1$BqMcREee$GPmj7eyKhMn1TZuL1z7si/ firewall --enabled --port=22:tcp authconfig --enableshadow --enablemd5 selinux --enforcing timezone --utc Asia/Shanghai bootloader --location=mbr --driveorder=sda --append="rhgb quiet" # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work #clearpart --linux --drives=sda #part /boot --fstype ext3 --size=100 --ondisk=sda #part pv.2 --size=0 --grow --ondisk=sda #volgroup VolGroup00 --pesize=32768 pv.2 #logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow #logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=1008 --grow --maxsize=2016 %packages @office @editors @text-internet @gnome-desktop @dialup @core @base @java @legacy-software-support @base-x @chinese-support @graphics @sound-and-video @admin-tools @graphical-internet emacs kexec-tools fipscheck device-mapper-multipath xorg-x11-utils xorg-x11-server-Xnest libsane-hpaio gimp gftp -slrn -fetchmail -cadaver -ImageMagick -nspluginwrapper 上面各项kickstart的参数的设置可以参考 http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5/html/Installation_Guide/index.html 中的 30.4. Kickstart Options 3. 根据2,创建出如下网络无人值守安装的ks.cfg配置文件,并作了注释 install #指定网络安装的路径,我用的是http安装 url --url=http://192.168.0.10/redhat/ key --skip #platform=x86, AMD64, or Intel EM64T # System authorization information auth --useshadow --enablemd5 # System bootloader configuration bootloader --location=mbr --driveorder=sda --append="rhgb quiet" # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel # Use graphical install #graphical # Firewall configuration firewall --enabled --ssh # Run the Setup Agent on first boot firstboot --disable # System keyboard keyboard us # System language lang en_US.UTF-8 # Language supoort langsupport zh_CN.UTF-8 # Installation logging level logging --level=info # Network information network --bootproto=static --device=eth0 --gateway=192.168.0.1 --ip=192.168.0.91 --nameserver=192.168.0.1 --netmask=255.255.255.0 --onboot=on --hostname KS-test01 #Root password rootpw --iscrypted $1$.IK57hlp$U86jPiwZ6cjSwOJUj2WFr. # SELinux configuration selinux --enforcing # System timezone timezone Asia/Shanghai # X Window System configuration information xconfig --defaultdesktop=GNOME --depth=16 --resolution=800x600 # Disk partitioning information clearpart --all --drives=sda part /boot --bytes-per-inode=4096 --fstype="ext3" --size=108 --ondisk=sda part pv.2 --size=0 --grow --ondisk=sda volgroup vg01 pv.2 logvol swap --fstype swap --name=lvswap --vgname=vg01 --size=512 logvol / --fstype ext3 --name=lgroot --vgname=vg01 --size=4000 logvol /home --fstype ext3 --name=lghome --vgname=vg01 --size=2048 logvol /var --fstype ext3 --name=lgvar --vgname=vg01 --size=1024 #指定安装完毕后,自动重启,如果不指定reboot这一参数,要手动重启,还有就是该参数放在其他地方会出错 reboot #指定安装包,可以指定软件组Group名称,或者单个软件包名称,名称可以通过光盘的或镜像的variant/repodata/comps-*.xml获得,如果名称出错或造成安装中断 %packages @chinese-support @ X Window System @ GNOME Desktop Environment @ Graphical Internet @ Sound and Video 将该文件ks.cfg放到http sever的根目录下,如下 http://192.168.0.10/ks.cfg 4. 安装时用启动盘启动主机,我是在VMware虚拟机中通过iso镜像启动的 在提示符 boot: 后输入启动参数 如下 boot: linux ks=http://192.168.0.10/ks.cfg 这样便根据ks.cfg配置自动安装,中间不用做任何干预 总结使用kickstart的方式可以应用在如下几个方面: a. 数量较多的服务器部署或者update,方便不耗时间; b. 服务器安装前期详细规划,如主机的资源分配,参数设置规划等; c. 快速创建实验用的操作系统; -- The End -- GDLWX 2009.02.07 BJ |
|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )
GMT+8, 2024-9-29 21:25 , Processed in 0.123102 second(s), 12 queries , Gzip On, MemCache On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.