- 论坛徽章:
- 0
|
参考了许多文档,有官方的,也有他人的安装文档,同时也有自己的安装心得。本文没有太多的理论介绍,所以想了解其中各种原理可以Google相关资料。
介绍了http和NFS两种网络安装方式,配置文件中的区别主要有两处,下文都有提到。本人实验时为HTTP方式。
本人测试环境:RHEL5U2
步骤:
1. 安装http服务:
我安装的是RHEL5U2自带apache rpm安装包。httpd服务安装后,假设web根目录为WEB_HOME=/var/www/html,我的RHEL5U2放在/databackup/rhel5u2,可以创建一个链接文件到web根目录里:
ln -s /databackup/rhel5u2 $WEB_HOME/
如果能在浏览器里浏览到rhel5u2的目录,即在浏览器里输入http://192.168.3.252/rhel5u2能列出安装文件树,接着:
2. 创建kickstart配置文件:
可以使用system-config-kickstart创建一个配置文件,另外可以使用/root/anaconda-ks.cfg作为原始文件,再根据你的需求加以修改。
# vi $WEB_HOME/ks5u2.cfg
以下为一个ks文件的范本,可根据自己需求定制。关键是要弄清楚每个命令的作用。对于每个命令的作用可参考redhat官方文档:
http://www.redhat.com/docs/manua ... ced-deployment.html
# Kickstart file automatically generated by anaconda.
install
url --url http://192.168.3.252/rhel5u2
#nfs --server=192.168.3.252 --dir=/databackup/rhel5u2
key --skip
#key <your_install_number>
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 zh_CN.UTF-8 en_US.UTF-8
keyboard us
rootpw --iscrypted $1$KkOV/KBQ$.MjH2HBd6kxGPxa6ebng20
firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
timezone Asia/Shanghai
reboot
text
#network --bootproto=dhcp --device=eth0
#network --device=eth0 --bootproto=static --ip=192.168.3.29 --netmask=255.255.255.0 --gateway=192.168.3.1 \
--nameserver=202.96.209.5 --hostname=test06
bootloader --location=mbr
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux
part /boot --fstype ext3 --size=100
part / --fstype ext3 --size=15000
part /databackup --fstype ext3 --size=10240
part swap --size=1024
%packages
@mysql
@development-libs
@development-tools
@editors
@system-tools
@text-internet
@core
@base
@legacy-software-support
@base-x
@chinese-support
@web-server
@server-cfg
@admin-tools
@graphical-internet
emacs
sysstat
iptraf
lynx
mesa-libGLU-devel
device-mapper-multipath
gtk+
xorg-x11-utils
xorg-x11-server-Xvfb
system-config-kickstart
imake
-bluez-hcidump
-zsh
-ksh
-words
-apmd
-fbset
-finger
-mlocate
-dhcpv6-client
-mozldap
-rsh
-zsh
-sysreport
-rp-pppoe
-unix2dos
-svrcore
-amtu
-nc
-bluez-utils
-bluez-gnome
-nss_ldap
-krb5-workstation
-stunnel
-dosfstools
-pcmciautils
-pam_ccreds
-pam_smb
-mtools
-microcode_ctl
-mlocate
-mdadm
-talk
-system-config-httpd
-sabayon
-system-config-lvm
-setroubleshoot
-system-config-netboot
-system-config-kdump
-system-config-rootpassword
-sendmail
-symlinks
-vnc
-xdelta
-openldap-clients
-ypbind
-eject
-setarch
-nc
-irda-utils
-tux
-webalize
-squid
%post
echo 12345678 | passwd root --stdin
useradd nianzong
echo 12345678 | passwd test01 --stdin
chkconfig --level 345 sshd on
for i in autofs bluetooth cups firstboot ip6tables iptables rhnsd xfs yum-updatesd sendmail \
atd portmap pcmcia irqbalance ; do chkconfig $i off ; done
##To see more info about kickstart option:
#http://www.redhat.com/docs/manua ... ced-deployment.html
#上面这个配置可以实现双系统安装,即如果你的硬盘原有一个系统如Windows2003,并且有足够的未分配空间,
#这个例子可以自动将Linux系统安装在未分配空间里;如果是新硬盘或者你不想硬盘保留有其他系统,启用
#clearpart --all命令即可。两种安装方式我都测试通过。
到这里如果没什么意外的话,则可以实现半自动安装了。你可以使用一张RHEL5安装光盘进入引导画面后,输入:
linux ks=http://192.168.3.252/ks5u2.cfg
如果你安装的发行版自带的驱动能够找到你的网卡,接下来就能自动安装系统了,如果认不到你的网卡,那这种方式就行不通了,呵呵。所以谓之曰
半自动,因为前提是要能够支持你的网卡驱动。要想实现全自动安装,还得继续配置DHCP,PEX,TFTP.
3. DHCP:
# rpm -qa|grep dhcp
dhcp-3.0.5-13.el5
#To enable dhcp daemon after system start.
# chkconfig --level 345 dhcpd on
把客户端机器的MAC地址写入下列配置文件里,我的是vmware虚拟机作为客户端,开机可以按F12从
网络启动:
Here is my dhcpd.conf:
# cat /etc/dhcpd.conf
#---------------------------------/etc/dhcpd.conf------------------------------------#
ddns-update-style interim;
ignore client-updates;
deny unknown-clients;
#not authoritative;
subnet 192.168.3.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.3.1;
option subnet-mask 255.255.255.0;
option ip-forwarding false; # No IP forwarding
# -- option mask-supplier false; # Don't respond to ICMP Mask req
option domain-name-servers 192.168.3.1;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.3.24 192.168.3.26;
default-lease-time 21600;
max-lease-time 43200;
group {
next-server 192.168.3.252; # name of your TFTP server
filename "pxelinux.0"; # name of the bootloader program
host node1 {
hardware ethernet 00:0C:29:54:89:79;
fixed-address 192.168.3.25;
}
host node2 {
hardware ethernet 00:0C:29:54:89:80;
fixed-address 192.168.3.26;
}
}
}
#---------------------------------/etc/dhcpd.conf------------------------------------#
4. TFTP:
[root@localhost ~]# rpm -qa|grep tftp
tftp-server-0.42-3.1
# chkconfig --level 345 tftp on
# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
# cp /databackup/rhel5u2/images/pxeboot/initrd.img /tftpboot/initrd-as5u2.img
# cp /databackup/rhel5u2/images/pxeboot/vmlinuz /tftpboot/vmlinuz-as5u2
# mkdir /tftpboot/pxelinux.cfg
# cp /databackup/rhel5u2/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
# cp /databackup/rhel5u2/isolinux/*.msg /tftpboot/
The TFTP server directory /tftpboot should look like this:
[root@localhost tftpboot]# ls -p
boot.msg initrd-as5u2.img param.msg pxelinux.cfg/ snake.msg
general.msg options.msg pxelinux.0 rescue.msg vmlinuz-as5u2
[root@localhost tftpboot]# ls -p pxelinux.cfg/
default
5. PEXlinux:
PXE can load a program into the client's memory and start it. I found it the easiest to manage,
if I first load a bootloader into the clients. The bootloader then loads its configuration file
via TFTP from the next-server(tftpsrv in the dhcpd.conf file example above).
The bootloader configuration file determines whether a client boots from its local hard disk
or over the network.
Here are example configuration files for my case:
default local
prompt 1
timeout 30
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
label text
kernel vmlinuz
append initrd=initrd.img text
label ks
kernel vmlinuz
append ks initrd=initrd.img
label local
localboot 0
label memtest86
kernel memtest
append -
label netinstall
kernel vmlinuz-as5u2
append ks=http://192.168.3.252/ks5u2.cfg initrd=initrd-as5u2.img
NFS方式安装则为:
ks=nfs:192.168.3.252:/var/www/html/ks5u2.cfg
修改/tftp/boot.msg:
注意cat和vi的显示是不一样的,vi编辑的时候不要去修改那些特殊的字符,添加行时复制即可。
##---------------/tftpboot/boot.msg-------------------------------------------------#
splash.lss
- To boot from local, press the 01<ENTER>07 key.
- To install or upgrade in graphical mode, press the 01linux <ENTER>07 key.
- To install or upgrade in text mode, type: 01linux text <ENTER>07.
- To install RHEL AS5U2 automaticaly from network , type: 01netinstall <ENTER>07.
- Use the function keys listed below for more information.
0f[F1-Main] [F2-Options] [F3-General] [F4-Kernel] [F5-Rescue]07
##---------------/tftpboot/boot.msg--------------------------------------------------#
kickstart参考文档:
http://www.redhat.com/docs/manua ... ced-deployment.html
能申请加个精华么,呵呵。
[ 本帖最后由 nianzong 于 2009-7-7 17:23 编辑 ] |
|