kickstart无人值守安装——制作光盘文件

kickstart无人值守安装——制作光盘文件

通过制作的光盘镜像文件,利用kickstart 进行无人值守安装。

第一步 准备工作

[plain]

#在/opt目录下创建rhel6目录

[root@larrywen opt]# mkdir rhel6

#挂载镜像

[root@larrywen opt]# mount/home/Wentasy/software/rhel-server-6.1-x86_64-dvd.iso /iso -o loop

#拷贝iso下的所有文件到当前目录,a保证权限不变

[root@larrywen opt]# cp /iso/. ./ -arvf

第二步 制作ks.cfg文件(可以参考 kickstart一键自动安装Linux系统)

[plain]

#连接到虚拟机,制作ks.cfg文件(把MySQL的Web Server的包勾选上),注意安装源选择CDROM,/boot分区至少200M,Post-Installation Scripts这样写:

chkconfig httpd on;

chkconfig mysqld on;

[root@larrywen /]# ssh 192.168.1.11 -X

[email protected]′s password:

Last login: Tue Jul 30 16:49:31 2013 from192.168.1.1

[root@serv01 ~]# system-config-kickstart

第三步 拷贝和编辑文件

[plain]

#拷贝虚拟机下制作的ks.cfg文件到当前目录

[root@larrywen opt]# scp192.168.1.11:/root/ks.cfg .

#拷贝ks.cfg文件到isolinux目录下

[root@larrywen opt]# cp ks.cfgrhel6/isolinux/

#进入isolinux目录

[root@larrywen opt]# cd rhel6/isolinux/

[root@larrywen isolinux]# ll

total 40048

-r–r–r–. 1 root root 954 May 11 2011 isolinux.cfg

#编辑isolinux.cfg文件

[root@larrywen isolinux]# vim isolinux.cfg

#22行编辑成这样

[root@larrywen isolinux]# sed”22p” isolinux.cfg -n

append ks=cdrom:/isolinux/ks.cfg initrd=initrd.img

#拷贝iso.sh文件到当前目录

[root@larrywen opt]# cp/opt/soft/ule-sa2/iso.sh .

#编辑iso.sh文件,14行编辑成这样

[root@larrywen opt]# sed “14p”iso.sh -n

-o /opt/rhel6.iso /opt/rhel6

第四步 执行脚本

[plain]

#执行iso.sh脚本,自动生成镜像文件

[root@larrywen opt]# ./iso.sh

#如果出现以下信息表示操作成功

Total translation table size: 2048

Total rockridge attributes bytes: 403974

Total directory bytes: 622592

Path table size(bytes): 270

Done with: The File(s) Block(s) 1757479

Writing: Ending Padblock Start Block 1758031

Done with: Ending Padblock Block(s) 150

Max brk space used 3a1000

1758181 extents written (3433 MB)

#文件内容

[root@larrywen opt]# cat iso.sh

#!/bin/sh

#

# build CDlinux ISO p_w_picpath — zxh([email protected])

MKISO=`which genisop_w_picpath 2>/dev/null` ||MKISO=`which mkisofs 2>/dev/null` || {

echo “Sorry, you don’t have genisop_w_picpath or mkisofs installed.”

exit 1

}

$MKISO -v -R -J -joliet-long -ucs-level 3 -input-charset utf8 \

-publisher “up14″ -p “[email protected]” -V”rhel6.1_x86_64″ \

-c boot.cat -hide boot.cat -b isolinux/isolinux.bin \

-no-emul-boot -boot-load-size 4 -boot-info-table \

-o /opt/rhel6.iso /opt/rhel6

第五步 安装系统

[plain]

#新建虚拟机,配置的安装源选择刚才制作的镜像rhel6.iso

#出现安装界面后等待,大概60s,不需要其他任何操作,会自动跳到安装界面

#最后,我们以root用户登录,查看当前选择的包(MySQL & Web Server)对应的服务(mysqld & httpd)是否在运行,如果在,则证明刚才的安装后执行脚本执行成功

[root@localhost ~]# service httpd status

httpd (pid 1480) is running…

[root@localhost ~]# service mysqld status

mysqld (pid 1369) is running…

#还可以通过firefox验证http://192.168.1.12/ 可以看到一个测试页面注意把防火墙关闭


【转载自:www.iHk-system.com|寻访诸神的网站】


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