zoukankan      html  css  js  c++  java
  • cobbler介绍与部署

    cobbler介绍

    Cobbler是一个Linux系统安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。
    Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
    Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
    官网:http://cobbler.github.io/
    

    cobbler部署流程

    第一个里程:安装cobbler
    更改yum源
    [root@Cobbler ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    [root@Cobbler ~]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    [root@Cobbler ~]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd python-django
    
    第二个里程:安装软件
    yum -y install cobbler cobbler-web dhcp  tftp-server pykickstart httpd
    ps:因为系统默认安装的django版本太低在,所以需要单独拿出来安装
    wget https://bootstrap.pypa.io/get-pip.py
    python get-pip.py
    pip install django==1.8.9
    systemctl start cobbler
    systemctl start httpd
    
    第三个里程:根据cobbler check命给出的提示一个一个进行修正
    修改dhcp地址池
    [root@Cobbler ks_mirror]# cat /etc/cobbler/dhcp.template 
    # ******************************************************************
    # Cobbler managed dhcpd.conf file
    #
    # generated from cobbler dhcp.conf template ($date)
    # Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
    # in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
    # overwritten.
    #
    # ******************************************************************
    
    ddns-update-style interim;
    
    allow booting;
    allow bootp;
    
    ignore client-updates;
    set vendorclass = option vendor-class-identifier;
    
    option pxe-system-type code 93 = unsigned integer 16;
    
    subnet 172.16.1.0 netmask 255.255.255.0 {
         option subnet-mask         255.255.255.0;
         range dynamic-bootp        172.16.1.100 172.16.1.254;
         default-lease-time         21600;
         max-lease-time             43200;
         next-server                $next_server;
         class "pxeclients" {
              match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
              if option pxe-system-type = 00:02 {
                      filename "ia64/elilo.efi";
              } else if option pxe-system-type = 00:06 {
                      filename "grub/grub-x86.efi";
              } else if option pxe-system-type = 00:07 {
                      filename "grub/grub-x86_64.efi";
              } else if option pxe-system-type = 00:09 {
                      filename "grub/grub-x86_64.efi";
              } else {
                      filename "pxelinux.0";
              }
         }
    
    }
    [root@Cobbler ~]# cobbler check
    The following are potential configuration items that you may want to fix:
    # 1与2需修改配置文件中的server与next_server,将其改成本机的IP地址即可,不能使用127.0.0.1
    1 : The 'server' field in /etc/cobbler/settings must be set to something other tha
    r kickstarting features will not work.  This should be a resolvable hostname or IPserver as reachable by all machines that will use it.
    
    2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings mus
    mething other than 127.0.0.1, and should match the IP of the boot server on the PX
    #将tftp配置文件中的disable=yes改成disable=no
    3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
    #使用cobbler get-loaders命令即可
    4 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may r
    t-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting,e that you have installed a *recent* version of the syslinux package installed andis message entirely.  Files in this directory, should you want to support all archuld include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders'e easiest way to resolve these requirements.
    #将rsyncd服务开启,将设置成开机启动
    5 : enable and start rsyncd.service with systemctl
    #忽略,历史遗留问题
    6 : debmirror package is not installed, it will be required to manage debian deplo
    ositories
    #修改settings中的默认始初密码,使用命令chaenssl passwd -1 -salt,然后复制到配置文件中即可
    7 : The default password used by the sample templates for newly installed machines
    word_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be chaenssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new o
    #忽略,历史遗留问题
    8 : fencing tools were not found, and are required to use the (optional) power man
    es. install cman or fence-agents to use them
    
    Restart cobblerd and then run 'cobbler sync' to apply changes.
    
    第四个里程:重启服务并载入修改好的配置
    systemctl restart tftp.socket rsyncd.service cobblerd.service
    cobbler sync
    
    第五个里程:使用浏览器访问
    https://10.0.0.203/cobbler_web
    账号与密码:cobller
    
    第六个里程:导入镜像文件

    第七个里程:修改内核信息

    第八个里程:添加自已写好的KS配置文件
    # Cobbler for Kickstart Configurator for CentOS 7 
    install
    url --url=$tree
    text
    lang en_US.UTF-8
    keyboard us
    zerombr
    bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
    #Network information
    $SNIPPET('network_config')
    #network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=CentOS7
    timezone --utc Asia/Shanghai
    authconfig --enableshadow --passalgo=sha512
    rootpw  --iscrypted $default_password_crypted
    clearpart --all --initlabel
    part /boot --fstype xfs --size 1024
    part swap --size 1024
    part / --fstype xfs --size 1 --grow
    firstboot --disable
    selinux --disabled
    firewall --disabled
    logging --level=info
    reboot
    
    %pre
    $SNIPPET('log_ks_pre')
    $SNIPPET('kickstart_start')
    $SNIPPET('pre_install_network_config')
    # Enable installation monitoring
    $SNIPPET('pre_anamon')
    %end
    
    %packages
    @^minimal
    @compat-libraries
    @core
    @debugging
    @development
    bash-completion
    chrony
    dos2unix
    kexec-tools
    lrzsz
    nmap
    sysstat
    telnet
    tree
    vim
    wget
    %end
    
    %post
    systemctl disable postfix.service
    %end

    第九个里程:自定义系统(配置静态IP与主机名)


    指定KS文件


    设置主机名、DNS与网关


    设置网卡IP地址,mac地址必须IP地址的MAC地址


    再点击sync进行配置载入

  • 相关阅读:
    Visual LISP 第3章 程序的流程控制盒AutoLISP文件(1)程序的流程控制
    Visual LISP 第2章 数据类型、表达式和函数(6)习题
    Visual LISP 第2章 数据类型、表达式和函数(5)函数
    Visual LISP 第2章 数据类型、表达式和函数(4)数据的存储结构
    Visual LISP 第2章 数据类型、表达式和函数(3)表达式
    Visual LISP 第2章 数据类型、表达式和函数(2)变量
    Visual LISP 第2章 数据类型、表达式和函数(1)数据类型
    web工程定时器
    严重: IOException while loading persisted sessions: java.io.EOFException java.io.EOFException
    警告: A docBase ** inside the host appBase has been specified, and will be ignored
  • 原文地址:https://www.cnblogs.com/yjiu1990/p/10668955.html
Copyright © 2011-2022 走看看