有时候并不需要部署那么多的服务器,只是几台而已,但是又没有Kickstart全自动的环境,又不想到每一台上在那点下一步下一步,就可以用半自动咯。
这里不做过多说明,ks.cfg文件是必不可少的:
- #platform=x86, AMD64, 或 Intel EM64T
- #version=DEVEL
- # Firewall configuration
- #firewall --enabled
- firewall --disabled
- # Install OS instead of upgrade
- install
- # Use network installation
- url --url="http://192.168.1.39/pub/rhel/6.3/i386/"
- # Root password
- rootpw --iscrypted $1$p2FwPn7z$Fq7pmzmu4WUvbOQz06Gif1
- # System authorization information
- auth --useshadow --passalgo=sha512
- # Use text mode install
- text
- # System keyboard
- keyboard us
- # System language
- lang en_US
- # SELinux configuration
- #selinux --enforcing
- selinux --disabled
- # Do not configure the X Window System
- skipx
- # Installation logging level
- logging --level=info
- # Reboot after installation
- reboot
- # System timezone
- timezone Asia/Shanghai
- # Network information
- network --bootproto=static --device=eth0 --gateway=192.168.1.1 --ip=192.168.1.175 --nameserver=8.8.8.8 --netmask=255.255.255.0 --onboot=on
- # System bootloader configuration
- bootloader --location=mbr
- # Clear the Master Boot Record
- zerombr
- # Partition clearing information
- clearpart --all
- # Disk partitioning information
- part /boot --asprimary --fstype=ext4 --size=200
- part pv.01 --size=10240
- volgroup vg01 --pesize=4096 pv.01
- logvol swap --name=lv_swap --vgname=vg01 --size=512
- logvol / --fstype=ext4 --name=lv_root --vgname=vg01 --grow --size=1
- %post
- #!/bin/bash
- # Post_install Script For RHEL 6
- rm -rf /etc/yum.repo/*
- cat >/etc/yum.repo/rhel6.repo<< EOF
- [base]
- name= RedHat Enterprise Linux 6.3 x86 - DVD Mirror
- baseurl=file:///media/cdrom
- enabled=1
- gpgcheck=0
- EOF
- mkdir /media/cdrom
- mount /dev/cdrom /media/cdrom
- yum -y remove rhnlib yum-rhn-plugin rhn-client-tools rhn-setup rhn-check rhnsd subscription-manager
- echo "set nu" >> /etc/vimrc
- echo "set nu" >> /etc/virc
- ## Disables IPv6
- echo "install ipv6 /bin/true" > /etc/modprobe.d/ipv6.disable.conf
- echo "IPV6INIT=no" >> /etc/sysconfig/network
- ## Disables services
- all_services=(`chkconfig --list | grep 3:on | awk '{print $1}' | grep -Ev "network|sshd"`)
- for i in ${all_services[*]}
- do
- #service $i stop
- chkconfig --level 345 $i off
- done
- echo "/usr/bin/setterm -blank 0" >> /etc/rc.local
- cat >> /etc/bashrc << EOF
- export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
- export HISTFILESIEZE=100000
- export HISTSIZE=10000
- EOF
- source /etc/bashrc
- history -c
- echo "" > ~/.bash_history
- exit
- %end
- %packages
- @base
- %end
分区是使用的LVM,针对以后的应用可能方便点,root密码是123456。上面的脚本也加入了一些优化参数在安装后脚本里,可以针对实际情况就行修改。
简单说下怎么实现半自动,起码都的一台http服务器,有个yum源吧,保证网络畅通。那光盘启动,菜单界面按Tab键,加入ks文件的路径:
使用“ks=”写具体路径就行了,可以是ftp或者http,建议http,因为部署容易些。敲回车后就自动安装了,不用去管下一步下一步了。如果没有DHCP可能以开始要首先指定下IP地址。
另外还有一个问题,实体服务器一般至少会有两个以上的网卡(现在一般都4个了),在全自动部署rhel6的时候,就会弹出一下界面进行网卡选择
必须选择网卡才能进行下面的自动安装,这是RHEL5里没有这一步。解决方法并没在ks.cfg里
看上图,解决方法在指定ks路径的时候加上"ksdevice=eth0",指定为你对应的网卡就行。当然在全自动部署的环境里,就要在default文件里在“ks=...”的后面加上ksdevice指定设备去才能实现在生产环境中实体服务器的真正的全自动部署!
转载于:https://blog.51cto.com/luxiaok/1189028