cobbler自动化安装系统

简介: 笔者Q:972581034 交流群:605799367。有任何疑问可与笔者或加群交流在很久很久以前,使用kickstart实现自动化安装的时候,我一直认为装系统是多么高大上的活,直到cobbler的出现,让自动化批量安装系统变得如此简单。

笔者Q:972581034 交流群:605799367。有任何疑问可与笔者或加群交流

  • 在很久很久以前,使用kickstart实现自动化安装的时候,我一直认为装系统是多么高大上的活,直到cobbler的出现,让自动化批量安装系统变得如此简单。嘿嘿。现在隔壁办公室的财务妹妹都跟我学会了装系统。
  • cobbler是基于kickstart来实现自动化安装系统的,cobbler实质是把kickstart经过封装后,以web界面的方式,可以让我们以简单粗暴的方式自定义自已的系统。

安装cobbler

命令行的操作

需要epel源

yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd
[root@CentOS6 ~]# cobbler check   #检查还有哪些步骤需要做
The following are potential configuration items that you may want to fix:

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.    #设置server端Ip地址
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 128.0.0.1, and should match the IP of the boot server on the PXE network.   #PXE设置
3 : change 'disable' to 'no' in /etc/xinetd.d/tftp  #把disable改为no
4 : 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.  #需要下载,运行cobbler get-loaders即可
5 : change 'disable' to 'no' in /etc/xinetd.d/rsync  #disable改为no
6 : file /etc/xinetd.d/rsync does not exist  #没有这个文件
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories  #可忽略
8 : 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  #提示需要修改root密码
9 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them  #高可用软件,也可以忽略

Restart cobblerd and then run 'cobbler sync' to apply changes.


cp /etc/cobbler/settings{,.ori} #备份
sed -i 's/server: 127.0.0.1/server: 172.16.1.101/' /etc/cobbler/settings #解决第一项
sed -i 's/next_server: 127.0.0.1/next_server: 172.16.1.101/' /etc/cobbler/settings #
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings #让cobbler管理dhcp服务
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings #禁止无限重装统
sed -ri "/default_password_crypted/s#(.: ).#\1"`openssl passwd -1 -salt 'oldboy' '123456'`"#" /etc/cobbler/settings #设置密码内嵌命令openssl passwd -1 -salt 'oldboy' '123456'
sed -i 's#yes#no#' /etc/xinetd.d/rsync #把所有yes改为no
sed -i 's#yes#no#' /etc/xinetd.d/tftp #把yes改为no


把下载好的命令传过来解压,由于从官方下载太慢,所以这里使用下载好的直接解压
[root@CentOS6 ~]# rz -E
rz waiting to receive.
[root@CentOS6 ~]# ls
anaconda-ks.cfg  cobbler_load.tar.gz  install.log  install.log.syslog
[root@CentOS6 ~]# tar xfP cobbler_load.tar.gz

[root@CentOS6 ~]# cobbler sync
task started: 2017-04-12_172139_sync
task started (id=Sync, time=Wed Apr 12 17:21:39 2017)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

[root@CentOS6 ~]# /etc/init.d/xinetd restart
Stopping xinetd:                                           [FAILED]
Starting xinetd:                                           [  OK  ]
[root@CentOS6 ~]# /etc/init.d/cobblerd restart
Stopping cobbler daemon:                                   [  OK  ]
Starting cobbler daemon:                                   [  OK  ]
[root@CentOS6 ~]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: httpd: apr_sockaddr_info_get() failed for CentOS6
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                           [  OK  ]
sed -i 's#192.168.1#172.16.1#g;22d;23d' /etc/cobbler/dhcp.template   #修改DHCP模版,删除网关,删除DNS

检查cobbler

现在只有三处错误了,可以忽略
[root@CentOS6 ~]# cobbler check
The following are potential configuration items that you may want to fix:

1 : file /etc/xinetd.d/rsync does not exist #这个是程序bug
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
3 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

Restart cobblerd and then run 'cobbler sync' to apply changes.

检查端口

[root@CentOS6 ~]# ss -luntp|grep dhcp
[root@CentOS6 ~]# cobbler sync #把所有更改做同步

注意:一个局域网只能有一个dhcp

挂载

