Linux kickstart无人值守安装RHEL5.5(转)

一、         安装ftp

 [root@ocmrac1 Server]# rpm -ivh ftp-0.17-35.el5.i386.rpm

[root@ocmrac1 Server]# service vsftpd start

二、         挂载RHEL5.5DVD光盘,并复制光盘中的所有内容到 /var/ftp/pub

[root@ocmrac1 pxelinux.cfg]# mount /dev/cdrom /mnt

[root@ocmrac1 pxelinux.cfg]# cp -rf /mnt/* /var/ftp/pub

三,安装tfpt-server,并启用tftp服务,重启xinetd进程。

[root@ocmrac1 Server]# rpm -ivh tftp-server-0.49-2.i386.rpm

[root@ocmrac1 Server]# 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

{

        disable = no   #yes改为no

        socket_type             = dgram

        protocol                = udp

        wait                    = yes

        user                    = root

        server                  = /usr/sbin/in.tftpd

        server_args             = -s /tftpboot

        per_source              = 11

        cps                     = 100 2

        flags                   = IPv4

}

~

[root@ocmrac1 Server]# service xinetd restart

四、配置支持PXE启动

RHEL5.5所有文件拷贝到/var/ftp/pub中,需要的文件从/var/ftp/pub中复制。

1.     创建 tftpboot文件夹。

[root@ocmrac1 Server]# mkdir /tftpboot

2.     pxelinux.0复制到/tftpboot

[root@ocmrac1 Server]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/

3.     把光盘中的下的/image/pxeboot/initred.imgvmlinux复制到/tftpboot

[root@ocmrac1 Server]# cp /var/ftp/pub/images/pxeboot/initrd.img /tftpboot/

[root@ocmrac1 Server]# cp /var/ftp/pub/images/pxeboot/vmlinuz /tftpboot/

