在CentOS 7上安装Katello
我们将在CentOS 7上与Katello一起安装Foreman。
本文是KVM,Katelo和Puppet系列测试环境项目的一部分。
Katello vs Spacewalk vs Red Hat Satellite
我们使用Spacewalk已经有一段时间了。
Spacewalk是Red Hat Satellite 5的上游产品。
RedHat Satellite 6是Red Hat Satellite产品的重新设计,它是完全由不同的,更现代的技术构建而成的。
红帽卫星6是几个上游开源项目(包括Katello,Foreman,Pulp和Candlepin)的联合。
所有产品都是开源项目,在每种情况下,Red Hat都是最大的贡献者。
每个产品做什么?
- 工头:供应新客户。
- 纸浆:补丁和内容(软件包存储库)管理。
- Candlepin:订阅和权利管理。
- Puppet:配置管理(实际运行在Foreman中分配的模块)。
- Katello:统一的工作流和WebUI用于内容(Pulp)和订阅(Candlepin)。
Katello最初是一个独立的应用程序,但现在是Foreman的插件。
Foreman是用于物理和虚拟服务器的完整生命周期管理工具。
在谈论Katello时,我们想到了带有Katello插件的Foreman服务器。
软件
本文使用的软件:
- CentOS的7
- 工头1.16
- 卡特洛3.5
- Puppetserver 2.8
- Puppet4.10
虚拟机硬件
我们将用于Katello的VM具有以下规范:
- 2个CPU核心
- 10GB 内存 + 4GB SSD支持的交换
- '/'-10GB
- '/var/lib/pulp'-10GB
- '/var/lib/mongodb'-10GB
- '/var/ftp/pub'-10GB
- '/var/spool/squid'-10GB
- '/tmp'-1GB
- '/mnt/backup'-50GB
对于Katello,建议使用XFS文件系统,因为它没有ext4的inode限制。
由于Katello使用大量符号链接,因此如果使用ext4和默认数目的inode,我们的系统很可能会用尽inode。
测试环境
请参见下图,以确定本文适用的homelab部分。
时间同步
根据https://theforeman.org/plugins/katello/3.5/installation/index.html此处提供的Katello文档,如果出现较小的时钟偏斜,某些Katello功能将无法正常运行。
设置已过时:
# yum install chrony -y # systemctl enable chronyd && systemctl start chronyd # chronyc sources
DNS配置为使用我们的homelab服务器:
# cat /etc/resolv.conf nameserver 10.11.1.2 nameserver 10.11.1.3
安装Katello
配置防火墙
# firewall-cmd --permanent --add-service={RH-Satellite-6,ftp,tftp} # firewall-cmd --permanent --add-port=8000/tcp # firewall-cmd --reload
# firewall-cmd --list-all public (active) target: default icmp-block-inversion: no interfaces: enp0s17 sources: services: ssh dhcpv6-client RH-Satellite-6 ftp tftp ports: 8000/tcp protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
添加存储库
# yum -y localinstall http://fedorapeople.org/groups/katello/releases/yum/3.5/katello/el7/x86_64/katello-repos-latest.rpm # yum -y localinstall http://yum.theforeman.org/releases/1.16/el7/x86_64/foreman-release.rpm # yum -y localinstall https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm # yum -y localinstall http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm # yum -y install foreman-release-scl python-django # yum -y update
安装Katello
运行安装程序之前,请确保至少有8 GB的可用内存。
# yum -y install katello
设置Foreman服务器
此时,Foreman安装程序应可用于设置服务器。
由于Katello现在是Foreman的插件(Katello在早期是一个独立的应用程序,现在不再如此),因此无需安装Katello就可以安装Foreman。
# foreman-installer --list-scenarios Available scenarios Foreman Proxy (use: --scenario foreman-proxy-content) Install a stand-alone Foreman Proxy. Foreman (use: --scenario foreman) Default installation of Foreman Katello (use: --scenario katello) Install Foreman with Katello
Foreman是主要部分,因为整个体系结构都基于Foreman。
剩下的只是集成来完成某些任务。
要自定义安装,请检查可用参数列表:
# foreman-installer --scenario katello --help
也可以使用答案文件“ /etc/foreman-installer/scenarios.d/katello-answers.yaml”。
我们需要TFTP和Puppet,但是我们不需要DHCP和DNS,因为我们已经有了它的基础架构。
# foreman-installer \ --scenario "katello" \ --foreman-initial-organization "theitroad" \ --foreman-initial-location "HomeLab" \ --foreman-proxy-dhcp "false" \ --foreman-proxy-dns "false" \ --foreman-proxy-tftp "true" \ --foreman-proxy-puppet "true" \ --foreman-proxy-puppetca "true" \ --foreman-puppetrun "true" \ --foreman-proxy-puppetrun-provider "ssh" \ --puppet-runinterval "3600"
万一忘记了管理员密码,可以使用以下命令将其重置:
# foreman-rake permissions:reset
这会将默认管理员用户的密码重置为在命令行上打印的密码。
安装Katello后,我们需要在系统上信任Katello的CA证书(有关如何在Linux OS,Chrome,Firefox等上进行操作的说明,可以在Internet上找到)。
我们将在Katello服务器的/pub目录中找到“ katello-server-ca.crt”(在我们的示例中为http://katello.igi.local/pub/katello-server-ca.crt)。
卸载Katello
如果需要,可以通过以下方式删除Katello:
# katello-remove
将/tmp挂载为noexec时的Puppet问题
这是我们很难学到的东西。
在某些情况下,尤其是对于RHEL 7安装,如果将'/tmp'目录安装为noexec,则Puppet服务器可能无法正确运行,并且我们可能会在Puppet服务器日志中看到类似于以下内容的错误:
puppetserver[]: Failed to load feature test for posix: can't find user for 0 puppetserver[]: Cannot run on Microsoft Windows without the win32-process, win32-dir and win32-service gems: Win32API only supported on win32 puppetserver[]: Puppet::Error: Cannot determine basic system flavour
这是由于JRuby包含一些嵌入式文件,在执行之前,需要将这些嵌入式文件复制到文件系统上的某个位置。
要解决此问题,我们可以不带noexec挂载'/tmp'目录(不推荐),也可以选择其他目录作为Puppet服务器进程的临时目录。
对于后一种选项,我们需要将目录的权限设置为1777.
# mkdir -m 1777 /opt/tmp
打开文件“/etc/sysconfig/puppetserver”进行编辑,并更改以下行,指定tmpdir:
JAVA_ARGS="-Xms2G -Xmx2G -XX:MaxPermSize=256m -Djava.io.tmpdir=/opt/tmp"
工头提供者
有几个Foreman软件包可用于添加功能:
# yum search foreman-|grep "^foreman-.*support" foreman-assets.noarch : Foreman asset pipeline support foreman-console.noarch : Foreman console support foreman-ec2.noarch : Foreman Amazon Web Services (AWS) EC2 support foreman-gce.noarch : Foreman Google Compute Engine (GCE) support foreman-libvirt.noarch : Foreman libvirt support foreman-mysql2.noarch : Foreman mysql2 support foreman-openstack.noarch : Foreman OpenStack support foreman-ovirt.noarch : Foreman oVirt support foreman-plugin.noarch : Foreman plugin support foreman-postgresql.noarch : Foreman Postgresql support foreman-rackspace.noarch : Foreman Rackspace support foreman-sqlite.noarch : Foreman sqlite support foreman-vmware.noarch : Foreman VMware support
如果要在VMware上运行,则可能需要安装foreman-vmware软件包。
将Katello 3.5升级到3.6
创建备份
拍摄虚拟机快照。
(可选)备份Katello:
# katello-backup /mnt/backup/--features=all -y
更新系统
安装所有可用更新,如果部署了新内核,请重新引导服务器。
# yum -y update
储存库
更新Foreman和Katello发行包:
# yum update -y http://fedorapeople.org/groups/katello/releases/yum/3.6/katello/el7/x86_64/katello-repos-latest.rpm # yum update -y http://yum.theforeman.org/releases/1.17/el7/x86_64/foreman-release.rpm # yum clean all && yum update -y foreman-release-scl
更新软件包并运行安装程序
# katello-service stop # yum -y update
# foreman-installer --scenario katello --upgrade