原理和系统引导过程
BIOS=>引导介质=>用于安装环境的linux内核(vmlinuz)和驱动模块(initrd.img)=>安装
程序(anaonda)=>寻找安装介质=>安装配置=>重启=>进入系统
需要使用到的服务:
NFS:共享Install Tree ks.cfg
DHCP:连接服务器
TFTP:获得内核和启动文件
1.1.1 配置YUM
vim /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://172.24.40.1/pub/Server
enabled=1
gpgcheck=0
1.1.2 配置DHCP
yum install -y dhcp
vim /etc/dhcpd .conf
ddns-update-style interim;
ignore client-updates;
default-lease-time 21600;
max-lease-time 43200;
option domain-name "example.com";
option domain-name-servers 172.24.40.1;
subnet 172.24.40.0 netmask 255.255.255.0 {
range dynamic-bootp 172.24.40.100 172.24.40.200;
option routers 172.24.40.1;
option subnet-mask 255.255.255.0;
next-server 172.24.40.1;#指定TFTP服务器
filename "pxelinux.0";#指定bootloader文件名
}
service dhcpd start
1.1.3 安装TFTP
rpm -qa | grep tftp-server
rpm -qa | grep xinetd
cat /etc/services | grep tftp
netstat -anptlu | grep 69
vim /etc/xinetd.d/tftp
disable = no
service xinetd restart
1.1.4 配置TFTP需要共享的文件
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
mount /dev/cdrom /mnt
cd /mnt/isolinux
cp initrd.img vmlinuz /tftpboot #准备引导文件和内核文件
mkdir /tftpboot/pxelinux.cfg
cp isolinux.cfg /tftpboot/pxelinux.cfg/default #default文件默认存放位置
chomo 755 /tftpboot -R
vim /tftpboot/pxelinux.cfg/default #指定ks.cfg脚本位置
default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append initrd=initrd.img ks=nfs:172.24.40.1:/ks/ks.cfg
label text
kernel vmlinuz
append initrd=initrd.img text
label ks
kernel vmlinuz
append ks initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -
1.1.5 NFS共享
rpm -q nfs-utils
mkdir /ks
cp /root/anaconda-ks.cfg /ks/ks.cfg
chmod -R 755 /ks
vim /etc/exports
/mnt *(ro)
/ks *(ro)
service portmap restart
service nfs restart
1.16 使用kickstart生成ks.cfg
yum -y install system-config-kickstart
system-config-kickstart
vim /ks/ks.cfg
#platform=x86, AMD64, or Intel EM64T
text
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
zerombr
clearpart --drives sda --initlabel
key --skip
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang zh_CN
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=172.24.40.1 --dir=/mnt
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
reboot
#Root password
rootpw --iscrypted $1$tdmQzP9v$rwnQrNlqH6yNrGqb0kGjR/
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# Disk partitioning information
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=512
part / --bytes-per-inode=4096 --fstype="ext3" --size=10000
%packages
@base
@development-libs
@admin-tools
@development-tools
@chinese-support
@openfabrics-enterprise-distribution
@java-development
@system-tools
@text-internet
@ruby
@editors
@java
@office