[关闭]
@mrz1 2018-01-14T06:45:18.000000Z 字数 3437 阅读 678

PXE自动化安装CentOS 6 7

自动化


第一步:准备两个yum源

  1. sr0 11:0 1 3.7G 0 rom /var/www/html/centos/7
  2. sr1 11:1 1 8.1G 0 rom /var/www/html/centos/6

第二部:准备应答文件

centos6应答文件

  1. [root@centos7 ksdir]#cat ks6-desktop.cfg
  2. # Kickstart file automatically generated by anaconda.
  3. #version=DEVEL
  4. install
  5. reboot
  6. text
  7. url --url=http://192.168.27.6/centos/6/
  8. lang en_US.UTF-8
  9. keyboard us
  10. network --onboot yes --device eth0 --bootproto dhcp --noipv6
  11. rootpw --iscrypted $6$0ApPfIO1$YGbB.gKGJA3S5klOW/ePF6PjutrSGcTAad5s6lxuP1Gyez3UFPUUl7X7KHzyo.EWq.UVV3kwhgIc4DJitRA8W.
  12. firewall --disabled
  13. authconfig --enableshadow --passalgo=sha512
  14. selinux --disabled
  15. timezone Asia/Shanghai
  16. bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
  17. # The following is the partition information you requested
  18. # Note that any partitions you deleted are not expressed
  19. # here so unless you clear all partitions first, this is
  20. # not guaranteed to work
  21. clearpart --all
  22. zerombr
  23. part /boot --fstype=ext4 --size=1024
  24. part / --fstype=ext4 --size=50000
  25. part /app --fstype=ext4 --size=20000
  26. part swap --size=2048
  27. %packages
  28. @base
  29. @core
  30. @debugging
  31. @basic-desktop
  32. @desktop-debugging
  33. @desktop-platform
  34. @directory-client
  35. @fonts
  36. @general-desktop
  37. @graphical-admin-tools
  38. @input-methods
  39. @internet-applications
  40. @internet-browser
  41. @java-platform
  42. @legacy-x
  43. @network-file-system-client
  44. @office-suite
  45. @print-client
  46. @remote-desktop-clients
  47. @server-platform
  48. @server-policy
  49. @workstation-policy
  50. @x11
  51. mtools
  52. pax
  53. python-dmidecode
  54. oddjob
  55. wodim
  56. sgpio
  57. genisoimage
  58. device-mapper-persistent-data
  59. abrt-gui
  60. samba-winbind
  61. certmonger
  62. pam_krb5
  63. krb5-workstation
  64. libXmu
  65. %end
  66. %post
  67. useradd wang
  68. echo magedu | passwd --stdin wang &> /dev/null
  69. %end

centos7应答文件

  1. [root@centos7 ksdir]#cat ks7-pxe.cfg
  2. #version=DEVEL
  3. # System authorization information
  4. auth --enableshadow --passalgo=sha512
  5. # Use CDROM installation media
  6. url --url=http://192.168.109.143/centos/7
  7. # Use graphical install
  8. firewall --disabled
  9. selinux --disabled
  10. text
  11. reboot
  12. # Run the Setup Agent on first boot
  13. firstboot --disable
  14. ignoredisk --only-use=sda
  15. # Keyboard layouts
  16. keyboard --vckeymap=us --xlayouts='us'
  17. # System language
  18. lang en_US.UTF-8
  19. # Network information
  20. network --bootproto=dhcp --device=ens33 --onboot=on --ipv6=auto --activate
  21. network --hostname=centos7.qifei.com
  22. # Root password
  23. rootpw --iscrypted $6$zvNPHt.AnyhKAFGT$GhLgXK5VyYGIgFr60TopFHzVUersaacruSe0MYnVZB4vbGNLHCDPTfbiKW1Ry.V9S9NdGis.qmnP/MSnfXt7R0
  24. # System services
  25. services --disabled="chronyd"
  26. # System timezone
  27. timezone Asia/Shanghai --isUtc --nontp
  28. user --name=fei --password=$6$wrdu0VH2CF1hufHn$FpKs8T.4z65C9HFoDiB8Z6SmERCjBJt2LGhNOvnnDhYzm4Lt58qJ2dryg8mqHvYTnGDp6igP8M0748Hx7i8XW. --iscrypted --gecos="fei"
  29. # X Window System configuration information
  30. xconfig --startxonboot
  31. # System bootloader configuration
  32. bootloader --location=mbr --boot-drive=sda
  33. # Partition clearing information
  34. zerombr
  35. clearpart --all --initlabel
  36. # Disk partitioning information
  37. part swap --fstype="swap" --ondisk=sda --size=2048
  38. part / --fstype="xfs" --ondisk=sda --size=51200
  39. part /boot --fstype="xfs" --ondisk=sda --size=1024
  40. part /app --fstype="xfs" --ondisk=sda --size=20480
  41. eula --agreed
  42. %packages
  43. @base
  44. @core
  45. @dial-up
  46. @fonts
  47. @gnome-desktop
  48. @guest-agents
  49. @guest-desktop-agents
  50. @internet-browser
  51. @multimedia
  52. @network-file-system-client
  53. @networkmanager-submodules
  54. @print-client
  55. @x11
  56. %end
  57. %addon com_redhat_kdump --disable --reserve-mb='auto'
  58. %end
  59. %anaconda
  60. pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
  61. pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
  62. pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
  63. %end
  64. %post
  65. rm -f /etc/yum.repo.d/*
  66. cat > /etc/yum.repos.d/base.repo <<EOF
  67. [base]
  68. name = centos7base
  69. baseurl = file:///misc/cd/
  70. gpgcheck = 0
  71. EOF
  72. echo magedu |passwd --stdin fei &> /dev/null
  73. %end
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注