4.     复制光盘中的isolinux/*.msg/tftpboot

[root@ocmrac1 Server]# cp /var/ftp/pub/isolinux/*.msg /tftpboot/

5.     tftpboot中新建一个pxelinux.efg目录。

[root@ocmrac1 Server]# mkdir -p /tftpboot/pxelinux.cfg

6.     Linux光盘中的isolinux目录中的isolinux.cfg复制到pxelinux.cfg目录中,并同时更改文件名称为default

[root@ocmrac1 pxelinux.cfg]# cp /var/ftp/pub/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

五、安装DHCP服务,同时修改配置

1、安装DHCP

[root@ocmrac1 Server]# rpm -ivh  dhcp-3.0.5-23.el5.i386.rpm

2.复制配置模版文件到指定的目录中,并重命名

[root@ocmrac1 Server]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

3.修改配置文件。

[root@ocmrac1 Server]# vi /etc/dhcpd.conf

ddns-update-style. interim;

ignore client-updates;

 

subnet 192.168.0.0 netmask 255.255.255.0 {

 

# --- default gateway

        option routers                  192.168.0.1;

        option subnet-mask              255.255.255.0;

        filename "pxelinux.0";     #新添加的

        next-server 192.168.0.101;  #PXE服务器IP地址

 

        option nis-domain               "oracle.com"; #修改过

        option domain-name              "oracle.com";#修改过

        option domain-name-servers      192.168.1.1;

 

        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.0.128 192.168.0.254;

        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;

        #}

}

4、启动DHCP服务

[root@ocmrac1 pxelinux.cfg]# service dhcpd restart

六.安装kickstart并进行配置

1.首先安装kickstart

[root@ocmrac1 Server]# rpm -ivh system-config-kickstart-2.6.19.8-2.el5.noarch.rpm

2.使用vnc,在gnomes环境配置kickstart

[root@ocmrac1 Server]# system-config-kickstart

配置如下:

1.     基本配置,按自己需求来就好

2.     安装方法,选择ftp,匿名安装。

 FTP Server:192.168.0.101

 FTP Directory:/pub

3.     引导安装程序选项,不需要做更改

4.     分区信息,创建四个分区 /boot ,/,/app,swap

5.     网络配置,使用DHCP分配地址

6.     显示配置,按照自己需要来

7.     软件包的选择---

8.     其它的都是默认设置,不做修改。

9.     生产文件ks.cfg,保存到/var/ftp/

[root@ocmrac1 Server]# cp /root/ks.cfg /var/ftp/

10/var/ftp/ks.cfg文件,增加一行key --skip

[root@ocmrac1 ftp]# vi ks.cfg

# Partition clearing information

clearpart --all --initlabel

key –skip

同时,参照/root/anaconda-ks.cfg,把需要安装的软件包从/root/anaconda-ks.cfg拷贝到

/var/ftp/ ks.cfg文件中的最后。软件包如下:

 

%packages

@admin-tools

@base

@chinese-support

@core

@development-libs

@development-tools

@dialup

@editors

@ftp-server

@gnome-desktop

@gnome-software-development

@games

@graphical-internet

@graphics

@java

@java-development

@kde-software-development

@legacy-network-server

@legacy-software-development

@legacy-software-support

@network-server

@office

@openfabrics-enterprise-distribution

@ruby

@server-cfg

@sound-and-video

@system-tools

@text-internet

@smb-server

@x-software-development

@base-x

 

七、修改/tftpboot/pxelinux.cfg/default中,指定读取ks.cfg文件的方法

ks=ftp://192.168.0.101/ks.cfg

 

[root@ocmrac1 pxelinux.cfg]# vi /tftpboot/pxelinux.cfg/default

default linux

prompt 1

timeout 6

default linux

prompt 1

timeout 6

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=ftp://192.168.0.101/ks.cfg

label text

  kernel vmlinuz

  append initrd=initrd.img text

label ks

  kernel vmlinuz

  append initrd=initrd.img

label local

  localboot 1

label memtest86

 

八、重新引导安装就可以了。

 

使用NFS网络方式安装RHEL

 

前面步骤一样,配置NFS服务器来安装RHEL

a安装配置NFS服务器

[root@ocmrac1 pxelinux.cfg]# mkdir -p /instnfs/i386/rhel5.5

[root@ocmrac1 pxelinux.cfg]# mv /var/ftp/rhel-server-5.5-i386-dvd.iso /instnfs/i386/rhel5.5/

2.编辑NFS服务器配置/etc/exports,,以允许其它机器通过NFS访问目录/instnfs/etc/exports文件内容如下:

[root@ocmrac1 pxelinux.cfg]# cat /etc/exports

/instnfs  *(ro,no_root_squash,sync)

 

其中:

·*表示任何IP地址都可以访问该目录,为了安全的考虑,也可以指定具体的IP地址。

·ro表示远程机器对该目录的只有读写权限。

·其他选项参考NFS手册。

3.重新启动NFS服务以使新配置生效

[root@ocmrac1 pxelinux.cfg]# service nfs restart

Shutting down NFS mountd:                                  [FAILED]

Shutting down NFS daemon:                                  [FAILED]

Shutting down NFS quotas:                                  [FAILED]

Shutting down NFS services:                                [FAILED]

Starting NFS services:                                     [  OK  ]

Starting NFS quotas:                                       [  OK  ]

Starting NFS daemon:                                       [  OK  ]

Starting NFS mountd:                                       [  OK  ]

[root@ocmrac1 pxelinux.cfg]#

4.检查目录/instnfs是否正确共享

[root@ocmrac1 pxelinux.cfg]# showmount -e localhost

Export list for localhost:

/instnfs *

 [root@ocmrac1 ftp]# chkconfig --level 35 nfs on

NFS服务器配置完成。

B备份之前的配置/var/pub/ks.cfg/tftpboot/pxelinux.cfg/default

[root@ocmrac1 instnfs]# mkdir ks

[root@ocmrac1 instnfs]# cp /var/ftp/ks.cfg  /instnfs/ks/

[root@ocmrac1 pxelinux.cfg]# cp /tftpboot/pxelinux.cfg/default /tftpboot/pxelinux.cfg/default.bak

C修改/tftpboot/pxelinux.cfg/default/instnfs/ks/ks.cfg,使其使用NFS服务

[root@ocmrac1 pxelinux.cfg]# cat default

default linux

prompt 1

timeout 6

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=ftp://192.168.0.101/ks.cfg

  append  initrd=initrd.img ks=nfs:192.168.0.101:/instnfs/ks/ks.cfg

label text

  kernel vmlinuz

  append initrd=initrd.img text

label ks

  kernel vmlinuz

  append initrd=initrd.img

label local

  localboot 1

label memtest86

  kernel memtest

  append

 

[root@ocmrac1 ks]# cat ks.cfg

#platform=x86, AMD64, or 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

key --skip

# Use graphical install

graphical

# 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 network installation

#url --url=ftp://192.168.0.101/pub

nfs --server=192.168.0.101 --dir=/instnfs/i386/rhel5.5

# Network information

D重新启动客户端,从网络引导自动安装RHEL

当安装完成时,重启机器要在BIOS设置从硬盘启动,以免重复前面自动安装步骤。

 

如果是正式环境使用这种方式安装RHEL,可以考虑从FTP安装,并使用用户和密码,以保障宕机的机器不会被误安装系统。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23757700/viewspace-768738/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/23757700/viewspace-768738/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值