欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Centos6.5全自动安装 vsftpd+dhcp+nfs+tftp

程序员文章站 2022-06-11 12:54:41
步骤 1、mount /dev/sr0 /media/ 2、安装所需要的软件 安装并配置tftp服务 yum install tftp tftp-serve...

步骤

1、mount /dev/sr0 /media/

2、安装所需要的软件

安装并配置tftp服务

yum install tftp tftp-server vsftpd dhcp syslinux nfs-utils
vim /etc/xinetd.d/tftp
      service tftp
  {
    disable = no
    socket_type       = dgram
    protocol        = udp
    wait          = yes
    user          = root
    server         = /usr/sbin/in.tftpd
    server_args       = -s /var/lib/tftpboot
    per_source       = 11
    cps           = 100 2
    flags          = ipv4
  }

配置dhcp

# dhcpd.conf
  #
  # sample configuration file for isc dhcpd
  #
 
  allow booting;
  allow bootp;
 
 
  # a slightly different configuration for an internal subnet.
  subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.50 192.168.1.60;
  option domain-name-servers kangchangwei;
  option domain-name "kangchangwei";
  option routers 192.168.1.1;
  default-lease-time 600;
  max-lease-time 7200;
  filename "pxelinux.0";
  next-server 192.168.1.101;
  }

以上ip可以根据自己所在的网络修改

3、复制所需要的启动文件

cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
 cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot
 cp /media/images/pxeboot/initrd.img /var/lib/tftpboot/
 cp /media/images/pxeboot/vmlinuz /var/lib/tftpboot/

mkdir /var/lib/tftpboot/pxelinux.cfg
 cp /media/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

编辑
 vim /var/lib/tftpboot/pxelinux.cfg/default

default linux
#default vesamenu.c32
prompt 1
timeout 600
 
display boot.msg
 
menu background splash.jpg
menu title welcome to centos 6.5!
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 linux
 menu label ^install or upgrade an existing system
 menu default
 kernel vmlinuz
 append initrd=initrd.img ks=ftp://192.168.1.101/pub/ks.cfg
label vesa
 menu label install system with ^basic video driver
 kernel vmlinuz
 append initrd=initrd.img xdriver=vesa nomodeset
label rescue
 menu label ^rescue installed system
 kernel vmlinuz
 append initrd=initrd.img rescue
label local
 menu label boot from ^local drive
 localboot 0xffff
label memtest86
 menu label ^memory test
 kernel memtest
 append -

4、共享光盘

vim /etc/export
/media *(ro,sync)

启动nfs服务

[root@kcw ~]# /etc/init.d/rpcbind restart
停止 rpcbind:                       [确定]
正在启动 rpcbind:                     [确定]
[root@kcw ~]# /etc/init.d/nfs restart
关闭 nfs 守护进程:                    [确定]
关闭 nfs mountd:                     [确定]
关闭 nfs 服务:                      [确定]
shutting down rpc idmapd:                 [确定]
启动 nfs 服务:                      [确定]
启动 nfs mountd:                     [确定]
启动 nfs 守护进程:                    [确定]
正在启动 rpc idmapd:                   [确定]

查看nfs输出

[root@kcw ~]# showmount -e localhost
export list for localhost:
/media *

生成ks.cfg文件安装工具

[root@kcw ~]# yum install system-config-kickstart

然后运行

system-config-kickstart

来修改页面得到自己安装的客户端
我这里省略。。

这有个做好的ks.cfg

内容如下:

#platform=x86, amd64, or intel em64t
#version=devel
key --skip
# firewall configuration
firewall --disabled
# install os instead of upgrade
install
# use network installation
nfs --server=192.168.1.101 --dir=/media
# root password
rootpw --iscrypted $1$9elloihk$po.nfjnd/6k88z3ciivpc.
# network information
network --bootproto=dhcp --device=eth0 --onboot=on
# system authorization information
auth --useshadow --passalgo=md5
# use text mode install
text
# system keyboard
keyboard us
# system language
lang zh_cn
# 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 asia/shanghai
# system bootloader configuration
bootloader --location=mbr
# clear the master boot record
zerombr
# partition clearing information
clearpart --all 
# disk partitioning information
part swap --size 2048 
part /boot --size 200 
part pv.01 --size 30000 
volgroup vol0 pv.01
logvol / --vgname=vol0 --size=25000 --name=root
#logvol /home --vgname=vol0 --size=500 --name=home
 
%post
#wget ftp://192.168.1.101/pub/yum.repo -p /etc/yum.repos.d/
%packages
@ desktop
@ console internet tools
@ desktop platform
@ development tools
@ general purpose desktop
@ graphical administration tools
@ internet browser
@ network file system client
@ printing client
@ x window system
@ chinese support

注意我这块root密码是redhat
我这里分区时lvm分区根据你的需求也可以修改

然后把ks.cfg放到你的vsftpd默认可以访问的目录里

即:

[root@kcw ~]# cd /var/ftp/pub/
[root@kcw pub]# ls
ks.cfg
[root@kcw pub]# pwd
/var/ftp/pub


注意先测试你的这个文件能不能访问打开ie
输入

看能否看到内容!

做完重启dhcp vsftpd xine xinetd nfs

然后重新开台电脑开机设置从网卡引导看能否启动成功并且自动安装

我这块等待默认600秒 自动安装

开机引导到boot:时按回车安装