Centos 部署Cobbler系统

一.简介

Cobbler 可以用来快速建立 Linux 网络安装环境,它已将 Linux 网络安装的技术门槛,从大专以上文化水平,成功降低到初中以下,连补鞋匠都能学会。(~..~)

二.安装环境以及资源

  1. 系统:centos 6.5   IP:192.168.30.158/24
  2. 自动安装镜像:CentOS-6.5-x86_64-bin-DVD1.iso

三.安装步骤

  1. 安装epel源:

    [[email protected] ~]# rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

  2. 安装DHCP、tftp,rsync,xinetd,httpd(这些都是所需要的,如果有则不需要安装。)

    [[email protected] ~]# yum -y install dhcp tftp rsync xinetd httpd

  3. 安装cobbler

    [[email protected] ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

  4. [[email protected] ~]# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
  5. [[email protected] ~]# yum install cobbler
  6. 安装cobbler完成后,重启cobblerd。还暂时不能使用,我们可以运行一下这个命令,检查一下。可以看到的错误信息

    [[email protected] ~]# cobbler checkThe following are potential configuration items that you may want to fix:

  7. 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.
  8. 2 : For PXE to be functional, the ‘next_server‘ field in /etc/cobbler/settings must be set to something other than127.0.0.1, and should match the IP of the boot server on the PXE network.
  9. 3 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/tftp
  10. 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.
  11. 5 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/rsync
  12. 6 : comment out ‘dists‘ on /etc/debmirror.conf for proper debian support7 : comment out ‘arches‘ on /etc/debmirror.conf for proper debian support8 : 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 oneRestart cobblerd and then run ‘cobbler sync‘ to apply changes.
  13. 现在就一个一个的来解决以上的错误条目。
  • 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.
    上面提示需要修改cobbler服务器的ip地址。配置文件是/etc/cobbler/settings.找到

    [[email protected] ~]# vim /etc/cobbler/settingsserver: 192.168.30.158next_server: 192.168.30.158

  • 2 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/tftp  修改disable 为 no

    [[email protected] ~]# vi /etc/xinetd.d/tftp

  • # default: off
  • # description: The tftp server serves files using the trivial file transfer \
  • # protocol. The tftp protocol is often used to boot diskless \
  • # workstations, download configuration files to network-aware printers, \
  • # and to start the installation process for some operating systems.
  • service tftp{
  • socket_type      = dgram
  • protocol         = udp
  • wait             = yes
  • user             = root
  • server           = /usr/sbin/in.tftpd
  • server_args      = -s /var/lib/tftpboot
  • disable          = no
  • per_source       = 11
  • cps              = 100 2
  • flags            = IPv4
  • }
  • 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.

    [[email protected] ~]# cobbler get-loaders

  • task started: 2015-08-26_161520_get_loaders
  • task started (id=Download Bootloader Content, time=Wed Aug 26 16:15:20 2015)
  • downloading http://cobbler.github.com/loaders/README to /var/lib/cobbler/loaders/README
  • downloading http://cobbler.github.com/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
  • downloading http://cobbler.github.com/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
  • downloading http://cobbler.github.com/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
  • downloading http://cobbler.github.com/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
  • downloading http://cobbler.github.com/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
  • downloading http://cobbler.github.com/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
  • downloading http://cobbler.github.com/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
  • downloading http://cobbler.github.com/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
  • downloading http://cobbler.github.com/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi*** TASK COMPLETE ***
  • 4 : 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
  • [[email protected] ~]# openssl passwd -1 -salt ‘222222‘ ‘999999‘
  • $1$222222$D38AxheCTHf/nVAzlN0.z0
  • 此处按提示操作,最后一个生成的“999999”密码,是cobbler客户端安装完系统后的root密码。生成后的密码$1$222222$D38AxheCTHf/nVAzlN0.z0需要写入下面的文件内:/etc/cobbler/settings内

    [[email protected] ~]# vim /etc/cobbler/settings

  • default_password_crypted: "$1$222222$D38AxheCTHf/nVAzlN0.z0"
  • 5 : comment out ‘dists‘ on /etc/debmirror.conf for proper debian support;comment out ‘arches‘ on /etc/debmirror.conf for proper debian support

    [[email protected] ~]# vim /etc/debmirror.conf#@dists="sid";#@arches="i386";

    找到以上两行,并注释掉这两句。

  • 6 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/rsync  修改disable 为 no

    [[email protected] ~]# vi /etc/xinetd.d/rsync

  • # default: off
  • # description: The rsync server is a good addition to an ftp server, as it \
  • #      allows crc checksumming etc.
  • service rsync
  • {
  • disable = no
  • flags = IPv6
  • socket_type = stream
  • wait = no
  • user = root
  • server = /usr/bin/rsync
  • server_args = --daemon
  • log_on_failure += USERID
  • }
  • 7:将上述错误修改完毕后,重启下cobblerd服务,再次运行cobbler check检查,出现以下便表示前面几条的提示已经被解决了。

    [[email protected] ~]# service cobblerd restart

  • Stopping cobbler daemon: [ OK ]
  • Starting cobbler daemon: [ OK ]
  • [[email protected] ~]# cobbler checkNo configuration problems found. All systems go.
  • 8:修改cobbler配置文件,让cobbler来接管DHCP的目的
  • [[email protected] ~]# vi /etc/cobbler/settingsmanage_dhcp: 1
  • 9:修改DHCP配置模板,修改成如下配置(根据自己的网络环境配置)

    [[email protected] ~]# vi /etc/cobbler/dhcp.template

  • subnet 192.168.30.0 netmask 255.255.255.0 {
  • option routers 192.168.30.1;
  • option domain-name-servers 192.168.30.1;
  • option subnet-mask 255.255.255.0;
  • range dynamic-bootp 192.168.30.100 192.168.30.254;
  • default-lease-time 21600;
  • max-lease-time 43200;
  • next-server $next_server;
  • 10:安装光盘已经放在光驱里了,现在需要创建文件,然后挂载到电脑上。

    [[email protected] ~]# mkdir -p /cobbler/ISO

  • [[email protected] /]# mount /dev/cdrom /cobbler/ISO/
  • mount: block device /dev/sr0 is write-protected, mounting read-only

    之后导入安装镜像。

    [[email protected] ~]# cobbler import --path=/cobbler/ISO/ --name=CentOS-6.5_86x64

  • task started: 2015-08-26_181805_import
  • task started (id=Media import, time=Wed Aug 26 18:18:05 2015)
  • Found a candidate signature: breed=redhat, version=rhel6
  • Found a matching signature: breed=redhat, version=rhel6
  • Adding distros from path /var/www/cobbler/ks_mirror/CentOS-6.5_86x64:
  • creating new distro: CentOS-6.5_86x64-x86_64
  • trying symlink: /var/www/cobbler/ks_mirror/CentOS-6.5_86x64 -> /var/www/cobbler/links/CentOS-6.5_86x64-x86_64
  • creating new profile: CentOS-6.5_86x64-x86_64
  • associating repos
  • checking for rsync repo(s)
  • checking for rhn repo(s)
  • checking for yum repo(s)
  • starting descent into /var/www/cobbler/ks_mirror/CentOS-6.5_86x64 for CentOS-6.5_86x64-x86_64
  • processing repo at : /var/www/cobbler/ks_mirror/CentOS-6.5_86x64
  • need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS-6.5_86x64
  • looking for /var/www/cobbler/ks_mirror/CentOS-6.5_86x64/repodata/*comps*.xml
  • Keeping repodata as-is :/var/www/cobbler/ks_mirror/CentOS-6.5_86x64/repodata
  • *** TASK COMPLETE ***
  • 11: 现在同步cobbler

    [[email protected] ~]# cobbler sync

  • task started: 2015-08-26_182224_sync
  • task started (id=Sync, time=Wed Aug 26 18:22:24 2015)
  • running pre-sync triggers
  • cleaning trees
  • removing: /var/www/cobbler/images/CentOS-6.5_86x64-x86_64
  • removing: /var/lib/tftpboot/pxelinux.cfg/default
  • removing: /var/lib/tftpboot/grub/efidefault
  • removing: /var/lib/tftpboot/grub/images
  • removing: /var/lib/tftpboot/images/CentOS-6.5_86x64-x86_64
  • removing: /var/lib/tftpboot/s390x/profile_list
  • 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 /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
  • trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
  • copying distros to tftpboot
  • copying files for distro: CentOS-6.5_86x64-x86_64
  • trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.5_86x64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/CentOS-6.5_86x64-x86_64/vmlinuz
  • trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.5_86x64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/CentOS-6.5_86x64-x86_64/initrd.img
  • copying images
  • generating PXE configuration files
  • generating PXE menu structure
  • copying files for distro: CentOS-6.5_86x64-x86_64
  • trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.5_86x64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/CentOS-6.5_86x64-x86_64/vmlinuz
  • trying hardlink /var/www/cobbler/ks_mirror/CentOS-6.5_86x64/images/pxeboot/initrd.img -> /var/www/cobbler/images/CentOS-6.5_86x64-x86_64/initrd.img
  • Writing template files for CentOS-6.5_86x64-x86_64
  • rendering TFTPD files
  • generating /etc/xinetd.d/tftp
  • processing boot_files for distro: CentOS-6.5_86x64-x86_64
  • 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 ***

    重启一下

  • [[email protected] cobbler]# /etc/init.d/xinetd restart
  • Stopping xinetd: [ OK ]
  • Starting xinetd: [ OK ]
  • 12:现在配置基本上已经完成了,可以达到自动装机的效果了。(可能生产环境中需要修改一些环境变量,或者预安装的软件包)

四.现在测试一下

  • 开机,选择网卡启动
  • 之后在出现的系统菜单中,选择所需要安装的系统
  • 选择Centos6.5后即可自动进行安装。

    文中可能有遗漏之处,还请提出,如果转载,还请注明源地址!谢谢....

每个人都应是守望者,守望我们的心智,我们的理想,以防它在生活中不知不觉地坠落、被操控和被自己遗忘。。。

时间: 2024-10-13 00:06:18

Centos 部署Cobbler系统的相关文章

Cobbler全自动批量安装部署Linux系统

前言:这篇文章是系统运维www.osyunwei.com的作品,我只是根据实践了一下,出于对原作者的尊重附原文链接如下: 原文链接:http://www.osyunwei.com/archives/7606.html 根据文章的说明是可以完成所属功能的,不过原文章有点小问题,在本文中我已经修改过了,仅供大家参考,有问题大家交流,E-mail:[email protected] 安装之前的一点说明 Cobbler服务器系统:CentOS5.10 64位 IP地址:192.168.21.128 需要

详解使用Cobbler快速批量部署linux系统

前言:这几天闲着没事来系统组玩玩,学点东西总是好的嘛.系统组系统组当然还是从学会装系统开始.花了两个小时折腾了一下用cobbler批量部署linux系统.第一次做当然中间遇到很多问题,不过都顺利解决了.完了总结一下写个帖子和大家分享一下. 系统版本:Centos6.5 32位cobbler服务器IP:192.168.175.130 IP地址段:192.168.175.120-192.168.175.140子网掩码:255.255.255.0网关:192.168.175.2DNS:8.8.8.8

cobbler 批量自动化部署 Linux 系统

实验介绍:Cobbler自动化部署linux系统,比PXE部署方式效率更高,因此在大多环境中,以cobbler 方式部署系统,更为方便:具体步骤如下所示: 若描述有误欢迎拍砖交流QQ:45223208 1.安装cobbler 和 DHCP服务: yum install cobbler -y yum install dhcp -y 2. 启动服务 systemctl start cobbler tftp httpd systemctl enable cobbler tftp httpd 3. 根据

自动化运维平台之系统自动化安装Cobbler系统使用详解

一.简介 Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP.DNS.以及yum仓库.构造系统ISO镜像. Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用. Cobbler客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷. 二.cobbler提供的功能 使用

Centos6.7安装部署cobbler完成无人值守化安装部署

 Centos6.7部署cobbler完成无人值守化安装部署                   Cobbler是一个免费开源系统安装部署软件,用于自动化网络安装操作系统.在生产环境中,经常批量部署几十甚至上百台服务器时,实现自动化安装操作系统尤为重要,按照传统的光盘引导安装工作量是不可预估的:此前我们通过pxe+kickstart简单实现了自动化安装,但只能实现单一版本安装,当需要部署不同版本或不同引导模式(BIOS.EFI)时,此种方式就不够灵活.而Cobbler正是为了解决此问题而设计的.

在CentOS7中 部署cobbler自动装机

Cobbler是一个Linux安装服务器,它允许快速安装网络安装环境.它聚合并自动化了许多相关的Linux任务,因此在部署新系统时,不必在许多不同的命令和应用程序之间跳跃,在某些情况下,还需要更改现有的系统.Cobbler可以帮助配置.管理DNS和DHCP.包更新.电源管理.配置管理业务流程等等. 实验需要的安装包: cobbler(linux安装服务器) cobbler-web(前端界面管理 可以通过网页形式进行管理) dhcp(自动分配IP) tftp-server (文件传输协议 用于放压

在CentOS7中部署Cobbler自动装机

在CentOS7中部署Cobbler自动装机Cobbler概述:Cobbler是一个使用Python开发的开源项目,通过将部署系统所涉及的所有服务集中在一起,来提供一个全自动批量快速建立Linux系统的网络安装环境.Cobbler 提供了DHCP管理.YUM源管理.电源管理等功能,除此之外还支持命令行管理.WEB界面管理,并且提供了API接口,方便进行二次开发.安装Cobbler环境:Cobbler相关软件包由EPEL源提供.是Fedora小组维护的一个软件仓库项目,为RHEL/CentOS提供

Kickstart+HTTP+DHCP+TFTP全自动批量安装部署Linux系统

说明: Kickstart服务器系统:CentOS 6.5 64位 IP地址:192.168.0.250 需要安装部署的Linux系统:CentOS 6.5 64位 eth0(第一块网卡,用于外网)IP地址段:60.28.x.x eth1(第二块网卡,用于内网)IP地址段:192.168.0.128 子网掩码:255.255.255.128 网关:192.168.0.250 DNS:114.114.115.115 8.8.4.4 所有服务器均支持PXE网络启动 实现目的:通过配置Kickstar

centos部署简单tomcat及负载均衡

centos部署简单tomcat及负载均衡 实验拓扑: 实验准备: 准备好apache-tomcat及jdk和nginx的软件包,我这里使用的是 jdk-7u65-linux-x64.gz apache-tomcat-7.0.54.tar.gz nginx-1.9.4.tar.gz 实验前停止iptables和selinux sed -i '/SELINUX/s/enforcing/disabled/g' /etc/selinux/config /etc/init.d/iptables stop