设为首页 收藏本站
查看: 864|回复: 0

[经验分享] DHCP+TFTP+SYSLINUX+NFS+KICKSTART

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2017-9-15 10:10:56 | 显示全部楼层 |阅读模式
一.配置dhcp服务
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[iyunv@localhost ~]# yum install dhcp -y
[iyunv@localhost ~]# cat /etc/dhcp/dhcpd.conf
ddns-update-style interim;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.20 192.168.1.254;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.1.1;
option broadcast-address 192.168.1.255;
default-lease-time 86400;
max-lease-time 172800;
next-server 192.168.1.1;      ##tftpf服务器地址
filename "pxelinux.0";     ###网络启动
}
[iyunv@localhost ~]# service dhcp start







二.配置TFTP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[iyunv@localhost ~]# yum install tftp-server
[iyunv@localhost ~]# vim /etc/xintd.d/tftp        ##编辑使其打开tftp功能
[iyunv@localhost ~]# 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 /var/lib/tftpboot
disable= no
per_source= 11
cps= 100 2
flags= IPv4
}
[iyunv@localhost ~]# service xinitd restart





开启防火墙69/udp
三.配置SYSLINUX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[iyunv@localhost ~]# yum install syslinux
[iyunv@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[iyunv@localhost ~]# cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/
[iyunv@localhost ~]# cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/
[iyunv@localhost ~]# cp /mnt/isolinux/vesamenu.c32 /var/lib/tftpboot/
[iyunv@localhost ~]# cp /mnt/isolinux/*.msg /var/lib/tftpboot/
[iyunv@localhost ~]# cp /mnt/isolinux/splash.jpg /var/lib/tftpboot/
[iyunv@localhost tftpboot] ll
总用量 38044
-r--r--r--. 1 root root       84 9月   1 04:27 boot.msg
-r--r--r--. 1 root root 33383449 9月   1 04:24 initrd.img
-rw-r--r--. 1 root root    26828 9月   1 04:23 pxelinux.0
drwxr-xr-x. 2 root root     4096 9月   1 06:18 pxelinux.cfg
-r--r--r--. 1 root root  1236005 9月   1 06:25 splash.jpg
-r--r--r--. 1 root root   162860 9月   1 04:26 vesamenu.c32
-r-xr-xr-x. 1 root root  4128944 9月   1 04:24 vmlinuz
[iyunv@localhost tftpboot]#
[iyunv@localhost ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[iyunv@localhost ~]# cp  /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[iyunv@localhost pxelinux.cfg]# cat default
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to Red Hat Enterprise Linux 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 ks=nfs:192.168.1.1:/tmp/ks.cfg inst.stage2=nfs:192.168.1.1/systemiso/rhel6 initrd=initrd.img
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 -








四.配置NFS
1
2
3
4
5
6
7
8
9
10
11
[iyunv@localhost tftpboot]# cat /etc/exports
/systemiso/rhel6 *(rw)
/tmp/ *(rw)
[iyunv@localhost tftpboot]#
[iyunv@localhost ~]# mkdir -p  /systemiso/rhel6
[iyunv@localhost ~]# cp -r /mnt/* /systemiso/rhel6
[iyunv@localhost ~]# chmod +r /systemiso/rhel6/*
[iyunv@localhost ~]# service nfs start
[iyunv@localhost tftpboot]# cat /etc/exports
/systemiso/rhel6 *(rw)
/tmp/ *(rw)







五.创建kickstart文件
1
2
可以使用图形化配置ks.cfg文件
[iyunv@localhost tftpboot]# yum install system-config-kickstart



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
或者直接使用已经创建好的ks.cfg
[iyunv@localhost ~]# cat /tmp/ks.cfg
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use NFS installation media
nfs --server=192.168.110.1 --dir=/systemiso/rhel6
# Root password
rootpw --iscrypted $1$eQ/X66iG$5qRmqf/zXbufAREjjaWLv.
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use text mode install
text
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone  Africa/Abidjan
# 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                   #我给的硬盘8G
part /boot --fstype="ext4" --size=500      
part / --fstype="ext4" --size=6656
part swap --fstype="swap" --size=1000
%packages
@base
@compat-libraries
%end



最后创建虚拟机,使用网络px启动即可自动安装


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-404575-1-1.html 上篇帖子: rsync高级同步工具基础及实战 下篇帖子: Linux服务管理之NTP服务器配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表