linux对目录ks设置只运行创建者查看,linux下PXE和KickStart实现Linux下的无人值守安装...

KickStart无人值守安装的原理:

1. DHCP服务器给需要安装的机器分发IP, 并指定ftp服务器地址和pxelinux.0

next-server 192.168.2.18;

filename "pxelinux.0";

2. 客户端连接到服务器,读取启动文件 /tftpboot/pxelinux.cfg/default

3. 根据default里面指定的ks.cfg文件的位置,打开KickStart配置文件,

4. 根据ks.cfg的ftp服务器的配置, 读取/var/ftp/pub/文件, 引导安装程序

1. 查看服务状态, 启动服务

1.1 查看三种服务的状态,是否为启动状态

service vsftpd status

service xinetd status

service dhcpd status

1.2 如果没有默认启动,可以设置为默认启动.

service vsftpd status

service xinetd status

service dhcpd status

1.3 dhcp服务配置 rpm -ql dhcp | more

vim /etc/dhcp/dhcpd.conf

[root@centos6-64 pub]# cat /etc/dhcp/dhcpd.conf

ddns-update-style interim;

ignore client-updates;

allow booting;

allow bootp;

subnet 192.168.2.0 netmask 255.255.255.0 {

option routers 192.168.2.1;

option subnet-mask 255.255.255.0;

option domain-name-servers 192.168.2.1;

option time-offset -18000; # Eastern Standard Time

range dynamic-bootp 192.168.2.60 192.168.2.100;

default-lease-time 21600;

max-lease-time 43200;

next-server 192.168.2.18;

filename "pxelinux.0";

}

1.4 tftp服务配置

yum intall -y tftp*

tftp服务是xinetd的子服务.

[root@centos6-64 ftp]# cat /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

disable= no

per_source= 11

cps= 100 2

flags= IPv4

}

2. 创建pxe启动所需要的文件和目录

mkdir /tftpboot

mkdir /tftpboot/pxelinux.cfg

cp /usr/share/syslinux/pxelinux.0 /tftpboot/挂载安装光盘的镜像,并拷贝以下文件:

cp /mnt/iso/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

cp /mnt/iso/images/pxeboot/initrd.img /tftpboot/

cp /mnt/iso/images/pxeboot/vmlinuz /tftpboot/

3. 修改/tftpboot/pxelinux.cfg/default文件 vim /tftpboot/pxelinux.cfg/default

[root@centos6-64 pxelinux.cfg]# cat default

default linux

prompt 1

timeout 60

display boot.msg

label linux

kernel vmlinuz

append initrd=initrd.img text ks=ftp://192.168.2.18/ks.cfgks.cfg 是使用kickstart程序生成的文件.后面我们会使用KickStart生成它.

4. 使用kickstart程序生成ks.cfg安装配置文件 安装kickstart:

yum list *kic*

yum install system-config-kickstart.noarch

运行system-config-kickstart,进行图形化参数配置界面:

4.1.基本配置:

b4dc9ef89129fdb8eaf6007d68be96e1.png

4.2 安装方法

60a745430cbefd397ff2e23ca81cd627.png

4.3.创建新的分区:

ea0052912e8074ad0d37a396b64230d1.png

4.4.网络配置:

51f91ff22e14743451bd1e96d30160db.png

4.5.剩下的项目是关于防火墙,selinux的,看个人需求选择.

最后保存配置文件:

af1e8210398f83e30a254f2fe5e25f3d.png

5. 修改生成的ks.cfg文件

5.1 将%packages后面的全拷贝到ks.cfg中的%packages后面去 cat /root/anaconda-ks.cfg #系统的安装信息

%packages

@base

@chinese-support

@core

@debugging

@basic-desktop

@desktop-debugging

@desktop-platform

@directory-client

@fonts

@general-desktop

@graphical-admin-tools

@input-methods

@internet-applications

@internet-browser

@java-platform

@legacy-x

@network-file-system-client

@office-suite

@print-client

@remote-desktop-clients

@server-platform

@server-policy

@x11

mtools

pax

oddjob

wodim

sgpio

genisoimage

device-mapper-persistent-data

abrt-gui

samba-winbind

certmonger

pam_krb5

