linux批量安装,cobbler

简介: linux批量安装,cobbler,pxe,dhcp,tftp

实验环境Centos7
需安装包:
httpd :提供传输安装系统所需文件,根目录挂载安装光盘
dhcpd :提供dhcp服务
tftp-server :与dhcpd一起提供初始化文件传输服务
syslinux :提供部分必须文件如:pxelinux

dhcp 服务:

    主要配置
        vim /etc/dhcp/dhcpd.conf
        subnet 192.168.10.0 netmask 255.255.255.0 {
            range 192.168.10.10 192.168.10.20;
            filename "pxelinux.0"; /* 申明pxe文件名
            next-server 192.168.10.3; /* 申明pxe文件所在的服务器,tftp服务器
            }

tftp服务

    服务根目录
        各个版本的安装程序组件不可混用
        CentOS7:
            tree /var/lib/tftpboot/
                ├── chain.c32              /*由 syslinux 软件包提供,与选择菜单有关
                ├── initrd.img            /*由系统安装光盘里的pxelinux提供,是系统安装程序组件
                ├── kickstarts            
                │   └── centos7.cfg        /*ks文件,自动化安装系统的安装配置在选择菜单界面选择项引用
                ├── mboot.c32            /*由 syslinux 软件包提供,与选择菜单有关
                ├── memdisk                /*由 syslinux 软件包提供,与选择菜单有关
                ├── menu.c32            /*由 syslinux 软件包提供,与选择菜单有关
                ├── pxelinux.0            /*由 syslinux 软件包提供,与选择菜单有关
                ├── pxelinux.cfg        
                │   └── default            /*是系统安装光盘里的isolinux提供,与选择菜单界面选择项有关
                └── vmlinuz                /*由系统安装光盘里的pxelinux提供,是系统安装程序组件
        
            default文件详解:
                
                default menu.c32
                prompt 5
                timeout 30
                MENU TITLE CentOS 7 PXE Menu

                LABEL linux
                MENU LABEL Install CentOS 7 x86_64
                KERNEL vmlinuz
                APPEND initrd=initrd.img 
                  
                LABEL linux
                MENU LABEL Install CentOS 7 x86_64
                KERNEL vmlinuz
                APPEND initrd=initrd.img (ip=192.168.10.100 netmask=255.255.255.0)inst.repo=http://172.16.100.67/centos7 ks=http://172.16.100.67/centos7.cfg
        CentOS6:
            tree /var/lib/tftpboot/
                ├── boot.msg            /*是系统安装光盘里的isolinux提供,与选择菜单界面选择项有关
                ├── initrd.img            /*由系统安装光盘里的pxelinux提供,是系统安装程序组件
                ├── pxelinux.0            /*由 syslinux 软件包提供,与选择菜单有关
                ├── pxelinux.cfg        /*由 syslinux 软件包提供,与选择菜单有关
                │   └── default            /*是系统安装光盘里的isolinux提供,与选择菜单界面选择项有关
                ├── splash.jpg            /*是系统安装光盘里的isolinux提供,与选择菜单界面选择项有关
                ├── vesamenu.c32        /*是系统安装光盘里的isolinux提供,与选择菜单界面选择项有关
                └── vmlinuz                /*由系统安装光盘里的pxelinux提供,是系统安装程序组件

cobbler :有图形界面--- 安装包(cobbler-web)

cobbler是pxe的二次封装所以依赖于以下服务
    dhcp:解决方案(安装包)
        dnsmasq,dhcpd
    tftp:解决方案(安装包)
        tftp-server

概念:
        distro /linux 发行版系统 repository,标记一个发行版的最重要标记是,kernel ramdisk
        profile    /ks文件    kickstarts
        system  /实际安装好的系统 ip/mask

主配置文件:
    /etc/cobbler/settings

实现流程:
    yum install cobbler            /*安装cobbler,基于epel源
    systemctl start cobbler        /*启动服务
    cobbler check                /*检查服务,根据服务的错误提示修改主配置文件重启即可
    cobbler sync                /*修改完配置文件后,同步配置到,tftp
     cobbler import --name="CentOS7_x86_64-1503" --path=/media/cdrom     /*导入发行版本,会生成最小安装的配置文件
    
                
命令:
    cobbler distro [list|add|--help]
    cobbler import --name="CentOS7_x86_64-1503" --path=/media/cdrom

实操流程:
    1、安装cobbler,基于epel源
        yum install cobbler
    2、启动服务
        systemctl start cobbler.service
    3、运行cobbler check
        cobbler check
        
            系统提示:
            httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
            Traceback (most recent call last):
              File "/usr/lib/python2.7/site-packages/cobbler/cli.py", line 251, in check_setup
                s.ping()
              File "/usr/lib64/python2.7/xmlrpclib.py", line 1233, in __call__
                return self.__send(self.__name, args)
              File "/usr/lib64/python2.7/xmlrpclib.py", line 1591, in __request
                verbose=self.__verbose
              File "/usr/lib64/python2.7/xmlrpclib.py", line 1273, in request
                return self.single_request(host, handler, request_body, verbose)
              File "/usr/lib64/python2.7/xmlrpclib.py", line 1301, in single_request
                self.send_content(h, request_body)
              File "/usr/lib64/python2.7/xmlrpclib.py", line 1448, in send_content
                connection.endheaders(request_body)
              File "/usr/lib64/python2.7/httplib.py", line 1037, in endheaders
                self._send_output(message_body)
              File "/usr/lib64/python2.7/httplib.py", line 881, in _send_output
                self.send(msg)
              File "/usr/lib64/python2.7/httplib.py", line 843, in send
                self.connect()
              File "/usr/lib64/python2.7/httplib.py", line 824, in connect
                self.timeout, self.source_address)
              File "/usr/lib64/python2.7/socket.py", line 571, in create_connection
                raise err
            error: [Errno 111] Connection refused
                
            问题所在第一行,httpd服务没有启动。
            1),rpm -qi httpd 显示httpd 已在安装cobbler时一起安装了,启动即可
                systemctl start httpd
            
        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、修改/etc/cobbler/settings文件中的server参数的值为提供cobbler服务的主机相应的IP地址或主机名;
                2、修改/etc/cobbler/settings文件中的next_server参数的值为提供(cobbler)PXE服务的主机相应的IP地址;
                3、如果当前节点可以访问互联网,执行“cobbler get-loaders”命令即可;否则,需要安装syslinux程序包, 而后复制/usr/share/syslinux/*等文件至/var/lib/cobbler/loaders/目录中;
                4、执行“chkconfig rsync on”/systemctl start rsyncd.service命令即可;
                5、注释/etc/debmirror.conf文件中的“@dists="sid";”一行,centos7忽略;
                6、注释/etc/debmirror.conf文件中的“@arches="i386";”一行;centos7忽略;
                7、执行“openssl passwd -1 -salt $(openssl rand -hex 4)”生成密码,并用其替换/etc/cobbler/settings文件中default_password_crypted参数的值;
                8、执行“yum install cman fence-agents”命令安装相应的程序包即可;
    4,启动tftp服务
        systemctl start tftp
    5,安装dhcp服务并配置启动
        安装:yum install -y dhcp
        配置:vim /etc/dhcp/dhcpd.conf
        
                default-lease-time 600;
                max-lease-time 7200;

                log-facility local7;

                subnet 192.168.10.0 netmask 255.255.255.0 {
                        range 192.168.10.10 192.168.10.20;
                        filename="pxelinux.0";
                        next-server 192.168.10.2;
                }
        启动:systemctl start dhcpd
    
    6,接着重启cobblerd,而后执行“cobbler sync”同步新的配置至cobbler。
    7,导入发行版本,会生成最小安装的配置文件,同步
        cobbler import --name="CentOS7_x86_64-1503" --path=/media/cdrom
        cobbler sync
    
    
    
                

额外命令:
mount --bind diretory diretory /*目录挂载

目录
相关文章
|
1月前
|
Ubuntu Linux
任何Ubuntu用户都应安装的四大Linux应用程序
当然,这款程序不需要太多介绍。我们面对的是网上最庞大最完整的多媒体中心,由于丰富的插件,我们能够高度细化地定制其每一项功能。这是我们的Linux发行版不可或缺的必备软件。 我们可以通过运行以下命令来轻松安装Kodi:sudo apt install kodi。
|
1月前
|
Ubuntu 物联网 Linux
从零安装一个Linux操作系统几种方法,以Ubuntu18.04为例
一切就绪后,我们就可以安装操作系统了。当系统通过优盘引导起来之后,我们就可以看到跟虚拟机中一样的安装向导了。之后,大家按照虚拟机中的顺序安装即可。 好了,今天主要介绍了Ubuntu Server版操作系统的安装过程,关于如何使用该操作系统,及操作系统更深层的原理,还请关注本号及相关圈子。
|
24天前
|
弹性计算 安全 Linux
阿里云服务器ECS安装宝塔Linux面板、安装网站(新手图文教程)
本教程详解如何在阿里云服务器上安装宝塔Linux面板,涵盖ECS服务器手动安装步骤,包括系统准备、远程连接、安装命令执行、端口开放及LNMP环境部署,手把手引导用户快速搭建网站环境。
|
1月前
|
安全 Ubuntu Linux
如何安装Linux操作系统?
此时,您可以选择重新启动计算机,然后从硬盘上的Linux系统启动。以上是一个大致的安装过程。请注意,不同的Linux发行版可能会在细节上有所差异,因此在进行安装之前,请确保您阅读并理解了相应发行版的安装指南或文档。
|
1月前
|
Ubuntu Linux 数据安全/隐私保护
Win10安装Linux子系统教程!如何在Win10系统中安装Ubuntu!
登录系统后,输入cd /返回上一级,然后再输入“ls”查看一下系统文件目录,看看对不对!
|
1月前
|
Ubuntu Linux Shell
手把手教你安装适用于Linux的Windows子系统——Ubuntu
重启完成,你看看重新打开Ubuntu是不是发生了变化,等待几分钟,系统配置完成,根据提示设置用户名和密码即可
|
1月前
|
存储 Ubuntu Linux
安卓手机免root安装各种Linux系统:Ubuntu, Centos,Kali等
此外还可以安装Slackware、Archstrike等系统,还可以通过github查找方法安装更多有趣的东西。 昨日小编就是通过Termux安装的Kali Linux工具包。
|
1月前
|
Ubuntu 网络协议 Unix
在虚拟机中安装Linux Ubuntu系统指南
通过点击【浏览】按钮,您可以更改Ubuntu的安装位置。为确保系统稳定,建议避免将Ubuntu安装在C盘。您可以在D盘或其他磁盘中创建一个名为“ubuntu”的文件夹,并选择该文件夹作为安装位置,然后点击【下一步】继续。
|
1月前
|
Ubuntu Linux 数据安全/隐私保护
Windows上快速安装Linux子系统Ubuntu
Installing, this may take a few minutes...WslRegisterDistribution failed with error: 0x800701bcError: 0x800701bc WSL 2 ?????????????????? https://aka.ms/wsl2kernelPress any key to continue... 原因是 wsl1 升级到 wsl2 之后,内核却没有升级。 解决:下载最新的wsl安装包(wsl安装包)
|
1月前
|
Ubuntu Unix Linux
玩机强化技能,动手安装Ubuntu Linux操作系统
(13)Ubuntu重启过程中,你将在关机画面中看到提示文字“Please remove the installation medium, then press ENTER:”,按下“Enter”键即可重启电脑。