当前位置 : 主页 > 编程语言 > 其它开发 >

cobbler离线安装

来源:互联网 收集:自由互联 发布时间:2022-07-20
cobbler离线安装 半自动化安装脚本 在可以联网的机器准备 准备离线装机包 # 安装yum-utils# yum-utils是管理repository及扩展包的工具,包含一系列yum工具,我们需要使用yumdownloader来下载cobble
cobbler离线安装

半自动化安装脚本

在可以联网的机器准备

准备离线装机包

# 安装yum-utils
# yum-utils是管理repository及扩展包的工具,包含一系列yum工具,我们需要使用yumdownloader来下载cobbler相关的依赖包
yum install -y yum-utils

使用yumdownlader下载cobbler及相关产品的依赖包

yumdownloader --resolve --destdir=/tmp/offline-cobbler/ cobbler cobbler-web dhcp httpd tftp xinetd pykickstart debmirror

安装createrepo

yum -y install createrepo

创建yum仓库文件

cd /tmp/offline-cobbler/
createrepo .

打包cobbler离线安装文件

cd /tmp
tar -zcvf offline-cobbler.tar.gz offline-cobbler/

我已经打包好的cobbler包,提取码:w3kb

在无网机器中操作 1. 将打包好的cobbler压缩包传入机器 2. 解压offline-cobbler.tar.gz
tar xvf offline-cobbler.tar.gz -C /tmp/
3. 备份现有yum源
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
4. 编写本地yum源
# 挂载本地iso镜像,需要本地yum源不然安装的时候会少依赖
# 先使用u盘传一个iso镜像最好与本机系统版本一致
# 具体挂载位置看你上传的镜像位置,虚拟机操作是/dev/sr0
$ mount /dev/sr0  /mnt 

$ vi /etc/yum.repos.d/cobbler.repo
[cobbler]
name=cobbler local repo
baseurl=file:///tmp/offline-cobbler/
gpgcheck=0
enalbed=1

# 本机镜像源
$  vi /etc/yum.repos.d/Centos.repo
[centos]
name=centos
baseurl=file:///mnt/
gpgcheck=0
enalbed=1

5. 生成yum缓存
yum clean all
yum makecache
6. 安装cobbler
# 关闭selinux和防火墙
# -i 直接修改文件
# s 查找替换
# g 完成所有匹配值的替换
$ sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
$ setenforce 0
$ systemctl disable firewalld.service 
$ systemctl stop firewalld.service
# 安装cobbler
$ yum install cobbler -y
7. 安装dhcp和httpd
# 移除cobbler yum源之后安装

rm -f /etc/yum.repos.d/cobbler.repo

yum install dhcp httpd -y
8. 启动服务
$ systemctl enable httpd.service tftp.socket cobblerd.service 
$ systemctl start httpd.service tftp.socket cobblerd.service
9. 检查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 : 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 

4 : change 'disable' to 'no' in /etc/xinetd.d/tftp

5 : 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.

6 : enable and start rsyncd.service with systemctl

7 : debmirror package is not installed, it will be required to manage debian deployments and repositories

8 : ksvalidator was not found, install pykickstart

9 : 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

10 : 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”字段必须设置为localhost以外的地址,否则kickstarting特性将不起作用。其应该是一个可解析的主机名或IP,所有机器都可达的地址。
2、为了使PXE正常工作,必须将/etc/cobbler/settings中的“next_server”字段设置为除127.0.0.1之外的其他字段,并且应该与PXE网络上的引导服务器的IP匹配。
3、SELinux已启用。请查看下面的Wiki页面以确保在您的SELinux环境下cobbler可以正确工作;
4、 在/etc/xinetd.d/tftp文件中将 'disable' 设置为 'no';
Xinetd:即extended internet daemon,是新一代的网络守护进程服务程序,又叫超级Internet服务器,常用来管理多种轻量级Internet服务。Xinetd提供类似于inetd+tcp_wrapper的功能,但是更加强大和安全。
5、一些网络引导加载程序在/var/lib/cobblerZ/loaders中丢失,您可以运行“cobbler get-loaders”来下载它们,如果您只想处理x86/x86_64 网络引导,确保您已经安装了最近的syslinux包,安装后可以忽略此消息。如果希望支持所有体系结构,则此目录中的文件应该包括pxelinux.0(预启动linux引导程序)、menu.c32(显示菜单界面引导程序)、elilo.efi(ELILO 是一种基于 EFI 开发的 boot loader)和yaboot(Macintosh的引导程序)。“cobbler get-loaders”命令是解决这些需求最简单的方法。
6、使用systemctl命令开启rsyncd.service服务(rsync(remote [rɪˈmoʊt] sync [sɪŋk])是linux系统下的数据镜像备份工具)并设置开机自启
7、debmirror包没有安装,它用来管理Debian系统的部署和存储库
8、ksvalidator (validator [ˈvælədeɪtər]验证器)没有发现,要安装pykickstart
9、新安装的机器的默认密码设置为cobbler,你可以使用"openssl passwd -1 -salt 'random phrase-here' 'your-password-here'"得到新得密码
10、fencing([ˈfensɪŋ] 击剑/(用栅栏、篱笆或围栏)围住) tools 没有找到,它被用来电源管理功能(可选),安装cman或者fence-agents 来使用

按步骤修复即可,基本想搞离线安装的肯定都会接下来的操作,我这边就不写了.

网友评论