krb5-workstation

gnome-pilot

libXmu

5.2 添加key --skip //跳过输入序列号环节

[root@rhce ~]# cat ks.cfg

[root@centos6-64 tftpboot]# cat /var/ftp/ks.cfg

[root@centos6-64 ftp]# cat ks.cfg

#platform=x86, AMD64, or Intel EM64T

#version=DEVEL

# Firewall configuration

firewall --disabled

# Install OS instead of upgrade

install

# Use network installation

url --url=ftp://192.168.2.18/pub

# Root password

rootpw --iscrypted $1$YfhInJ/9$hqyxxL34AduJm0Zzfcl/F1

# System authorization information

auth --passalgo=sha512

# Use graphical install

graphical

firstboot --disable

# System keyboard

keyboard us

# System language

lang en_US

# SELinux configuration

selinux --disabled

# Installation logging level

logging --level=info

key --skip

# System timezone

timezone Asia/Shanghai

# Network information

network --bootproto=dhcp --device=eth0 --onboot=on

# System bootloader configuration

bootloader --location=mbr

# Clear the Master Boot Record

zerombr

# Partition clearing information

clearpart --all --initlabel

# Disk partitioning information

part /boot --fstype="ext4" --size=200

part swap --fstype="swap" --size=4096

part / --fstype="ext4" --grow --size=1

%packages

@base

@chinese-support

@core

@debugging

@basic-desktop

@desktop-debugging

@desktop-platform

@directory-client

@fonts

@general-desktop

@graphical-admin-tools

@input-methods

@internet-applications

@internet-browser

@java-platform

@legacy-x

@network-file-system-client

@office-suite

@print-client

@remote-desktop-clients

@server-platform

@server-policy

@x11

mtools

pax

oddjob

wodim

sgpio

genisoimage

device-mapper-persistent-data

abrt-gui

samba-winbind

certmonger

pam_krb5

krb5-workstation

gnome-pilot

libXmu

%end

5.3 将配置文件拷贝到ftp目录下

cp ks.cfg /var/ftp/

6. 将系统相关文件拷贝到配置ks.cfg时,指定的ftp目录下 挂载系统镜文件到/vat/ftp/pub/下

[root@centos6-64 ~]# ls -l /var/ftp/

total 8

-rw-r--r-- 1 root root 1419 Nov 20 17:58 ks.cfg

dr-xr-xr-x 7 root root 4096 Mar 6 2013 pub

[root@centos6-64 ~]# ls -l /var/ftp/pub/

total 676

-r--r--r-- 2 root root 14 Mar 6 2013 CentOS_BuildTag

dr-xr-xr-x 3 root root 2048 Mar 5 2013 EFI

-r--r--r-- 2 root root 212 Mar 3 2013 EULA

-r--r--r-- 2 root root 18009 Mar 3 2013 GPL

dr-xr-xr-x 3 root root 2048 Mar 5 2013 images

dr-xr-xr-x 2 root root 2048 Mar 5 2013 isolinux

dr-xr-xr-x 2 root root 649216 Mar 6 2013 Packages

-r--r--r-- 2 root root 1354 Mar 3 2013 RELEASE-NOTES-en-US.html

dr-xr-xr-x 2 root root 4096 Mar 6 2013 repodata

-r--r--r-- 2 root root 1706 Mar 3 2013 RPM-GPG-KEY-CentOS-6

-r--r--r-- 2 root root 1730 Mar 3 2013 RPM-GPG-KEY-CentOS-Debug-6

-r--r--r-- 2 root root 1730 Mar 3 2013 RPM-GPG-KEY-CentOS-Security-6

-r--r--r-- 2 root root 1734 Mar 3 2013 RPM-GPG-KEY-CentOS-Testing-6

-r--r--r-- 1 root root 3380 Mar 6 2013 TRANS.TBL

到此配置结束, 启动需要安装系统的机器. 修改BIOS以网卡方式启动.

如果DHCP配置有问题,或PXE找不到安装文件的问题,

请查看/var/log/message 或仔细核对目录是否一致.

#注意如果KickStarts配置在虚拟机中,

虚拟机的网卡要设置为桥接(Bridged)模式.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值
>