全部博文(3)
分类: LINUX
2011-03-15 15:04:04
花了一个下午时间做好
服务器配置
一、配置系统镜像
vim /etc/fstab
添加 /dev/hdc /mnt/cdrom iso9660 ro,sync 0 0
二、配置yum库
vim /etc/yum.repos.d/rhel-denbuginfo.repo
[rhel]
name=allen
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=0
三、配置dhcp服务
1、yum install dhcpd* -y
2、cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample /etc/dhcpd.conf
3、vim /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.3.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.3.100;
option subnet-mask 255.255.255.0;
option nis-domain "example.com";
option domain-name "example.com";
option domain-name-servers 192.168.3.100;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.3.100;
# option netbios-name-servers 192.168.3.100;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range 192.168.3.101 192.168.3.201;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.3.100;
filename "/pxelinux.0";
# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
四、安装配置tftp服务
1、yum install tftp* -y
2、vi /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot #TFTP 共享路径
disable = no #disable的直由yes变为no
per_source = 11
cps = 100 2
flags = IPv4
}
五、拷贝linux启动数据到tftpboot文件夹下
1、cp -rv /usr/lib/syslinux/pxelinux.0 /tftpboot/
2、cp -rv /mnt/cdrom/isolinux/* /tftpboot/
3、cp -rv /mnt/cdrom/images/pxeboot/vmlinuz /tftpboot/
4、cp -rv /mnt/cdrom/images/pxeboot/initrd.img /tftpboot/
5、mkdir /tftpboot/pxelinux.cfg
6、cp -rv /mnt/cdrom/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
7、vim /tftpboot/pxelinux.cfg/default
default linux
prompt 1
timeout 10
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append ks=nfs:192.168.3.100:/pxeks/ks.cfg initrd=initrd.img devfs=nomount ramdisk_size=16384
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 -
六、安装配置NFS服务
yum install nfs*
建立nfs共享 vim /etc/exports
/pxeks *(rw,sync) # ks.cfg文件存放地方
/mnt/cdrom *(ro,sync) # 安装源存放地方
七、生成ks.cfg文件
yum install system0-config-kickstat -y
system-config-kickstat
配置好后保存到/pxeks/ks.cfg,并修改此文件
#platform=x86, AMD64, 鎴?Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
graphical
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
key --skip
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.3.100 --dir=/mnt/cdrom
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$pTT26ohT$YBVyYFZMS1L4VeZppqNVC.
# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Chongqing
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=24 --resolution=800x600 --startxonboot
# Disk partitioning information
part swap --bytes-per-inode=4096 --fstype="swap" --size=2000
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=6000
part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
%packages
@server-cfg
@base
@development-libs
@gnome-desktop
@admin-tools
@development-tools
@system-tools
@smb-server
@chinese-support
@text-internet
@sound-and-video
@editors
@graphics
@java
@games
@base-x
@graphical-internet
@office
写在最后:
PXE+DHCP+Kickstart+NFS安装过程及原理
简单点就是:客户从网卡启动,服务器接到请求后,通过dhcp服务发送一个ip信息(dhcpd.conf里的数据)、同时通过tftp服务发送linux系统的启动数据包(tftpboot下的数据)给客户机,客记机得到启动数据后,读取default文件,并安照default文件里写的内容执行。default文件执行时,会调用ks.cfg。最后安照ks.cfg文件进行安装linux。
图解为:pxe-->ip+boot.ini--->dedault--->ks.cfg