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

[经验分享] kickstart批量安装centos 7系统

[复制链接]

尚未签到

发表于 2018-4-28 06:40:23 | 显示全部楼层 |阅读模式
  环境准备:10.0.0.7
  =============PXE+Kickstart
  1.ks文件  ok
  2.DHCP服务器  ok
  3.TFTP服务器  ok  文件
  4.HTTP服务器(NFS、FTP) ok
  5.网卡启动  ok
  6.YUM仓库安装源  ok
  首先挂载光盘镜像:CentOS-7-x86_64-DVD-1503-01
[root@linux-node1 ~]# mount /dev/cdrom /mnt

[root@linux-node1 ~]# yum install -y httpd createrepo

[root@linux-node1 ~]# mkdir /var/www/html/CentOS-7.1-x86_64

[root@linux-node1 ~]# cp -a /mnt/* /var/www/html/CentOS-7.1-x86_64/

[root@linux-node1 ~]# createrepo -pdo /var/www/html/CentOS-7.1-x86_64/ /var/www/html/CentOS-7.1-x86_64/

[root@linux-node1 ~]# createrepo -g `ls /var/www/html/CentOS-7.1-x86_64/repodata/*-comps.xml` /var/www/html/CentOS-7.1-x86_64/

  

[root@linux-node1 ~]# yum install -y tftp-server dhcp xinetd

[root@linux-node1 ~]# vim /etc/xinetd.d/tftp

  disable                 = no
  

[root@linux-node1 ~]# cd /usr/share/doc/dhcp-4.1.1/

[root@linux-node1 dhcp-4.1.1]# cp dhcpd.conf.sample /etc/dhcp/dhcpd.conf

  subnet 10.0.0.0 netmask 255.255.255.0 {
  range dynamic-bootp 10.0.0.100 10.0.0.200;
  option subnet-mask 255.255.255.0;
  next-server 10.0.0.7;
  filename "pxelinux.0";
  }
  

[root@linux-node1 dhcp-4.1.1]# /etc/init.d/dhcpd start

  正在启动 dhcpd:                                           [确定]
[root@linux-node1 dhcp-4.1.1]# /etc/init.d/httpd start

  正在启动 httpd:
[root@linux-node1 dhcp-4.1.1]# /etc/init.d/xinetd start

  

  放置Kickstart文件
[root@linux-node1 ~]# curl --head http://10.0.0.7/CentOS-7.1-x86_64/CentOS-7.1-x86_64.cfg

  

[root@linux-node1 ~]# yum install -y syslinux

[root@linux-node1 ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

[root@linux-node1 ~]# cp /mnt/isolinux/* /var/lib/tftpboot/

[root@linux-node1 ~]# mkdir /var/lib/tftpboot/pxelinux.cfg

[root@linux-node1 CentOS-7.1-x86_64]# vim CentOS-7.1-x86_64.cfg

  18 url --url=http://10.0.0.7/CentOS-7.1-x86_64
[root@linux-node1 ~]# cd /var/lib/tftpboot/pxelinux.cfg/

[root@linux-node1 pxelinux.cfg]# cp /mnt/isolinux/isolinux.cfg default

[root@linux-node1 pxelinux.cfg]# cat default   

  default vesamenu.c32
  timeout 600
  

  display boot.msg
  

  # Clear the screen when exiting the menu, instead of leaving the menu displayed.
  # For vesamenu, this means the graphical background is still displayed without
  # the menu itself for as long as the screen remains in graphics mode.
  menu clear
  menu background splash.png
  menu title CentOS 7
  menu vshift 8
  menu rows 18
  menu margin 8
  #menu hidden
  menu helpmsgrow 15
  menu tabmsgrow 13
  

  # Border Area
  menu color border * #00000000 #00000000 none
  

  # Selected item
  menu color sel 0 #ffffffff #00000000 none
  

  # Title bar
  menu color title 0 #ff7ba3d0 #00000000 none
  

  # Press [Tab] message
  menu color tabmsg 0 #ff3a6496 #00000000 none
  

  # Unselected menu item
  menu color unsel 0 #84b8ffff #00000000 none
  

  # Selected hotkey
  menu color hotsel 0 #84b8ffff #00000000 none
  

  # Unselected hotkey
  menu color hotkey 0 #ffffffff #00000000 none
  

  # Help text
  menu color help 0 #ffffffff #00000000 none
  

  # A scrollbar of some type? Not sure.
  menu color scrollbar 0 #ffffffff #ff355594 none
  

  # Timeout msg
  menu color timeout 0 #ffffffff #00000000 none
  menu color timeout_msg 0 #ffffffff #00000000 none
  

  # Command prompt text
  menu color cmdmark 0 #84b8ffff #00000000 none
  menu color cmdline 0 #ffffffff #00000000 none
  

  # Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.
  

  menu tabmsg Press Tab for full configuration options on menu items.
  

  menu separator # insert an empty line
  menu separator # insert an empty line
  

  label ks
  menu label ^AUTO Install CentOS 7
  kernel vmlinuz
  append initrd=initrd.img ks=http://10.0.0.7/CentOS-7.1-x86_64/CentOS-7.1-x86_64.cfg
  

  label linux
  menu label ^Install CentOS 7
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet
  

  label check
  menu label Test this ^media & install CentOS 7
  menu default
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quiet
  

  menu separator # insert an empty line
  

  # utilities submenu
  menu begin ^Troubleshooting
  menu title Troubleshooting
  

  label vesa
  menu indent count 5
  menu label Install CentOS 7 in ^basic graphics mode
  text help
  Try this option out if you're having trouble installing
  CentOS 7.
  endtext
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 xdriver=vesa nomodeset quiet
  

  label rescue
  menu indent count 5
  menu label ^Rescue a CentOS system
  text help
  If the system will not boot, this lets you access files
  and edit config files to try to get it booting again.
  endtext
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rescue quiet
  

  label memtest
  menu label Run a ^memory test
  text help
  If your system is having issues, a problem with your
  system's memory may be the cause. Use this utility to
  see if the memory is working correctly.
  endtext
  kernel memtest
  

  menu separator # insert an empty line
  

  label local
  menu label Boot from ^local drive
  localboot 0xffff
  

  menu separator # insert an empty line
  menu separator # insert an empty line
  

  label returntomain
  menu label Return to ^main menu
  menu exit
  

  menu end
  root                   unixhot

  

运维网声明 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-452863-1-1.html 上篇帖子: 开始在CentOS 6.7上安装Python 2.7.8 下篇帖子: Centos 解决中文乱码与设置字符
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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