五 ks.cfg文件内容
- #platform=x86, AMD64, or Intel EM64T
- # System authorization information
- auth --useshadow --enablemd5
- # System bootloader configuration
- bootloader --location=mbr --driveorder=sda,sdb 设置系统启动顺序先从sda启动
- # Partition clearing information
- clearpart --drives=sda --all --initlabel 只格式化sda
- # Use text mode install
- text 采用文本模式安装
- # Firewall configuration
- firewall --enabled --ssh
- # Run the Setup Agent on first boot
- firstboot --disable
- # System keyboard
- keyboard us
- # System language
- lang en_US
- # Installation logging level
- logging --level=info
- # Use HTTP installation media
- url --url http://10.1.14.153/mirror/CentOS56_amd64_part1/ 采用网络安装
- # Network information 设置静态IP地址,以方便连接到WEB服务器
- #####################################################################################
- #####################################################################################
- network --bootproto=static --device=eth0 --gateway=10.1.14.1 --ip=10.1.14.228 --nameserver=10.1.20.10 --netmask=255.255.255.0 --onboot=on
- #####################################################################################
- #####################################################################################
- # Reboot after installation
- reboot
- #Root password
- rootpw --iscrypted $1$QQBcvMTx$PDw5du8L0ikM60Esprmo50
- # SELinux configuration
- selinux --enforcing
- # Do not configure the X Window System
- skipx
- # System timezone
- timezone --isUtc Asia/Shanghai
- # Install OS instead of upgrade
- install
- # Disk partitioning information 分区要特别注意,这里采用在一块硬盘上自定义分区
- part / --bytes-per-inode=4096 --fstype="ext3" --size=50000 --ondisk=sda
- part swap --bytes-per-inode=4096 --fstype="swap" --recommended --ondisk=sda
- part /usr --bytes-per-inode=4096 --fstype="ext3" --size=20000 --ondisk=sda
- part /var --bytes-per-inode=4096 --fstype="ext3" --grow --size=1 --ondisk=sda
- %packages 安装必要的软件包
- @base
- @core
- kvm
- wget
- dnsmasq
- tunctl
- tcp_wrappers
- expect
- pexpect
- %post 执行后安装脚本,需要安装完后执行哪些操作。
- cd /etc/yum.repos.d/
- rm -f *.repo
- echo "Downloading CentOS.repo ..............."
- wget http://10.1.14.153/mirror/ks/CentOS.repo 自己搭建的yum源文件
- rpm -Uvh http://10.1.14.153/mirror/software/socat-1.6.0.1-1.el5.rf.x86_64.rpm
- cd /home socat必须单独下载,centos的yum源里没有socat
- echo "Downloading ISO image ......"
- wget http://10.1.14.153/mirror/software/win2003auto.iso 要安装的windows2003镜像,convirt支持从本地读取iso安装虚拟机
- echo "Downloading convirture-tool ............" 下载并解压convirt-tools
- wget http://10.1.14.153/mirror/software/convirture-tools.tar.gz
- echo "Installing convirture-tool ..................."
- tar -zxvf convirture-tools.tar.gz
- cd /root
- wget http://10.1.14.153/mirror/ks/convirt-tool-install.sh
- sh convirt-tool-install.sh
- convirt-tool-install里的内容上就是
- cd /home/convirture-tools/install/managed_server/scripts
./convirt-tool setup- 因为在后安装脚本执行时总是不能执行./convirt-tool setup所以就只有安装完重启后单独执行操作
1,本文是只有一块硬盘,并对一块硬盘进行分区。若安装时有多块硬盘,或要做软RAID,LVM等磁盘格式请按照红帽官方文档介绍进行分区,并且用U盘安装的过程中要确定好U盘得盘符。
2.网络问题,设置正确的IP地址,以使安装过程中能够访问到WEB服务器。
3.post-installation脚本是很头疼的一件事。如果用不好就不要用,里面的脚本只要有一处错误,安装过程就会卡住,影响安装进度。而且执行脚本时会出现莫名奇妙的问题,在本文中可以将后安装脚本放到安装完成以后再执行。在本文中,post-installation里始终不能执行./convirt-tool setup。刚开始以为是执行权限或是chroot的问题,但是还是不行。
4.本文写的不是最终方案。只作参考。
希望能够帮助到更多的人顺利部署111111111111111111111111
