RHEL6半自动网络安装


操作系统:RHEL6

有时候并不需要部署那么多的服务器,只是几台而已,但是又没有Kickstart全自动的环境,又不想到每一台上在那点下一步下一步,就可以用半自动咯。
 
这里不做过多说明,ks.cfg文件是必不可少的:

#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Firewall configuration
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 --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
 
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
-Red_Hat_Enterprise_Linux-Release_Notes-6-en-US
 
%end

RHEL6自动应答文件下载:

免费下载地址在 http://linux.bkjia.com/

用户名与密码都是www.bkjia.com

具体下载目录在 /2013年资料/4月/28日/RHEL6半自动网络安装

分区是使用的LVM,针对以后的应用可能方便点,root密码是123456。上面的脚本也加入了一些优化参数在安装后脚本里,可以针对实际情况就行修改。

简单说下怎么实现半自动,起码都的一台http服务器,有个yum源吧,保证网络畅通。那光盘启动,菜单界面按Tab键,加入ks文件的路径:

使用“ks=”写具体路径就行了,可以是ftp或者http,建议http,因为部署容易些。敲回车后就自动安装了,不用去管下一步下一步了。如果没有DHCP可能以开始要首先指定下IP地址。

相关内容