zoukankan      html  css  js  c++  java
  • CentOS 7 Cobbler 安装

    Cobbler介绍

    Cobbler是一个Linux服务器快速网络安装的服务,而且在经过调整也可以支持网络安装windows。

    • 使用python开发,小巧轻便(才15k行python代码),可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS,TFTP、RSYNC以及yum仓库、构造系统ISO镜像。
    • Cobbler 可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
    • Cobbler 是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
    • Cobbler 内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack
    • Cobbler 客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷。

    Cobbler用处

    使用Cobbler,您无需进行人工干预即可安装机器。Cobbler设置一个PXE引导环境(它还可以使用yaboot支持PowerPC),并 控制与安装相关的所有方面,比如网络引导服务(DHCP和TFTP)与存储库镜像。当希望安装一台新机器时,Cobbler可以:

    1. 使用一个以前定义的模板来配置DHCP服务(如果启用了管理DHCP)。
    2. 将一个存储库(yum或rsync)建立镜像或解压缩一个媒介,以注册一个新操作系统。
    3. 在DHCP配置文件中为需要安装的机器创建一个条目,并使用指定的参数(IP和MAC)。
    4. 在TFTP服务目录下创建适当的PXE文件。
    5. 重新启动DHCP服务来反应新的更改。
    6. 重新启动机器以开始安装(如果电源管理已启动)。

    环境准备

    系统版本 内核版本 IP地址
    Centos 7.5 4.18.9-1.el7.elrepo.x86_64 10.0.0.200

    备注该系统采用MINI最小化安装,安装之后对系统进行了最基础的优化操作,操作过程点击这里

    设置IP转发

    [root@cobbler ~]# echo 1 > /proc/sys/net/ipv4/ip_forward 
    [root@cobbler ~]# sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/' /etc/sysctl.conf
    [root@cobbler ~]# sysctl -p
    

    安装 Cobbler 及所需要的依赖包

    [root@cobbler ~]# yum install cobbler dhcp httpd xinetd tftp-server syslinux pykickstart xinetd rsync cobbler-web -y
    

    配置文件目录

    /etc/cobbler/settings : cobbler 主配置文件
    /etc/cobbler/iso/: iso模板配置文件
    /etc/cobbler/pxe: pxe模板文件
    /etc/cobbler/power: 电源配置文件
    /etc/cobbler/user.conf: web服务授权配置文件
    /etc/cobbler/users.digest: web访问的用户名密码配置文件
    /etc/cobbler/dhcp.template : dhcp服务器的的配置末班
    /etc/cobbler/dnsmasq.template : dns服务器的配置模板
    /etc/cobbler/tftpd.template : tftp服务的配置模板
    /etc/cobbler/modules.conf : 模块的配置文件
    

    数据目录

    /var/lib/cobbler/config/: 用于存放distros,system,profiles 等信息配置文件
    /var/lib/cobbler/triggers/: 用于存放用户定义的cobbler命令
    /var/lib/cobbler/kickstart/: 默认存放kickstart文件
    /var/lib/cobbler/loaders/: 存放各种引导程序
    

    镜像目录

    /var/www/cobbler/ks_mirror/: 导入的发行版系统的所有数据
    /var/www/cobbler/images/ : 导入发行版的kernel和initrd镜像用于远程网络启动
    /var/www/cobbler/repo_mirror/: yum 仓库存储目录
    

    日志目录

    /var/log/cobbler/installing: 客户端安装日志
    /var/log/cobbler/cobbler.log : cobbler日志
    

    cobbler commands

    import
    sync
    reposync
    build iso (使用发行版,配置文件,制作系统镜像)
    command line search
    replication
    valication kickstart
    

    启动Cobbler并配置

    启动

    [root@cobbler yum.repos.d]# systemctl start cobblerd
    [root@cobbler yum.repos.d]# systemctl enable cobblerd
    Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
    [root@cobbler yum.repos.d]# systemctl start httpd
    [root@cobbler yum.repos.d]# systemctl enable httpd
    Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
    

    检查配置

    [root@cobbler ~]# 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.
    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.
    3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
    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.
    5 : enable and start rsyncd.service with systemctl
    6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
    7 : 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
    8 : 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.
    
    

    一共有八个问题,下面来一个一个解决

    问题 1

    # 修改server的ip地址为本机ip
    [root@cobbler ~]# sed -i 's/^server: 127.0.0.1/server: 10.0.0.200/' /etc/cobbler/settings  
    

    问题 2

    # TFTP Server 的IP地址
    [root@cobbler ~]# sed -i 's/^next_server: 127.0.0.1/next_server: 10.0.0.200/' /etc/cobbler/settings
    

    问题 3

    [root@cobbler ~]# cat /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
    	# 把下面的yes,替换成no即可
    	disable			= no
    	per_source		= 11
    	cps			= 100 2
    	flags			= IPv4
    }
    

    问题 4

    # 下载缺失的文件
    [root@cobbler ~]# cobbler get-loaders
    task started: 2018-09-27_152814_get_loaders
    task started (id=Download Bootloader Content, time=Thu Sep 27 15:28:14 2018)
    downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
    downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
    downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
    downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
    downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
    downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
    downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
    downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
    downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
    downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
    *** TASK COMPLETE ***
    
    

    问题 5

    # 添加rsync到自启动并启动rsync
    [root@cobbler ~]# systemctl start rsyncd
    [root@cobbler ~]# systemctl enable rsyncd 
    Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
    

    问题6

    跟debian 相关,可以忽略

    问题7

    # 修改密码为123456 ,salt后面是常用的加盐方式加密
    [root@cobbler ~]# openssl passwd -1 -salt '123456' '123456' 
    $1$123456$wOSEtcyiP2N/IfIl15W6Z0
    [root@cobbler ~]# grep 'default_password_crypted' /etc/cobbler/settings
    default_password_crypted: "$1$123456$wOSEtcyiP2N/IfIl15W6Z0"
    

    下面再次执行检查配置

    [root@cobbler ~]# cobbler check
    The following are potential configuration items that you may want to fix:
    
    1 : debmirror package is not installed, it will be required to manage debian deployments and repositories
    2 : 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.
    

    上面出现的这两个问题都可以忽略。

  • 相关阅读:
    [luoguP1098] 字符串的展开(模拟)
    [luoguP1033] 自由落体(模拟?)
    [luoguP1011] 车站(递推)
    [luoguP1097] 统计数字(水)
    [luoguP2672] 推销员(贪心 + 树状数组 + 优先队列)
    [luoguP1043] 数字游戏(DP)
    [luoguP1058] 立体图(超级大模拟(¬︿̫̿¬☆))
    [luoguP1021] 邮票面值设计(DFS + dp)
    POJ 2184 Cow Exhibition (带负值的01背包)
    POJ 2392 Space Elevator (DP)
  • 原文地址:https://www.cnblogs.com/winstom/p/9713906.html
Copyright © 2011-2022 走看看