温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

配置Kickstart脚本以便更好的安装系统的方法

发布时间:2021-09-27 14:39:48 来源:亿速云 阅读:139 作者:iii 栏目:系统运维

这篇文章主要讲解了“配置Kickstart脚本以便更好的安装系统的方法”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“配置Kickstart脚本以便更好的安装系统的方法”吧!

  配置kickstart脚本的方法

  ###############################################################

  #

  # Sample Kickstart Configuration File

  #

  ###############################################################

  ###############################################################

  #

  # point to a local installation server, or use “cdrom”

  #

  ###############################################################

  url --url http://rha-server/pub/rhel5/

  #cdrom

  rootpw RedHat

  bootloader --location=mbr --password=redhat

  ###############################################################

  #

  # partitioning

  #

  ###############################################################

  zerombr yes

  clearpart --all --initlabel

  part /boot --fstype ext3 --size 128

  part / --fstype ext3 --size 1 --grow

  part swap --recommended

  ###############################################################

  #

  # network configuration

  # - the following is for the “recommended solution” outlined

  # in the Red Hat Academy Instructor‘s Guide

  #

  ###############################################################

  network --bootproto=dhcp --device=eth0

  firewall --disabled

  #network --bootproto=static --ip=192.168.0.254 --netmask=255.255.255.0

  --device=eth0

  #firewall --medium --http --port=https:tcp

  ###############################################################

  #

  # environment

  #

  ###############################################################

  lang zh_CN.UTF-8

  timezone Asia/Shanghai

  ###############################################################

  #

  # hardware

  #

  ###############################################################

  keyboard us

  xconfig --startxonboot

  ###############################################################

  # misc

  ###############################################################

  key --skip # skip install number

  authconfig --enableshadow --enablemd5

  reboot # reboot automatically when done

  install # instead of “upgrade”

  ###############################################################

  #

  # Software

  #

  ###############################################################

  %packages --resolvedeps

  @admin-tools

  @editors

  @text-internet

  @gnome-desktop

  @core

  @base

  @base-x

  @chinese-support

  @sound-and-video

  @graphical-internet

  emacs

  kexec-tools

  device-mapper-multipath

  xorg-x11-utils

  xorg-x11-server-Xnest

  -sysreport

  %post

  ###############################################################

  #

  # Post Script - the following script runs on the newly

  # installed machine, immediately after installation

  #

  ###############################################################

  echo “nameserver 192.168.0.254” 》》 /etc/resolv.conf

  rpm -ivh ftp://rha-server/rha/autoupdate/rha-base*.rpm

  #rpm -Fvh ftp://Kickstart.example.com/pub/9/i386/updates/*.rpm

  #curl http://rha-server/rha/xorg.conf 》 /etc/X11/xorg.conf

  #curl http://rha-server/rha/station.cfg | tar xvzf -

  for i in elvis blondie prince madonna; do

  useradd $i

  echo redhat | passwd --stdin $i

  done

  Kickstart 脚本设计

  Kickstart 脚本通常有三个不同的部分。

  :   命令部分

  :   软件包部分

  :   安装后脚本部分

  Anaconda 会忽略Kickstart 脚本中所有以“#”开始的行和空行。

  命令部分

  从文件的最开始直到出现以%packages 开始的行,这一部分都属于命令部分。命令行必须以可识别的关键字开始,并且所有与该关键字有关的参数都必须出现在同一行中。命令部分是用来指定安装程序需要的除软件选项外的所有标准信息。关键字在命令部分可以以任意次序出现。

  软件包部分(%packages)

  软件包部分是用来指定需要安装的软件。这部分从以%packages 开头的行开始,直到下

  一个以“%”字符开始的行为止。这一部分通常采用以下两种格式之一。

  :   @Component Name

  :   package-name

  第一种格式是用软件组来指定软件,在这里一定要注意正确拼写软件组名称,并注意大小写。

  第二种格式是用来指定要安装的软件包的具体名称。如果%packages 行包含额外的--resolvedeps 参数,那么也会安装解决相依性的软件包。

  安装后脚本部分(%post)

  后处理部分是在没有 Anaconda 安装程序参与下,执行所有新安装系统的机器的自定义过程。执行这部分内容与在新安装系统的机器的环境下运行 Bash Shell 脚本的效果是一样的。如果是网络安装,那么执行前面提到作为实例的脚本也可以激活网络配置。

感谢各位的阅读,以上就是“配置Kickstart脚本以便更好的安装系统的方法”的内容了,经过本文的学习后,相信大家对配置Kickstart脚本以便更好的安装系统的方法这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI