码迷,mamicode.com
首页 > 其他好文 > 详细

kickstart+vsftp+dhcp+tftp 无人值守安装centos6

时间:2015-08-06 18:44:54      阅读:264      评论:0      收藏:0      [点我收藏+]

标签:kickstart

1.测试环境

测试环境:


系统:centos+DHCP+VSFTP+TFTP

服务器IP:192.168.1.1

DHCP地址段:192.168.1.10 - 192.168.1.100

Client:一台普通的PC(需要能从网卡,支持PXE启动)


1.1 安装配置dhcp

1.1.1 安装dhcp

#yum -y install dhcp


1.1.2 配置dhcp

# vi /etc/dhcp/dhcpd.conf



default-lease-time 21600;

max-lease-time 43200;

log-facility local7;


subnet 192.168.1.0 netmask 255.255.255.0 {

  range 192.168.1.10 192.168.1.100;

  option routers 192.168.1.1;

  option broadcast-address 192.168.1.255;

  filename "/pxelinux.0";   #tftp 目录

  Next-server 192.168.1.1;  #tftp服务器ip


}


1.2 ftp 安装

# yum -y install vsftp


1.2.1 vstfp配置


vi /etc/vsftpd/vsftpd.conf

anonymous_enable=YES  #运行匿名用户访问

local_enable=YES

write_enable=YES

local_umask=022

anon_upload_enable=YES    #允许匿名用户上传

anon_mkdir_write_enable=YES  #允许匿名用户写

dirmessage_enable=YES

xferlog_enable=YES

connect_from_port_20=YES

xferlog_std_format=YES

listen=YES


pam_service_name=vsftpd

userlist_enable=YES

tcp_wrappers=YES


1.3 安装配置tftp

1.3.1 安装tftp


# yum -y install tftp*

1.3.2 配置tftp

# vi /etc/xinetd.d/tftp

service tftp

{

        socket_type             = dgram

        protocol                = udp

        wait                    = yes

        user                    = root

        server                  = /usr/sbin/in.tftpd

        server_args             = -s /tftpboot   #tftp目录路径

        disable                 = no          # yes 改为no

        per_source              = 11

        cps                     = 100 2

        flags                   = IPv4

}


1.4 复制系统安装所需要的文件

1.4.1复制安装程序所必须的initrd.img 和 vmlinuz

# mount /dev/cdrom /mnt/

# cp /mnt/isolinux/initrd.img /tftpboot/

# cp /mnt/isolinux/vmlinuz /tftpboot/


1.4.2 复制pxelinux.0和default


配置PXE的引导文件,pxe需要2个文件,一个是pxelinux.0,另外一个是default

pxelinux.0 需要先安装包

#yum -y install syslinux

# cp /usr/share/syslinux/pxelinux.0 /tftpboot/


复制defaul

# mkdir -p /tftpboot/pxelinux.cfg/

# cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/

# cd /tftpboot/pxelinux.cfg/

# mv isolinux.cfg default


查看文件


#cd /tftpboot

#ls

initrd.img  pxelinux.0  pxelinux.cfg   vmlinuz


# ls /tftpboot/pxelinux.cfg/

default


1.5 配置default

#vi /tftpboot/pxelinux.cfg/default


default 1   #默认启动lable

prompt 1

timeout 60  #超时时间


display boot.msg

menu background splash.jpg

menu title Welcome to CentOS 6.3!

menu color border 0 #ffffffff #00000000

menu color sel 7 #ffffffff #ff000000

menu color title 0 #ffffffff #00000000

menu color tabmsg 0 #ffffffff #00000000

menu color unsel 0 #ffffffff #00000000

menu color hotsel 0 #ff000000 #ffffffff

menu color hotkey 7 #ffffffff #ff000000

menu color scrollbar 0 #ffffffff #00000000


label 1

  kernel /vmlinuz

  append initrd=initrd.img ramdisk_size=9216 ks=ftp://192.168.1.1/pub/RHEL6/ks.cfg

ks路径一定要写绝对路径


1.6 拷贝iso 文件

# mount /dev/cdrom /mnt/

# mkdir -p /var/ftp/pub/RHEL6/

# cp -rf /mnt/* /var/ftp/pub/RHEL6/


1.7 配置ks.cfg

复制ks.cfg,从root下复制

# cp /root/anaconda-ks.cfg /var/ftp/pub/RHEL6/

# mv anaconda-ks.cfg ks.cfg


配置ks.cfg


# vi ks.cfg


#platform=x86, AMD64, or Intel EM64T

#version=DEVEL

# Firewall configuration

firewall --enabled --ssh

# Install OS instead of upgrade

install

# Use NFS installation media

#nfs --server=192.168.100.101 --dir=/media/cdrom

url --url=ftp://192.168.1.1/pub/RHEL6/

# Root password

rootpw  --iscrypted $6$MzZ3BXZsXNr0f8/x$eCsipyVr5SmqiqGVcGVv2N5kaQ7ff7zO5qTotejBRjjNM8QkQI.Emor8jY8RAv/ULvD/FoMU/AM2V21y../7f.

# System authorization information

auth  --useshadow  --passalgo=sha512

# Use text mode install

text

# System keyboard

keyboard us

# System language

lang en_US

# SELinux configuration

selinux --disabled

# Do not configure the X Window System

skipx

# Installation logging level

logging --level=info

# Reboot after installation


reboot


# System timezone

timezone --isUtc 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 swap --size=2048

part / --fstype=ext4 --grow --size=200


%packages

@base

@core

@development

@server-policy

sgpio

%end


2. 启动服务

2.1 启动dhcp

# /etc/init.d/dhcpd start

2.2 启动tftp

# /etc/init.d/xinetd start

2.3 启动vsftp

# /etc/init.d/vsftpd start


3.注意事项

3.1 Server 端必须关闭防火墙,关闭selinux

# /etc/init.d/iptables stop

# setsebool -P

setsebool:  SELinux is disabled.


 


4. 错误

4.1 PXE:not found file

检查tftp路径


4.2. unable to download the kickstart

检查ks文件路径及配置

关闭防火墙,selinux


本文出自 “运维菜鸟” 博客,请务必保留此出处http://ckl893.blog.51cto.com/8827818/1682281

kickstart+vsftp+dhcp+tftp 无人值守安装centos6

标签:kickstart

原文地址:http://ckl893.blog.51cto.com/8827818/1682281

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!