无人值守网络安装LINUX操作系统
准备:
1、禁用防火墙、禁用SElinux、配置IP参数,
2、需要YUM环境
3、安装vsftp 启动服务
一、准备RHEL6安装源
[[email protected] ~]# mkdir /var/ftp/rhel6
[[email protected] ~]# mount /dev/cdrom /var/ftp/rhel6
[[email protected] ~]# service vsftpd start
二、安装启动TFPT服务器
[[email protected] ~]# yum -y install tftp-server
[[email protected] ~]# vim /etc/xinetd.d/tftp
Disable = no
[[email protected] ~]# service xinetd start
三、准备LINUX内核、初始化镜像文件
[[email protected] ~]# cd /var/ftp/rhel6/images/pxeboot/
[[email protected] pxeboot]# cp vmlinuz initrd.img /var/lib/tftpboot/
四、准备PXE引导程序、启动菜单
[[email protected] pxeboot]# yum -y install syslinux
[[email protected] pxeboot]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[[email protected] ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[[email protected] ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
default auto
prompt 0
label auto
kernel vmlinuz
append ks=ftp://172.16.1.111/rhel6/ks.cfg initrd=initrd.img devfs=nomount ramdisk_size=8192
label linux text
kernel vmlinuz
append text initrd=initrd.img devfs=nomount ramdisk_size=8192
label linux rescue
kernel vmlinuz
append rescue initrd=initrd.img devfs=nomount ramdisk_size=8192
五、安装并启动DHCP服务
[[email protected] ~]# yum -y install dhcp
[[email protected] ~]# vim /etc/dhcp/dhcpd.conf
subnet 172.16.0.0 netmask 255.255.0.0 {
range 172.16.1.100 172.16.1.200;
option domain-name-servers 172.16.1.111;
option domain-name "benet.com";
option routers 172.16.1.1;
next-server 172.16.1.111;
filename "pxelinux.0";
filename "pxelinux.0";
}
[[email protected] ~]# service dhcpd restart
无人值守安装LINUX
一、配置安装应答参数
[[email protected] ~]# yum -y install system-config-kickstart
[[email protected] ~]# system-config-kickstart
B.复制并验证应答文件ks.cfg
[[email protected] ~]# cp /root/ks.cfg /var/ftp/ks.cfg
[[email protected] ~]# cat ks.cfg
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="ftp://172.16.1.111/rhel6"
# Root password
rootpw --iscrypted $1$7bDwiVJh$DfaDH1d/Yxw5ivOfYO5Q31
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang zh_CN
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# 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=1024
part /home --fstype="ext4" --size=10240
part swap --fstype="swap" --size=4096
part / --fstype="ext4" --grow --size=1
%post --interpreter=/bin/bash
rm -f /etc/yum.repos.d/*
echo echo ‘[base]
name=Red Hat Enterprise Linux
baseurl=ftp://172.16.1.111/rhel6
enabled=1
gpgcheck=1
gpgkey=file://etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release‘ > /etc/yum.repos.d/rhel6.repo
%end
%packages
@additional-devel
@basic-desktop
@chinese-support
@compat-libraries
@debugging
@desktop-debugging
@desktop-platform
@desktop-platform-devel
@development
@eclipse
@emacs
@fonts
@general-desktop
@graphical-admin-tools
@graphics
@hardware-monitoring
@input-methods
@internet-browser
@java-platform
@large-systems
@legacy-unix
@legacy-x
@network-file-system-client
@network-tools
@performance
@perl-runtime
@php
@remote-desktop-clients
@ruby-runtime
@scientific
@security-tools
@storage-client-multipath
@system-admin-tools
@system-management
@system-management-snmp
@technical-writing
@tex
@virtualization
@virtualization-client
@virtualization-platform
@virtualization-tools
@web-server
@web-servlet
@x11
compat-openmpi
compat-openmpi-psm
crypto-utils
hmaccalc
%end
C.测试结果
新建虚拟机无需设置BIOS从Network boot启动,将客户端的IP均设置为DHCP(自动获取方式),即可。