分类: LINUX
2011-05-02 23:47:03
PEX+DHCP+NFS(FTP、HTTP)+kickstart实现linux RedHat无人值守安装
一、服务器环境基础:
服务器IP:192.168.1.103 255.255.255.0
1、 把RedHat光盘的内容拷到/var/ftp/文件夹下。
cp -R /media/RHEL_* /var/ftp/
cd /var/ftp mv RHEL_* rhel5
2、 cd /etc/yum.repos.d cp rhel-debuginfo.repo server.repo
vim server.repo
[rhel-server]
name=RedHat Linux
baseurl=file:///var/ftp/rhel5/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
3、通过yum -y install的方式安装以下rpm软件包:
dhcp-*
nfs-utils-* nts-utils-lib-* portmap-*
tftp-server-* tftp-* xinetd-*
system-config-kickstart-*
二、服务器环境搭建:
1、DHCP服务器:
cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
vim /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.100 192.168.1.200;
option subnet-mask 255.255.255.0;
filename "/pxelinux.0";
next-server 192.168.1.103;
}
service dhcpd start
2、NFS服务器:
vim /etc/exports
/var/ftp/rhel5 *(ro)
/var/ftp *(ro)
service portmap start
service nfs start
3、TFTP服务器:
vim /etc/xinetd.d/tftp
......
server_args = -s /tftpboot
disable = no
......
【启动客户端提示:TFTP time out 因为忘了配置这个tftp文件了;或可能是双网卡的问题】
chkconfig tftp on
chkconfig vsftpd off
service xinetd start
4、配置pxe服务模块
cp /tftpboot/linux-install/pxelinux.0 /tftpboot/
cp -R /tftpboot/linux-install/pxelinux.cfg /tftpboot
cp /var/ftp/rhel5/isolinux/initrd.img /tftpboot
cp /var/ftp/rhel5/isolinux/vmlinuz /tftpboot
cp /var/ftp/rhel5/isolinux/isolinux.cfg /tftpboot/pexlinux.cfg/
cd /tftpboot/pexlinux.cfg/ mv isolinux.cfg default
vim /tftpboot/pexlinux.cfg/default
default linux
prompt 1
timeout 200
label linux
kernel vmlinuz
append initrd=initrd.img ks=nfs:192.168.1.103:/var/ftp/ks.cfg
5、]# system-config-kickstart
运行此命令,打开kickstart的界面,进行相应的配置后保存到 /var/ftp/文件夹中。
【若出现以下错误“打开kickstart文件图形化配置界面失败界面一闪而过然后出现以下提示:......yum.Errors.RepoError: Cannot find a valid baseurl for repo: addons”
,是因为你的yum配置文件有问题】
kf.cfg的配置参考如下:
#platform=x86, AMD64, 或 Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# 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 zh_CN
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.1.103 --dir=/var/ftp/rhel5/
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$oOqwJcuN$2bPcxHFmuqBW9Aj34dhSs0
# SELinux configuration
selinux --disabled
# System timezone
timezone --isUtc Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=32 --resolution=1024x768 --startxonboot
# Disk partitioning information
part / --bytes-per-inode=4096 --fstype="ext3" --size=6000
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=1024
%packages
@base
@gnome-desktop
@development-libs
@base-x
@admin-tools
@legacy-software-development
@development-tools
@chinese-support
@gnome-software-development
@x-software-development
@legacy-software-support
@system-tools
@editors
@text-internet
@graphics
@graphical-internet
6、 关闭SElinux和防火墙:
setup打开窗口或执行以下命令:
setenforce 0
iptables -F service iptables save
重新启动DHCP、NFS、TFTP服务器:
service dhcpd restart
service portmap restart
service nfs restart
service xinetd restart
至此,无人值守服务器安装配置完毕。
客户端配置:
1、实体机: 进入BIOS,设置计算机网络引导启动。
2、虚拟机:“网络连接”选择“桥接”方式。