Cobbler 2.8.5安装

8 篇文章 0 订阅
1 篇文章 0 订阅

Cobbler 是什么?

Cobbler 是红帽公司研发的基于 PXE 技术的装机服务,可以选着性安装多个不同的操作系统

Cobbler 与 PXE 如何选择?

PXE:适合环境中只需要安装同一操作系统即可,并且开机后不需介入

Cobbler:适合环境中有多种操作系统的需求,开机后需人员选择安装的操作系统版本

Cobbler 安装

              环境要求CentOS7:关闭firewalld和seliunx、设置yum源

1、安装依赖Cobbler环境

[root@localhost ~]# yum install -y epel-release
[root@localhost ~]# yum install -y cobbler cobbler-web pykickstart debmirror dhcp xinetd cman fence-agents
[root@localhost ~]# systemctl restart httpd 
[root@localhost ~]# systemctl enable httpd
[root@localhost ~]# systemctl restart cobblerd
[root@localhost ~]# systemctl enable cobblerd
[root@localhost ~]# netstat -an | grep 25151

2、按照提示输入两次想要设置的密码,并将生成的加密密码保存好。

[root@localhost ~]# openssl passwd -1
Password: 
Verifying - Password: 
$1$7s98ix.4$v5sNzbWmW0dyHdIjk3qqp/

 3、修改cobbler的主配置文件/etc/cobbler/settings 

# 将 server 和 next_server 修改为服务器的IP地址
server: 192.168.0.28
next_server: 192.168.0.28
# 这里填写上一步生成的加密密码,也是新系统root用户启动的密码
default_password_crypted: $1$7s98ix.4$v5sNzbWmW0dyHdIjk3qqp/

4、修改DHCP的配置模板 /etc/dhcp/dhcpd.conf 

  subnet 192.168.0.0 netmask 255.255.255.0 {
        range 192.168.0.100 192.168.0.240;
        option routers 192.168.0.96;
    }
  next-server 192.168.0.96;
    filename="pxelinux.0";
[root@localhost ~]# systemctl restart dhcpd 
[root@localhost ~]# systemctl enable dhcpd

5、修改配置文件/etc/debmirror.conf 和 /etc/xinetd.d/tftp

vim /etc/debmirror.conf          # 关闭非常规系统以及 32 位系统的安装
@dists="sid";
#@arches="i386";

vim /etc/xinetd.d/tftp      # 开启 tftp 服务器,centos7 中需要安装 xinetd 软件包
    disabled改为no
[root@localhost ~]# systemctl start fttp
[root@localhost ~]# systemctl enable fttp

8、 pxelinux.0(引导文件)和menu.c32(菜单文件)复制,因为文件是从sysliunx里面来的,所需复制之前,先要保证下载好syslinux。