[root@CentOS6 ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only

接下来进行web界面的操作
在浏览器输入http://ip/cobbler_web即可访问

web界面

1.导入镜像

  • 挂载
    img_a50f87a1e8fc8df397a0e7ca9619b0dd.jpg

    [root@CentOS6 ~]# mount /dev/cdrom /mnt
    mount: block device /dev/sr0 is write-protected, mounting read-only
    [root@CentOS6 ~]# ps -ef|grep rsync      #通过rsync进行导入的
    root      25266   1582 15 17:30 ?        00:00:06 rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS6.8-x86_64 --progress
    root      25267  25266  0 17:30 ?        00:00:00 rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS6.8-x86_64 --progress
    root      25268  25267 11 17:30 ?        00:00:05 rsync -a /mnt/ /var/www/cobbler/ks_mirror/CentOS6.8-x86_64 --progress

    img_152f07d76aea92f221fc81edec86adbe.jpg

2.如何让cobbler下载yum源

  • 导入yum源

img_565d272ccd667d6c6f473e02f1f46b00.jpg

img_bf6be2bb67ec91ebe170946fc5161d4c.jpg


[root@CentOS6 ~]# cd /var/www/cobbler/repo_mirror/
[root@CentOS6 repo_mirror]# ls
oldboyedu
  • 使用公网yum源的方法
    img_a57255562c12ea1e4b6ad3d1e8e9166d.png

  • 装系统的时候关联到本地yum源
    img_f2107b12b5d147df7813c142954a9bcb.jpg

    到这一步即可完成以默认的方式安装系统

  • 自定义模版

    1.创建模版文件

    img_02700dbb0d9d36aa630d35438365c6d1.jpg
    img_727bde73068b2233c1dce8eef0b04a6f.jpg

2.创建自定义模版

img_ca3e7a35896241a7234775094905b2bf.jpg

img_a10c77250e0f7c9f2637a872c73cc801.jpg
img_a480ed2fb0f1bb110ddaea6a17654ecb.jpg

img_01ab341dfc26e74c8e9bb4a93a0dd2ad.jpg

img_b6e3db83fca5742242a5b276cbf367ad.jpg

3.同步实据到服务器端
  • 开机后就可以喝咖啡了

img_e0e5d1751ea5822677c8e45fd078178b.jpg

kickstart无人值守:http://www.cnblogs.com/Csir/p/6699881.html

目录
相关文章
|
1月前
|
运维 Prometheus 监控
构建高效自动化运维系统的关键策略
【2月更文挑战第30天】随着云计算和微服务架构的兴起,现代IT运维环境变得愈加复杂多变。为保持业务连续性、提高响应速度并降低成本,企业亟需构建一个高效的自动化运维系统。本文将深入探讨自动化运维系统构建过程中的关键策略,包括工具和技术选型、流程优化、监控与告警体系搭建以及持续集成/持续部署(CI/CD)实践,旨在为读者提供一个清晰的构建蓝图和实用的实施建议。
|
3月前
|
数据可视化 Linux 网络安全
CentOS7.9下离线安装OctoMation编排自动化SOAR开源社区免费版
CentOS7.9下离线安装OctoMation编排自动化SOAR开源社区免费版
61 0
|
1月前
|
人工智能 运维 监控
构建高性能微服务架构:现代后端开发的挑战与策略构建高效自动化运维系统的关键策略
【2月更文挑战第30天】 随着企业应用的复杂性增加,传统的单体应用架构已经难以满足快速迭代和高可用性的需求。微服务架构作为解决方案,以其服务的细粒度、独立性和弹性而受到青睐。本文将深入探讨如何构建一个高性能的微服务系统,包括关键的设计原则、常用的技术栈选择以及性能优化的最佳实践。我们将分析微服务在处理分布式事务、数据一致性以及服务发现等方面的挑战,并提出相应的解决策略。通过实例分析和案例研究,我们的目标是为后端开发人员提供一套实用的指南,帮助他们构建出既能快速响应市场变化,又能保持高效率和稳定性的微服务系统。 【2月更文挑战第30天】随着信息技术的飞速发展,企业对于信息系统的稳定性和效率要求
|
4月前
|
XML Prometheus 运维
自动化监控有哪些开源系统
自动化监控有哪些开源系统
68 1
|
1月前
|
机器学习/深度学习 测试技术 API
iOS系统下轻松构建自动化数据收集流程
iOS系统下轻松构建自动化数据收集流程
26 0
|
1月前
|
弹性计算 运维 Kubernetes
云原生K8S场景自动化响应ECS系统事件
客户云原生K8S场景下,通过社区开源NPD+Draino+Autoscaler零开发,对接响应ECS主动运维事件,通过自动响应事件减少非预期宕机。
|
2月前
|
机器学习/深度学习 人工智能 安全
PyRIT:主动发现生成式 AI 系统潜在风险的开放式自动化框架
【2月更文挑战第9天】PyRIT:主动发现生成式 AI 系统潜在风险的开放式自动化框架
21 3
PyRIT:主动发现生成式 AI 系统潜在风险的开放式自动化框架
|
2月前
|
安全 C# 开发者
.NET开源的一键自动化下载、安装、激活Microsoft Office利器
.NET开源的一键自动化下载、安装、激活Microsoft Office利器
|
2月前
|
机器人 Linux 数据安全/隐私保护
Python办公自动化【Windows中定时任务、OS/linux 系统定时任务 、Python 钉钉发送消息、Python 钉钉发送图片】(九)-全面详解(学习总结---从入门到深化)
Python办公自动化【Windows中定时任务、OS/linux 系统定时任务 、Python 钉钉发送消息、Python 钉钉发送图片】(九)-全面详解(学习总结---从入门到深化)
66 0
|
3月前
|
Linux iOS开发 MacOS
Python 自动化指南(繁琐工作自动化)第二版:附录 A:安装第三方模块
Python 自动化指南(繁琐工作自动化)第二版:附录 A:安装第三方模块
25 0

热门文章

最新文章