http://10.1.1.35/ule_exec/exec02_kickstart/exec02_kickstart.txt

--

kickstart

基于pxe(preboot execute environment)技术
pxe是intel公司的技术,工作server/client的网络模式,支持客户端从服务端下载软件,再使用tftp(trival file tranfer protocol) 协议下载一个启动软件包到客户端内存中执行。



要求的技术和服务:

dhcp服务器
tftp服务器
nfs服务器或者用http,ftp (安装光盘目录文件)
kickstart程序生成的ks.cfg配置文件(此文件就定义了安装系统如何分区,如何格式化,root密码等等)


客户端要求有支持pxe的网卡



--我们这里用物理机做服务器,虚拟机做客户端,并使用host-only网络,防止都在同一个网络造成dhcp获取混乱




-------------------------------------------------------------------

1,搭建安装源 (光盘目录文件)

[root@li ~]# mount /share/iso/rhel-5.4-server-i386-dvd.iso /mnt/ -o loop

[root@li ~]# cp /mnt/* /yum/ -rf --这里我把光盘文件拷贝到/yum目录,用哪个目录自己定义

[root@li ~]# vim /etc/exports
/yum *(ro) --加上这句把光盘文件共享

重启服务使之生效
[root@li ~]# /etc/init.d/portmap restart
[root@li ~]# /etc/init.d/nfs restart
或者
[root@li ~]# exportfs -arv

----------------

2,配置tftp服务器

[root@li ~]# vim /etc/xinetd.d/tftp

service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -t -s -v /tftpboot --启动参数改为-t -s -v
disable = no --yes改为no,表示服务能用
per_source = 11
cps = 100 2
flags = IPv4
}


[root@li ~]# /etc/init.d/xinetd restart

----------------

3,配置pxe启动文件
[root@li ~]# yum install syslinux -y

[root@li ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/

[root@li ~]# cp /yum/isolinux/* /tftpboot/

[root@li ~]# mkdir /tftpboot/pxelinux.cfg

[root@li ~]# cp /yum/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

[root@li ~]# vim /tftpboot/pxelinux.cfg/default --修改这个配置文件,加上下面的三行

label linuxli --label后面是无人值守安装的一个安装名称,自定义
kernel vmlinuz
append initrd=initrd.img ks=nfs:192.168.116.1:/yum/ks/ks.cfg --我们这里是用的nfs服务,所以定义ks文件的路径后面要写nfs:,这里的IP地址是服务器的IP地址,因为我这里用虚拟机的vmnet1安装,所以写的是物理机的vmnet1的IP。 最后写的是ks文件的路径

[root@li ~]# mkdir /yum/ks

------------------

4,搭建DHCP服务器

[root@li ~]# yum install dhcp -y

[root@li ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
--拷贝模版配置文件

[root@li ~]# vim /etc/dhcpd.conf --vim修改配置文件

ddns-update-style interim;
ignore client-updates;

--下面这四行是手动加的
next-server 192.168.116.1; --指定tftp服务IP
filename "/tftpboot/pxelinux.0"; --指定pxe文件
allow bootp;
allow booting;



subnet 192.168.116.0 netmask 255.255.255.0 { --网段改为自己分配的网段

# --- default gateway
option routers 192.168.116.1; --客户端通过dhcp获取的网关
option subnet-mask 255.255.255.0;

option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 192.168.116.1; --客户端通过dhcp获取的dns的指向

option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.116.2 192.168.116.254; --分配的IP段改为自己的网段内
default-lease-time 21600;
max-lease-time 43200;

# 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;
}
}

[root@li ~]# /etc/init.d/dhcpd restart

-----------------

5,配置kickstart

可以去参考一下/root/anaconda-ks.cfg



[root@li ~]# yum install system-config-kickstart --安装kickstart的图形配置工具

图形安装方法见截图

在第9步,会看不到软件包,那是因为yum程序由python程序所写,本身做了限制,要去修改你的yum的配置文件,把server软件包的那个组的名称不要写成server,改成base

[root@li ~]# vim /etc/yum.repos.d/local.repo

[base] --这里改为base,就可以在system-config-kickstart图形看到图形软件包列表了
name=server
baseurl=file:///yum/Server
enabled=1
gpgcheck=0


最后把配置完的信息保存到/yum/ks/ks.cfg,与前面的对应


[root@li ~]# vim /yum/ks/ks.cfg


#platform=x86, AMD64, 或 Intel EM64T
# System authorization information
auth --useshadow --enablemd5
key --skip --多加这一句,表示跳过安装时输入序列号
# System bootloader configuration
bootloader --append="rhgb quiet" --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.116.1 --dir=/yum
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$OSweU0dP$G44pQjHMuHcdhc8U5YAsQ1

# SELinux configuration
selinux --disabled
# System timezone
timezone America/New_York
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=16 --resolution=800x600 --startxonboot
# Disk partitioning information
part /boot --asprimary --bytes-per-inode=4096 --fstype="ext3" --size=100
part / --asprimary --bytes-per-inode=4096 --fstype="ext3" --size=10000
part swap --bytes-per-inode=4096 --fstype="swap" --size=1024

%packages
@x-software-development
@development-libs
@development-tools
@gnome-desktop
@system-tools
@mysql
@legacy-software-development
@gnome-software-development
@graphical-internet
@java
@dns-server
@base-x
@office
@chinese-support
@legacy-software-support
@java-development
@mail-server
@editors
@ftp-server



6,用虚拟机安装


创建一个虚拟机,
注意:
1,磁盘大小不要小于ks.cfg文件里定义的分区总大小
2,网卡要选对连接网络(我前面都是用vmnet1做的,所以这里把网卡选成vmnet1


-----------------------------------

实验过程中错误总结:

一,报磁盘空间不足的错
1,虚拟机分配的磁盘大小可能小于ks.cfg定的分区总大小
2,df -h查看一下安装虚拟机路径的物理空间是否足够
3,虚拟机如果scsi硬盘,注意要使用LSI logcial ,不要使用buslogic

二,安装时tftp time out
1,验证tftp的安装步骤
2,可能dhcpd.conf里手动增加的四句话写错
3,IP段写错

三,安装后可能没有图形显示:
1,图形包没有安装完全,gnome图形需要同时安装gnome桌面环境和x windows这两个软件包组才行




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值