[root@localhost ~]# yum install -y syslinux
[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/cobbler/loaders/
[root@localhost ~]# cp /usr/share/syslinux/menu.c32 /var/lib/cobbler/loaders/
[root@localhost ~]# systemctl restart cobblerd
 

# 因为命令 cobbler get-loaders 官方已经移除,现在cobbler check查看当前配置是否出现问题,可以忽视以下错误信息。
 SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
            https://github.com/cobbler/cobbler/wiki/Selinux

 7、进行Cobbler 自动同步文件、自检。

[root@localhost ~]# cobbler sync  
[root@localhost ~]# cobbler check  #还有错误根据提示检查以上的配置文件,有时需要重启systemctl restart cobblerd.service 才生效!!!
[root@localhost ~]# systemctl restart cobblerd.service
[root@localhost ~]# systemctl enable cobblerd.service

8、镜像的导入

[root@localhost ~]# mkdir  /mnt/cdrom
[root@localhost ~]# mount -t iso9660 /dev/cdrom /mnt/cdrom/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# cobbler import --name="centos7.9" --path=/mnt/cdrom/
# name镜像名称  path镜像位置
# 出现 *** TASK COMPLETE *** 说明导入成功

[root@localhost ~]# cobbler distro list   #查看已导入镜像
   centos7.9-x86_64
[root@localhost ~]# cobbler profile list  #查看已导入镜像ks.cfg配置文件
   centos7.9-x86_64
[root@localhost ~]# cobbler profile remove --name=centos7.9-x86_64  #删除镜像ks.cfg配置文件

9.修改镜像ks.cfg启动文件

[root@localhost ~]# vim centos7.9-x86_64.cfg
[root@localhost ~]# mv centos7.9-x86_64.cfg  /var/lib/cobbler/kickstarts/
# centos7.9-x86_64.cfg 模板
#platform=x86, AMD64, 或 Intel EM64T

#version=DEVEL

# Firewall configuration

firewall --disabled

# Install OS instead of upgrade

install

# Use network installation

url --url="http://192.168.0.96/cobbler/ks_mirror/centos7.9/"   #地址为:http://IP/cobbler/ ks_mirror/ 看到的文件列表

# Root password

rootpw --iscrypted $default_password_crypted #修改环境变量 $default_password_crypted 

# System authorization information

auth  --useshadow  --passalgo=sha512

# Use graphical install

graphical

firstboot --disable

# System keyboard

keyboard us

# System language

lang en_US

# SELinux configuration

selinux --disabled

# Installation logging level

logging --level=info

# Reboot after installation

reboot

# System timezone

timezone  Africa/Abidjan

# System bootloader configuration

bootloader --location=mbr

# Clear the Master Boot Record

zerombr

# Partition clearing information

clearpart --all --initlabel

# Disk partitioning information

part /boot --fstype="ext4" --size=600

part swap --fstype="swap" --size=4000

part / --fstype="ext4" --grow --size=1

 

%post --interpreter=/bin/bash

touch /root/1.txt

echo "123" >> /root/1.txt

echo "123" >> /root/1.txt

%end

 

%packages

@base

@chinese-support

@core

@debugging

@basic-desktop

@desktop-debugging

@desktop-platform

@directory-client

@fonts

@general-desktop

@graphical-admin-tools

@input-methods

@internet-applications

@internet-browser

@java-platform

@legacy-x

@network-file-system-client

@office-suite

@print-client

@remote-desktop-clients

@server-platform

@server-policy

@workstation-policy

@x11

mtools

pax

python-dmidecode

oddjob

wodim

sgpio

genisoimage

device-mapper-persistent-data

abrt-gui

samba-winbind

certmonger

pam_krb5

krb5-workstation

libXmu

%end

10.ks.cfg关联镜像 

[root@localhost ~]# cobbler profile remove --name=centos7.9-x86_64   #删除镜像配置文件
[root@localhost ~]# cobbler profile add --name=centos7.9-basic --distro=centos7.9-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.9-x86_64.cfg     #关联镜像配置文件和镜像

11、在启动新虚假机安装系统

 到此配置完成,双系统安装需要导入想要其他系统镜像和KS文件。

 关于cobbler错误

     1、关于cobblerd does not appear to be running/accessible: ConnectionRefusedError(111, 'Connection refused')错误 和  httpd does not appear to be running and proxying Cobbler, or SELinux is in the way. Original traceback错误

[root@localhost ~]# cobbler sync
cobblerd does not appear to be running/accessible: ConnectionRefusedError(111, 'Connection refused')
Traceback (most recent call last):
  File "/usr/bin/cobbler", line 35, in <module>
    sys.exit(app.main())
  File "/usr/lib/python3.6/site-packages/cobbler/cli.py", line 851, in main
    rc = cli.run(sys.argv)
  File "/usr/lib/python3.6/site-packages/cobbler/cli.py", line 414, in run
    self.token = self.remote.login("", self.shared_secret)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1154, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib64/python3.6/xmlrpc/client.py", line 1187, in single_request
    dict(resp.getheaders())
xmlrpc.client.ProtocolError: <ProtocolError for 127.0.0.1:80/cobbler_api: 503 Service Unavailable>

 解决办法:

[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]# systemctl restart httpd.service 
[root@localhost ~]# cobbler sync
task started: 2022-02-03_205924_sync
task started (id=Sync, time=Thu Feb  3 20:59:24 2022)
running python triggers from /var/lib/cobbler/triggers/task/sync/pre/*
running shell triggers from /var/lib/cobbler/triggers/task/sync/pre/*
shell triggers finished successfully
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/system
removing: /var/lib/tftpboot/grub/system_link
removing: /var/lib/tftpboot/grub/images
copying bootloaders
running: ['rsync', '-rpt', '--copy-links', '--exclude=.cobbler_postun_cleanup', '/var/lib/cobbler/loaders/', '/var/lib/tftpboot']
received on stdout: 
received on stderr: 
running: ['rsync', '-rpt', '--copy-links', '--exclude=README.grubconfig', '/var/lib/cobbler/grub_config/', '/var/lib/tftpboot']
received on stdout: 
received on stderr: 
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
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: dhcpd -t -q
received on stdout: 
received on stderr: 
running: service dhcpd restart
received on stdout: 
received on stderr: Redirecting to /bin/systemctl restart dhcpd.service

running shell triggers from /var/lib/cobbler/triggers/sync/post/*
shell triggers finished successfully
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running python trigger cobbler.modules.managers.genders
running shell triggers from /var/lib/cobbler/triggers/change/*
shell triggers finished successfully
*** TASK COMPLETE ***

2、PXE-E32:TFTP OPen timeout的解决办法

    原因 :xinetd 没有启动。 

[root@localhost ~]# systemctl xinetd restart        

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
Cobbler是一种用于集中管理和自动化Linux安装的工具。下面是关于Cobbler 3.2.1安装的步骤: 1. 首先,确保系统上已经安装了必要的依赖项。例如,Python、dhcp、tftp和Apache等。您可以使用包管理工具安装这些依赖项。 2. 下载最新版本的Cobbler 3.2.1安装包。您可以从Cobbler的官方网站或者软件存储库中获取。解压缩安装包文件。 3. 打开终端并切换到解压缩后的Cobbler目录。运行以下命令以开始安装: ``` sudo python setup.py install ``` 4. 安装过程可能会提示您输入管理员密码。根据提示完成输入密码的操作。 5. 安装完成后,运行以下命令以配置Cobbler: ``` sudo cobbler check ``` 检查命令将会列出所有需要解决的问题。根据检查结果的提示进行修复。这些问题可能涉及到配置文件、权限和依赖项。 6. 运行以下命令以启动Cobbler服务: ``` sudo systemctl start cobbler ``` 运行命令前,请确保已停止任何已经运行的Cobbler服务。 7. 运行以下命令以启动cobblerd服务: ``` sudo systemctl start cobblerd ``` 8. 最后,运行以下命令以重启Cobbler服务并使其在启动时自动启动: ``` sudo systemctl enable cobbler sudo systemctl enable cobblerd ``` 至此,您已经成功地完成了Cobbler 3.2.1的安装。您可以使用Cobbler命令行工具和Web界面来管理和配置自动化Linux安装。记得在使用Cobbler之前,确保您已经配置了正确的网络和存储设置。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值