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

[经验分享] centos7 pxe kickstart

[复制链接]

尚未签到

发表于 2018-4-23 09:39:43 | 显示全部楼层 |阅读模式
#kickstart for centos 7.pxe
#CentOS Linux release 7.2.1511 (Core)
#IP 10.0.7.34
#service dhcp httpd tftp-server
#关闭防火墙及selinux
[root@localhost ~]#systemctl stop iptables
[root@localhost ~]#systemctl stop firewalld
[root@localhost ~]#setenforce 0
#安装dhcp
[root@localhost ~]#yum install dhcp
[root@localhost ~]# cat /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 10.0.7.0 netmask 255.255.255.0 {
        option routers                  10.0.7.1;
        option subnet-mask              255.255.255.0;
        option time-offset              -18000; # Eastern Standard Time  
        range dynamic-bootp 10.0.7.11 10.0.7.29;
        default-lease-time 21600;
        max-lease-time 43200;
        next-server 10.0.7.34;
        filename "pxelinux.0";
}

[root@localhost ~]#yum install tftp-server xinetd -y
[root@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  #修改yes 为 no
per_source= 11
cps= 100 2
flags= IPv4
}
#下载内核,启动文件;此文件可从安装光盘中查看对应文件。
[root@localhost ~]#cd /var/lib/tftpboot/
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/images/pxeboot/initrd.img
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/images/pxeboot/vmlinuz
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/isolinux/vesamenu.c32
[root@localhost ~]#wget http://mirrors.163.com/centos/7/os/x86_64/isolinux/boot.msg
[root@localhost ~]#mkdir pxelinux.cfg
[root@localhost ~]#cat /var/lib/tftpboot/pxelinux.cfg/default
default linux
prompt 1
timeout 60
display boot.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img text ks=http://10.0.7.34/ks.cfg
[root@localhost ~]#yum install syslinux -y
[root@localhost ~]#cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
#ks.cfg安装文件;此文件可从~/anaconda-ks.cfg复制,并修改
[root@localhost ~]# cat /var/www/html/ks.cfg
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Install OS instead of upgrade  
install  
# Use network installation  此处为ISO地址,一般为内网地址
url --url=http://10.0.1.231/CentOS/7/os/x86_64
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8 --addsupport=zh_CN.UTF-8
# Network information
network  --bootproto=dhcp --device=em1 --onboot=off --ipv6=auto
network  --bootproto=dhcp --device=em2 --onboot=off --ipv6=auto
network  --bootproto=dhcp --device=em3 --onboot=off --ipv6=auto
network  --bootproto=dhcp --device=em4 --onboot=off --ipv6=auto
network  --hostname=localhost.localdomain
# Root password
rootpw --iscrypted $6$XnDH3wP0.n1Tn9YJ$I/my1AH6B.9BxhB6O1cGUjmuTBD9BVKP19R.2nQrU0Q0NjcGB7HP3BTeOLBy3HkJtB8Qh4wEvrOGxShOUyoLc.
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --all --initlabel --drives=sda
%packages
@^minimal
@core
kexec-tools
%end
%addon com_redhat_kdump --disable --reserve-mb='auto'
%end
##############################################################  

运维网声明 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-450748-1-1.html 上篇帖子: CentOS下杀毒工具ClamAV安装 下篇帖子: CentOS Linux下的3款分区工具
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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