kickstart,无人值守,自动安装系统。本文介绍kickstart的用法。
#安装系统的信息——可以参考 [root@larrywen pdf]# vim ~/anaconda-ks.cfg第一步 安装kickstart
[root@larrywen /]#yum installsystem-config-kickstart -y #退出,再以X Window的形式登录 [root@serv01 opt]# exit logout Connection to 192.168.1.11 closed. [root@larrywen Desktop]# ssh 192.168.1.11-X [root@larrywen Desktop]#system-config-kickstart
第二步 生成ks.cfg文件
第一项,基本配置。默认语言选择English(USA),键盘选择U.S.English,时区选择Africa/Chongqing,虚拟机下不建议勾选"Use UTC clock",设定root密码,如果我们不选择加密root密码,生成的文件中密码就以明文显示,高级配置中把目标架构选择x86, AMD64, or Intel EM64T,然后把"Rebootsystem after installation"。
第二项,安装方法。安装方法选择“Perfome new installation(新安装)",安装源选择NFS,NFS 服务器:192.168.1.11,NFS 目录:/iso
第三项,Boot Loader 选项。安装类型选择:安装新的boot loader,GRUB 忽略不写,这个是启动GRUB时使用的密码,如果没设置GRUB密码,进入单用户模式是可以的,但是设置了GRUB密码后,进入单用户模式必须输入GRUB密码。安装选项把"Install boot loader on Master Boot Record(MBR)"勾选该上,内核参数忽略。
第四项,Partition Information(分区信息)。Master Boot Record:Clear Master Boot Record(清除MBR)。Partitions:Remove allexisting partitions(移除所有存在的分区)。Disk label:Do not initialize the disk lable(不初始化卷标)。布局:测试用:我这样分区:/boot(200M) swap(1024M) /(其他的空间分配给根分区)。
第五项,Network Configuration(网络配置)。我们配置一个eth0,自动获取IP。
第六项,Authentication(验证)。保持默认即可。
第七项,Firewall Configuration(防火墙配置)。我们激活SELinux,启用防火墙,信任的服务把SSH勾选上。
第八项,Display Configuration(显示配置)。在图形化环境安装后,我们第一次启动时把配置的图形化界面禁用掉。
第九项,Package Selection(包的选择)。在语言包中把“Chinese Support(中文支持”勾选上。
第十项,Pre-Installation Script(安装前脚本)。这是在安装前执行的脚本,此处忽略。
第十一项,Post-Installation(安装后脚本)。这是安装后执行的脚本,此处我们添加两条命令,以做测试。
useradd oracle; echo "testoracle" | passwd--stdin oracle;
#查看配置的文件 [root@serv01 opt]# cat ks.cfg #platform=x86, AMD64, or Intel EM64T ##version=DEVEL ## Firewall configuration #firewall --enabled --ssh ## Install OS instead of upgrade #install ## Use NFS installation media #nfs --server=192.168.1.11 --dir=/iso ## Root password #rootpw --plaintext uplooking ## System authorization information #auth --useshadow --passalgo=sha512 ## Use graphical install #graphical #firstboot --disable ## System keyboard #keyboard us ## System language #lang en_US ## SELinux configuration #selinux --enforcing ## Installation logging level #logging --level=info ## Reboot after installation #reboot ## System timezone #timezone Asia/Chongqing ## 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=200 #part swap --fstype="swap"--size=1024 #part / --fstype="ext4" --grow--size=1 # #%post #useradd oracle; #echo "uplooking" | passwd--stdin oracle; #%end # #%packages #@chinese-support # #%end #
第三步 配置nfs
[root@serv01 opt]# vim /etc/exports [root@serv01 opt]# cat /etc/exports /iso *(ro) /opt *(ro) #安装nfs相关的RPM包 [root@serv01 opt]# yum install nfs* -y Installed: nfs-utils.x86_64 1:1.2.3-7.el6 nfs-utils-lib.x86_64 0:1.1.5-3.el6 nfs4-acl-tools.x86_64 0:0.3.3-5.el
# mount /wolfback
Replaying log for /dev/wolfbacklv.
mount: 0506-324 Cannot mount /dev/wolfbacklv on /wolfback: The media is not formatted or the format is not correct.
0506-342 The superblock on /dev/wolfbacklv is dirty. Run a full fsck to fix.
# fsck -p /wolfback
The current volume is: /dev/wolfbacklv
Primary superblock is valid.
J2_LOGREDO:log redo processing for /dev/wolfbacklv
Primary superblock is valid.
*** Phase 1 - Initial inode scan
*** Phase 2 - Process remaining directories
*** Phase 3 - Process remaining files
*** Phase 4 - Check and repair inode allocation map
*** Phase 5 - Check and repair block allocation map
File system is clean.
Superblock is marked dirty (FIXED)
All observed inconsistencies have been repaired.
# mount /wolfback
# ls
.TTauthority Host-1_0 backzc interfaces studio_version.txt
.Xauthority Installer backzc.sql jConnect-4_5 sybcent32
.dt Installer.log charsets jConnect-5_5 textsvr.cfg
.dtprofile OCS-12_5 collate jutils-2_0 updata1.sql
.flexlmrc RPL-12_5 config locales update
.profile SYBASE.cfg cwlog12.dat lost+found update.sql
.sh_history SYBASE.csh cwstart nohup.out update_cwbase20.sh
.vi_history SYBASE.env cwstop shared-1_0 update_cwbase20.sql
.wmrc SYBASE.sh cwstop.sql smit.log update_cwbase20_nohup.sh
ASE-12_5 SYBASEZC.cfg docs smit.script zcstart
ASEP-1_0 SYSAM-1_0 docs-45_55 smit.transaction zcstop
CFG-1_0 TT_DB dsmerror.log startdb
CFG89163.bag backcw installed stopdb
EFTS-12_5 backcw.sql interf.old stopdb.sql
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 5.00 4.89 3% 5734 1% /
/dev/hd2 10.00 8.04 20% 44189 3% /usr
/dev/hd9var 30.00 26.36 13% 9219 1% /var
/dev/hd3 10.00 9.78 3% 273 1% /tmp
/dev/hd1 5.00 5.00 1% 5 1% /home
/proc - - - - - /proc
/dev/hd10opt 10.00 6.40 36% 15167 2% /opt
/dev/lv00 0.25 0.24 4% 18 1% /var/adm/csd
/dev/tsmfslv 20.00 20.00 1% 10 1% /tsmfs
/dev/datalv 625.00 100.13 84% 70 1% /data
/dev/sybaselv 19.00 14.60 24% 6480 1% /sybase
/dev/wolfbacklv 1590.00 68.79 96% 170 1% /wolfback
# cd wolfback
ksh: wolfback: not found.
# ls
.TTauthority Host-1_0 backzc interfaces studio_version.txt
.Xauthority Installer backzc.sql jCo
$BASH