cobbler自动安装

Cobbler无人值守

  1. 环境准备
    [[email protected] ~]# cat /etc/redhat-release
    CentOS release 6.9 (Final)
    [[email protected] ~]# uname -r
    2.6.32-696.el6.x86_64
    [[email protected] ~]# getenforce
    Disabled
    [[email protected] ~]# /etc/init.d/iptables status
    iptables: Firewall is not running.
    [[email protected] ~]# ifconfig eth0|awk -F "[ :]+" ‘NR==2 {print $4}‘
    10.0.0.100
    [[email protected] ~]# hostname
    oldboy
    [[email protected] ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

    1. cobbler安装

    1安装EPEL源
    yum install epel-release -y
    2安装cobbler
    yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes cman pykickstart –y
    3、rpm -ql cobbler # 查看安装的文件,下面列出部分。
    /etc/cobbler # 配置文件目录
    /etc/cobbler/settings # cobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序。
    /etc/cobbler/dhcp.template # DHCP服务的配置模板
    /etc/cobbler/tftpd.template # tftp服务的配置模板
    /etc/cobbler/rsync.template # rsync服务的配置模板
    /etc/cobbler/iso # iso模板配置文件目录
    /etc/cobbler/pxe # pxe模板文件目录
    /etc/cobbler/power # 电源的配置文件目录
    /etc/cobbler/users.conf # Web服务授权配置文件
    /etc/cobbler/users.digest # 用于web访问的用户名密码配置文件
    /etc/cobbler/dnsmasq.template # DNS服务的配置模板
    /etc/cobbler/modules.conf # Cobbler模块配置文件
    /var/lib/cobbler # Cobbler数据目录
    /var/lib/cobbler/config # 配置文件
    /var/lib/cobbler/kickstarts#默认存放kickstart文件
    /var/lib/cobbler/loaders # 存放的各种引导程序
    /var/www/cobbler # 系统安装镜像目录
    /var/www/cobbler/ks_mirror # 导入的系统镜像列表
    /var/www/cobbler/images # 导入的系统镜像启动文件
    /var/www/cobbler/repo_mirror # yum源存储目录
    /var/log/cobbler # 日志目录
    /var/log/cobbler/install.log # 客户端系统安装日志
    /var/log/cobbler/cobbler.log # cobbler日志

三、配置Cobbler

  1. [[email protected] ~]# /etc/init.d/httpd restart
  2. 停止 httpd:                                               [失败]
  3. 正在启动 httpd:                                           [确定]
  4. [[email protected] ~]# /etc/init.d/cobblerd start
  5. Starting cobbler daemon:                                   [确定]
  6. [[email protected] ~]# cobbler check  # 检查Cobbler的配置,如果看不到下面的结果,再次执行/etc/init.d/cobblerd restart
  7. The following are potential configuration items that you may want to fix:
  8.
  9. 1 : The ‘server‘ field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work.  This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
  10. 2 : For PXE to be functional, the ‘next_server‘ field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
  11. 3 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run ‘cobbler get-loaders‘ to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The ‘cobbler get-loaders‘ command is the easiest way to resolve these requirements.
  12. 4 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/rsync
  13. 5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
  14. 6 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to ‘cobbler‘ and should be changed, try: "openssl passwd -1 -salt ‘random-phrase-here‘ ‘your-password-here‘" to generate new one
  15. 7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
  16.
  17. Restart cobblerd and then run ‘cobbler sync‘ to apply changes.
  18.
  19. # 看着上面的结果,一个一个解决。
  20. # 第1、2、6个问题,顺便修改其他功能
  21. [[email protected] ~]# cp /etc/cobbler/settings{,.ori}  # 备份
  22.
  23. # server,Cobbler服务器的IP。
  24. sed -i ‘s/server: 127.0.0.1/server: 10.0.0.7/‘ /etc/cobbler/settings
  25.
  26. # next_server,如果用Cobbler管理DHCP,修改本项,作用不解释,看kickstart。
  27. sed -i ‘s/next_server: 127.0.0.1/next_server: 10.0.0.7/‘ /etc/cobbler/settings
  28.
  29. # 用Cobbler管理DHCP
  30. sed -i ‘s/manage_dhcp: 0/manage_dhcp: 1/‘ /etc/cobbler/settings
  31.
  32. # 防止循环装系统,适用于服务器第一启动项是PXE启动。
  33. sed -i ‘s/pxe_just_once: 0/pxe_just_once: 1/‘ /etc/cobbler/settings
  34.
  35. # 设置新装系统的默认root密码123456。下面的命令来源于提示6。random-phrase-here为干扰码,可以自行设定。
  36. [[email protected] ~]# openssl passwd -1 -salt ‘oldboy‘ ‘123456‘
  37. $1$oldboy$Npg9Pt9k98Mlg0ZeqHAuN1
  38. [[email protected] ~]# vim /etc/cobbler/settings
  39. default_password_crypted: "$1$oldboy$Npg9Pt9k98Mlg0ZeqHAuN1"
  40.
  41. # 第3个问题
  42. [[email protected] ~]# cobbler get-loaders  # 会自动从官网下载
  43. [[email protected] ~]# cd /var/lib/cobbler/loaders/  # 下载的内容
  44. [[email protected] loaders]# ls
  45. COPYING.elilo     COPYING.yaboot  grub-x86_64.efi  menu.c32    README
  46. COPYING.syslinux  elilo-ia64.efi  grub-x86.efi     pxelinux.0  yaboot
  47.
  48. # 第4个问题
  49. [[email protected] ~]# vim /etc/xinetd.d/rsync
  50. disable = no
  51. [[email protected] ~]# /etc/init.d/xinetd restart
  52. 停止 xinetd:                                              [确定]
  53. 正在启动 xinetd:                                          [确定]
  54.
  55. [[email protected] ~]# /etc/init.d/cobblerd restart
  56. Stopping cobbler daemon:                                   [确定]
  57. Starting cobbler daemon:                                   [确定]
  58. [[email protected] ~]# cobbler check
  59. The following are potential configuration items that you may want to fix:
  60.
  61. 1 : debmirror package is not installed, it will be required to manage debian deployments and repositories  # 和debian系统相关,不需要
  62. 2 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them # fence设备相关,不需要
  63. Restart cobblerd and then run ‘cobbler sync‘ to apply changes.

  1. 配置DHCP
  1. # 修改cobbler的dhcp模版,不要直接修改dhcp本身的配置文件,因为cobbler会覆盖。
  2.
  3. [[email protected] ~]# vim /etc/cobbler/dhcp.template
  4. # 仅列出修改过的字段
  5. ……
  6. subnet 10.0.0.0 netmask 255.255.255.0 {
  7.      option routers             10.0.0.2;
  8.      option domain-name-servers 10.0.0.2;
  9.      option subnet-mask         255.255.255.0;
  10.      range dynamic-bootp        10.0.0.100 10.0.0.200;
  11. ……
5、同步cobbler配置
  1. # 同步最新cobbler配置,它会根据配置自动修改dhcp等服务。
  2. [[email protected] ~]# cobbler sync   # 同步所有配置,可以仔细看一下sync做了什么。
  3. task started: 2015-12-03_204822_sync
  4. task started (id=Sync, time=Thu Dec  3 20:48:22 2015)
  5. running pre-sync triggers
  6. cleaning trees
  7. removing: /var/lib/tftpboot/pxelinux.cfg/default
  8. removing: /var/lib/tftpboot/grub/images
  9. copying bootloaders
  10. trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
  11. copying: /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
  12. trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
  13. trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
  14. trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
  15. trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
  16. trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
  17. copying distros to tftpboot
  18. copying images
  19. generating PXE configuration files
  20. generating PXE menu structure
  21. rendering DHCP files
  22. generating /etc/dhcp/dhcpd.conf
  23. rendering TFTPD files
  24. generating /etc/xinetd.d/tftp
  25. cleaning link caches
  26. running post-sync triggers
  27. running python triggers from /var/lib/cobbler/triggers/sync/post/*
  28. running python trigger cobbler.modules.sync_post_restart_services
  29. running: dhcpd -t -q
  30. received on stdout:
  31. received on stderr:
  32. running: service dhcpd restart
  33. received on stdout: 关闭 dhcpd:[确定]
  34. 正在启动 dhcpd:[确定]
  35.
  36. received on stderr:
  37. running shell triggers from /var/lib/cobbler/triggers/sync/post/*
  38. running python triggers from /var/lib/cobbler/triggers/change/*
  39. running python trigger cobbler.modules.scm_track
  40. running shell triggers from /var/lib/cobbler/triggers/change/*
  41. *** TASK COMPLETE ***
  42.
  43. # 再看一下dhcp的配置文件。
  44. [[email protected] ~]# less /etc/dhcp/dhcpd.conf
  45. # ******************************************************************
  46. # Cobbler managed dhcpd.conf file
  47. # generated from cobbler dhcp.conf template (Thu Dec  3 12:48:23 2015)
  48. # Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
  49. # in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
  50. # overwritten.
  51. # ******************************************************************
  52.
  53. ddns-update-style interim;
  54. …………
6、开机启动
  1. # 启动相关服务并设置开机启动(可选) 与第二种方法二选一
  2. chkconfig httpd on
  3. chkconfig xinetd on
  4. chkconfig cobblerd on
  5. chkconfig dhcpd on
  6. /etc/init.d/httpd restart
  7. /etc/init.d/xinetd restart
  8. /etc/init.d/cobblerd restart
  9. /etc/init.d/dhcpd restart
  1.  编写Cobbler相关服务启动脚本(可选)
  2. cat >>/etc/init.d/cobbler<<EOF
  3. #!/bin/bash
  4. # chkconfig: 345 80 90
  5. # description:cobbler
  6.
  7. case \$1 in
  8.   start)
  9.     /etc/init.d/httpd start
  10.     /etc/init.d/xinetd start
  11.     /etc/init.d/dhcpd start
  12.     /etc/init.d/cobblerd start
  13.     ;;
  14.
  15.   stop)
  16.     /etc/init.d/httpd stop
  17.     /etc/init.d/xinetd stop
  18.     /etc/init.d/dhcpd stop
  19.     /etc/init.d/cobblerd stop
  20.     ;;
  21.
  22.   restart)
  23.     /etc/init.d/httpd restart
  24.     /etc/init.d/xinetd restart
  25.     /etc/init.d/dhcpd restart
  26.     /etc/init.d/cobblerd restart
  27.     ;;
  28.
  29.   status)
  30.     /etc/init.d/httpd status
  31.     /etc/init.d/xinetd status
  32.     /etc/init.d/dhcpd status
  33.     /etc/init.d/cobblerd status
  34.     ;;
  35.
  36.   sync)
  37.     cobbler sync
  38.     ;;
  39.
  40.   *)
  41.     echo "Input error,please in put ‘start|stop|restart|status|sync‘!"
  42.     exit 2
  43.     ;;
  44.
  45. esac
  46. EOF
  47.
  48. # chmod +x /etc/init.d/cobbler
  49. # chkconfig cobbler on
7、Cobbler的命令行管理导入镜像
  1. [[email protected] ~]# cobbler
  2. usage
  3. =====
  4. cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ...
  5.         [add|edit|copy|getks*|list|remove|rename|report] [options|--help]
  6. cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validateks|version|signature|get-loaders|hardlink> [options|--help]
  7. [[email protected] ~]# cobbler import --help  # 导入镜像
  8. Usage: cobbler [options]
  9.
  10. Options:
  11.   -h, --help            show this help message and exit
  12.   --arch=ARCH           OS architecture being imported
  13.   --breed=BREED         the breed being imported
  14.   --os-version=OS_VERSION
  15.                         the version being imported
  16.   --path=PATH           local path or rsync location
  17.   --name=NAME           name, ex ‘RHEL-5‘
  18.   --available-as=AVAILABLE_AS
  19.                         tree is here, don‘t mirror
  20.   --kickstart=KICKSTART_FILE
  21.                         assign this kickstart file
  22.   --rsync-flags=RSYNC_FLAGS
  23.                         pass additional flags to rsync
  24.
  25. cobbler check    核对当前设置是否有问题
  26. cobbler list     列出所有的cobbler元素
  27. cobbler report   列出元素的详细信息
  28. cobbler sync     同步配置到数据目录,更改配置最好都要执行下
  29. cobbler reposync 同步yum仓库
  30. cobbler distro   查看导入的发行版系统信息
  31. cobbler system   查看添加的系统信息
  32. cobbler profile  查看配置信息

  1. 导入镜像
  1. [[email protected] ~]# mount /dev/cdrom /mnt/  # 挂载CentOS7的系统镜像。
  2. # 导入系统镜像
  3. [[email protected] ~]# cobbler import --path=/mnt/ --name=CentOS-7.1-x86_64 --arch=x86_64
  4. # --path 镜像路径
  5. # --name 为安装源定义一个名字
  6. # --arch 指定安装源是32位、64位、ia64, 目前支持的选项有: x86│x86_64│ia64
  7. # 安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是:CentOS-7.1-x86_64,如果重复,系统会提示导入失败。
  8.
  9. [[email protected] ~]# cobbler distro list  # 查看镜像列表
  10.    CentOS-7.1-x86_64
  11.
  12. # 镜像存放目录,cobbler会将镜像中的所有安装文件拷贝到本地一份,放在/var/www/cobbler/ks_mirror下的CentOS-7.1-x86_64目录下。因此/var/www/cobbler目录必须具有足够容纳安装文件的空间。
  13. [[email protected] ~]# cd /var/www/cobbler/ks_mirror/
  14. [[email protected] ks_mirror]# ls
  15. CentOS-7.1-x86_64  config
  16. [[email protected] ks_mirror]# ls CentOS-7.1-x86_64/
  17. CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
  18. EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7
  19. EULA             isolinux  repodata  TRANS.TBL

  1. 指定ks.cfg文件及调整内核参数
查看默认配置
  1. # Cobbler的ks.cfg文件存放位置
  2. [[email protected] ks_mirror]# cd /var/lib/cobbler/kickstarts/
  3. [[email protected] kickstarts]# ls  # 自带很多
  4. default.ks    install_profiles  sample_autoyast.xml  sample_esxi4.ks  sample_old.seed
  5. esxi4-ks.cfg  legacy.ks         sample_end.ks(默认使用的ks文件)        sample_esxi5.ks  sample.seed
  6. esxi5-ks.cfg  pxerescue.ks      sample_esx4.ks       sample.ks

上传自定义的ks文件
  1. [[email protected] kickstarts]# rz  # 上传准备好的ks文件
  2. rz waiting to receive.
  3. Starting zmodem transfer.  Press Ctrl+C to cancel.
  4. Transferring Cobbler-CentOS-7.1-x86_64.cfg...
  5.   100%       1 KB       1 KB/sec    00:00:01       0 Errors
  6.
  7. [[email protected] kickstarts]# mv Cobbler-CentOS-7.1-x86_64.cfg CentOS-7.1-x86_64.cfg
  8.
  9. # 在第一次导入系统镜像后,Cobbler会给镜像指定一个默认的kickstart自动安装文件在/var/lib/cobbler/kickstarts下的sample_end.ks。
查看导入镜像设置及同步
  1. [[email protected] ~]# cobbler list
  2. distros:
  3.    CentOS-7.1-x86_64
  4.
  5. profiles:
  6.    CentOS-7.1-x86_64
  7.
  8. systems:
  9.
  10. repos:
  11.
  12. images:
  13.
  14. mgmtclasses:
  15.
  16. packages:
  17.
  18. files:
  19.
  20. # 查看安装镜像文件信息
  21. [[email protected] ~]# cobbler distro report --name=CentOS-7.1-x86_64
  22. Name                           : CentOS-7.1-x86_64
  23. Architecture                   : x86_64
  24. TFTP Boot Files                : {}
  25. Breed                          : redhat
  26. Comment                        :
  27. Fetchable Files                : {}
  28. Initrd                         : /var/www/cobbler/ks_mirror/CentOS-7.1-x86_64/images/pxeboot/initrd.img
  29. Kernel                         : /var/www/cobbler/ks_mirror/CentOS-7.1-x86_64/images/pxeboot/vmlinuz
  30. Kernel Options                 : {}
  31. Kernel Options (Post Install)  : {}
  32. Kickstart Metadata             : {‘tree‘: ‘http://@@[email protected]@/cblr/links/CentOS-7.1-x86_64‘}
  33. Management Classes             : []
  34. OS Version                     : rhel7
  35. Owners                         : [‘admin‘]
  36. Red Hat Management Key         : <<inherit>>
  37. Red Hat Management Server      : <<inherit>>
  38. Template Files                 : {}
  39.
  40. # 查看所有的profile设置
  41. [[email protected] ~]# cobbler profile report
  42.
  43. # 查看指定的profile设置
  44. [[email protected] ~]# cobbler profile report --name=CentOS-7.1-x86_64
  45. Name                           : CentOS-7.1-x86_64
  46. TFTP Boot Files                : {}
  47. Comment                        :
  48. DHCP Tag                       : default
  49. Distribution                   : CentOS-7.1-x86_64
  50. Enable gPXE?                   : 0
  51. Enable PXE Menu?               : 1
  52. Fetchable Files                : {}
  53. Kernel Options                 : {}
  54. Kernel Options (Post Install)  : {}
  55. Kickstart                      : /var/lib/cobbler/kickstarts/sample_end.ks  -->默认ks文件
  56. Kickstart Metadata             : {}
  57. Management Classes             : []
  58. Management Parameters          : <<inherit>>
  59. Name Servers                   : []
  60. Name Servers Search Path       : []
  61. Owners                         : [‘admin‘]
  62. Parent Profile                 :
  63. Internal proxy                 :
  64. Red Hat Management Key         : <<inherit>>
  65. Red Hat Management Server      : <<inherit>>
  66. Repos                          : []
  67. Server Override                : <<inherit>>
  68. Template Files                 : {}
  69. Virt Auto Boot                 : 1
  70. Virt Bridge                    : xenbr0
  71. Virt CPUs                      : 1
  72. Virt Disk Driver Type          : raw
  73. Virt File Size(GB)             : 5
  74. Virt Path                      :
  75. Virt RAM (MB)                  : 512
  76. Virt Type                      : kvm
  77.
  78. # 编辑profile,修改关联的ks文件
  79. [[email protected] ~]# cobbler profile edit --name=CentOS-7.1-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7.1-x86_64.cfg
  80.
  81. # 修改安装系统的内核参数,在CentOS7系统有一个地方变了,就是网卡名变成eno16777736这种形式,但是为了运维标准化,我们需要将它变成我们常用的eth0,因此使用下面的参数。但要注意是CentOS7才需要下面的步骤,CentOS6不需要。
  82. [[email protected] ~]# cobbler profile edit --name=CentOS-7.1-x86_64 --kopts=‘net.ifnames=0 biosdevname=0‘
  83.
  84. [[email protected] ~]# cobbler profile report CentOS-7.1-x86_64
  85. Name                           : CentOS-7.1-x86_64
  86. TFTP Boot Files                : {}
  87. Comment                        :
  88. DHCP Tag                       : default
  89. Distribution                   : CentOS-7.1-x86_64
  90. Enable gPXE?                   : 0
  91. Enable PXE Menu?               : 1
  92. Fetchable Files                : {}
  93. Kernel Options                 : {‘biosdevname‘: ‘0‘, ‘net.ifnames‘: ‘0‘}
  94. Kernel Options (Post Install)  : {}
  95. Kickstart                      : /var/lib/cobbler/kickstarts/CentOS-7.1-x86_64.cfg
  96. Kickstart Metadata             : {}
  97. Management Classes             : []
  98. Management Parameters          : <<inherit>>
  99. Name Servers                   : []
  100. Name Servers Search Path       : []
  101. Owners                         : [‘admin‘]
  102. Parent Profile                 :
  103. Internal proxy                 :
  104. Red Hat Management Key         : <<inherit>>
  105. Red Hat Management Server      : <<inherit>>
  106. Repos                          : []
  107. Server Override                : <<inherit>>
  108. Template Files                 : {}
  109. Virt Auto Boot                 : 1
  110. Virt Bridge                    : xenbr0
  111. Virt CPUs                      : 1
  112. Virt Disk Driver Type          : raw
  113. Virt File Size(GB)             : 5
  114. Virt Path                      :
  115. Virt RAM (MB)                  : 512
  116. Virt Type                      : kvm
  117.
  118. # 每次修改完都要同步一次
  119. [[email protected] ~]# cobbler sync

1. 安装系统

新建一台虚拟机,不解释,开机就可以看到下面的图片

  1. #修改Cobbler提示
  2. [[email protected] ~]# vim /etc/cobbler/pxe/pxedefault.template
  3. MENU TITLE Cobbler | http://www.zyops.com 可以修改成自己的网站
  4. [[email protected] ~]# cobbler sync # 修改配置都要同步
      拓展

    ks.cfg文件解析

  5. [[email protected] kickstarts]# cat CentOS-7.1-x86_64.cfg
  6. Cobbler for Kickstart Configurator for CentOS 7.1 by yao zhang

  7. install
  8. url --url=$tree # 这些$开头的变量都是调用配置文件里的值。
  9. text
  10. lang en_US.UTF-8
  11. keyboard us
  12. zerombr
  13. bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
  14. Network information

  15. $SNIPPET(‘network_config‘)
  16. timezone --utc Asia/Shanghai
  17. authconfig --enableshadow --passalgo=sha512
  18. rootpw --iscrypted $default_password_crypted
  19. clearpart --all --initlabel
  20. part /boot --fstype xfs --size 1024 # CentOS7系统磁盘默认格式xfs
  21. part swap --size 1024
  22. part / --fstype xfs --size 1 --grow
  23. firstboot --disable
  24. selinux --disabled
  25. firewall --disabled
  26. logging --level=info
  27. reboot
  28. %pre
  29. $SNIPPET(‘log_ks_pre‘)
  30. $SNIPPET(‘kickstart_start‘)
  31. $SNIPPET(‘pre_install_network_config‘)
  32. Enable installation monitoring

  33. $SNIPPET(‘pre_anamon‘)
  34. %end
  35. %packages
  36. @base
  37. @compat-libraries
  38. @debugging
  39. @development
  40. tree
  41. nmap
  42. sysstat
  43. lrzsz
  44. dos2unix
  45. telnet
  46. iptraf
  47. ncurses-devel
  48. openssl-devel
  49. zlib-devel
  50. OpenIPMI-tools
  51. screen
  52. %end
  53. %post
  54. systemctl disable postfix.service
  55. %end

定制化安装
指定某台服务器使用指定ks文件
分一台服务器的最简单的方法就是物理MAC地址。
物理服务器的MAC地址在服务器上的标签上写了。
虚拟机的MAC查看

  1. cobbler system add --name=oldboy --mac=00:0C:29:30:07:75--profile=CentOS-7.1-x86_64 --ip-address=10.0.0.100--subnet=255.255.255.0 --gateway=10.0.0.100 --interface=eth0 --static=1 --hostname=oldboy.example.com --name-servers="114.114.114.114 8.8.8.8"
  2. #--name 自定义,但不能重复
  3. #查看定义的列表
  4. [[email protected] ~]# cobbler system list
  5. Wbe01 (主机名)
  6. [[email protected] ~]# cobbler sync
    下次在开机或重启就会自动安装了

    Cobbler的Web管理界面的安装与配置
    已经安装cobbler-web软件的环境下。
    访问网址:http://10.0.0.100/cobbler_web和https://10.0.0.100/cobbler_web
    默认用户名:cobbler
    默认密码 :cobbler

  7. /etc/cobbler/users.conf # Web服务授权配置文件
  8. /etc/cobbler/users.digest # 用于web访问的用户名密码配置文件
  9. [[email protected] ~]# cat /etc/cobbler/users.digest
  10. cobbler:Cobbler:a2d6bae81669d707b72c0bd9806e01f3
  11. #设置Cobbler web用户登陆密码
  12. #在Cobbler组添加cobbler用户,提示输入2遍密码确认
  13. [[email protected] ~]# htdigest /etc/cobbler/users.digest "Cobbler" cobbler
  14. Changing password for user cobbler in realm Cobbler
  15. New password: 123456
  16. Re-type new password:123456
  17. [[email protected] ~]# cobbler sync
  18. [[email protected] ~]# /etc/init.d/httpd restart
  19. 停止 httpd: [确定]
  20. 正在启动 httpd: [确定]
  21. [[email protected] ~]# /etc/init.d/cobblerd restart
  22. Stopping cobbler daemon: [确定]
  23. Starting cobbler daemon: [确定]
    以后就需要用123456这个密码登录了。

温馨提示:安装的系统内存要2G以上哦

原文地址:https://blog.51cto.com/13528668/2444923

时间: 2024-11-06 09:31:28

cobbler自动安装的相关文章

Cobbler自动安装的Linux系统ssh无法进入

Linux ssh登陆老提示“permission denied,please try again” ,但是iptables已经关掉了 修改/etc/ssh/sshd_config文件.找如下的一句 #PermitRootLogin yes 改为如下的 PermitRootLogin yes 注意,要把前面的#号去掉. 重启sshd服务器 # service sshd restart Cobbler自动安装的Linux系统ssh无法进入,布布扣,bubuko.com

cobbler自动安装系统

一.cobbler工作流程 远程裸机开机启动网络启动,开机后会广播给DHCP服务器,分配给远程主机一个IP地址 拿到IP地址后,远程主机向cobbler server发送请求OS启动文件的请求. cobbler服务器告诉远程主机OS应到文件的名字,和 TFTP 服务器的IP地址和端口. 远程主机根据IP地址和端口,到TFTP 服务器上下载引导文件. 远程主机执行OS引导文件,加载信息和menu.c32,启动选择菜单,选择要安装的OS,然后向cobbler服务器请求 kickstart 文件和OS

Cobbler 自动安装 配置

自动化安装适用于IDC机房批量安装服务器: 现在我们的自动化安装的方法有两种:今天我们来实现一下Cobbler的配置: 1.PXE,这种配置起来比较麻烦: 2.Cobbler,这种批量安装的方法,也是基于PEX结构执行的,但是Cobbler省去了我们配置文件的步骤,都交给了Cobbler来完成: 1)安装软件:查看服务是否启动 [[email protected] ~]# yum install tftp-server rsync xinetd httpd dhcp [[email protec

linux cobbler 自动安装centos6与centos7系统

1.1 Cobbler介绍 Cobbler 是一个免费开源系统安装部署软件,用于自动化网络安装操作系统. Cobbler 集成了 DNS, DHCP, 软件包更新,带外管理以及配置管理,方便操作系统安装自动化. Cobbler 可以支持PXE启动, 操作系统重新安装,以及虚拟化客户机创建,包括Xen, KVM or VMware.  Cobbler 透过koan程序以支持虚拟化客户机安装. Cobbler 可以支持管理复杂网路环境,如建立在链路聚合以太网的桥接环境. 1.2 cobbler 服务

cobbler自动安装操作系统

cobbler介绍 快速网络安装linux操作系统的服务,支持众多的Linux发行版: Red Hat, Fedora,CentOS,Debian,Ubuntu和SuSE 也可以支持网络安装windows PXE的二次封装,将多种安装参数封装到一个菜单 Python编写 提供了CLI和Web的管理形式 cobbler软件包来源于epel源中的软件包 cobbler 服务集成 cobbler可以和以下服务一起集成来对外提供服务  但是cobbler不能代替以下服务 PXE DHCP rsync H

使用cobbler自动安装操作系统(CentOS版)

Cobbler是简便的批量部署操作系统的工具,不仅操作不需要太复杂,而且使用cobbler还能在多个主机上部署多个操作系统,甚是方便. 部署cobbler需要依赖的组件有tftp服务器.dhcp服务器.rsync必要的时候还需要用到dns服务器. 本文就展示一下,多服务集于一个主机部署的cobbler. 文中所使用的工具有VMware虚拟机,两个虚拟主机,一个CentOS-6.5-x86_64系统镜像.部署环境:CentOS6.5-x86_64环境. 前提:由于cobbler需要依赖epel环境

Cobbler自动安装*nix系统

依赖软件:    yum install epel dhcp tftp rysnc xinetd httpd -y 关闭selinux: 临时关闭:       setenforce 0 永久关闭:       sed -i 's/SELINUX=.*/SELINUX=disable/g' /etc/selinux/config 安装cobbler:    yum install cobbler 配置xinetd启动tftp:/etc/xinetd.d/tftp 在DHCP服务器配置子网 cob

Cobbler自动安装RHEL7.3

1.实验环境 cobbler服务器: CentOS7.0 64位 IP地址: 192.168.126.120? 子网掩码: 255.255.255.0 2.Cobbler安装配置 2.1 安装CentOS7(略) 2.2 关闭SELinux [[email protected] ~]# vim /etc/selinux/config SELINUX=disabled 或者 [[email protected] ~]# sed -i 's/SELINUX=.*/SELINUX=disabled/g

基于centos7系列cobbler自动安装配置

基于centos7.6的脚本,centos7应该都是适用的,执行脚本前提保持能正常访问公网,能正常使用yum安装软件示例ks配置文件centos7.6ks.cfg默认清空磁盘sda的mbr以及所有分区,需要注意可以根据ks配置模板,自定义添加删除软件包,调整分区大小,添加自定义命令等 #!/bin/bash #==================================================== # Author: Mr.Song # Create Date: 2019-10-