如何在CentOS 8/Rhel 8上安装Foreman

时间:2020-02-23 14:39:09  来源:igfitidea点击:

Foreman是一种自动和开源工具,用于自动配置Linux系统的配置和配置。
Foreman可以与配置管理工具相结合,如Ansible,Chef,Salt和Puppet,可作为插件提供,以提供完整的基础架构生命周期管理。
员工支持各种虚拟化和云环境。
在本博客文章中,我将解释用于在CentOS 8上安装Foreman的步骤RHEL 8 Linux系统。

在CentOS 8| rhel 8上安装Foreman

Foreman的标准特征是:

通过PXE,本地媒体或者模板或者imagesControl管理虚拟化环境中的整个裸机基础设施核心和管理实例,并通过PXE,本地媒体或者模板或者imagesControl管理,并从配置管理软件组中收集报告,并在批量中管理它们,无论审计或者故障排除的历史更改如何,通过强大的插件架构,JSON休息API和CLI for LinuxExtend

安装前部后,主要任务将安装在与基础架构集成的正确插件上。
如果我们使用RHEV作为虚拟化基础结构,则需要一个特定插件,这使我们可以在此基础架构中提供和销毁资源。
相同模型适用于所有其他核心基础架构管理软件,如KVM,Xen,CloudStack,OpenStack等许多产品。

如果没有涵盖的理论,可以在官方文档页面中找到,让我们继续在CentOS 8| RHEL 8上安装和配置Foreman 服务器。

步骤1:配置主机名

我们需要为计算机配置了一个正确的主机名,可以将其解析为IP地址。
不要使用example.com。
作为主机名的域,如示例所示。
在DNS服务器中配置的基础架构中的一个替换主机名。

sudo hostnamectl set-hostname foreman.example.com

在/etc/hosts文件中设置IP地址和DNS名称。
这对于没有工作DNS服务器的环境通常很重要。

$sudo vi /etc/hosts
192.168.100.21 foreman.example.com

确保以下命令显示真实的IP地址,而不是127.0.1.1.

$ping -c 2 $(hostname -f)
PING foreman.example.com (192.168.100.21) 56(84) bytes of data.
64 bytes from foreman.example.com (192.168.100.21): icmp_seq=1 ttl=64 time=0.052 ms
64 bytes from foreman.example.com (192.168.100.21): icmp_seq=2 ttl=64 time=0.035 ms
--- foreman.example.com ping statistics --
2 packets transmitted, 2 received, 0% packet loss, time 1023ms
rtt min/avg/max/mdev = 0.035/0.043/0.052/0.010 ms

如果返回127.0.0.1,则更改/删除/etc/hosts文件中的此条目,如果存在。

如果使用Linux主机命令返回正确的IP地址,则可以确认配置的主机名:

$host foreman.example.com

第2步:安装和配置NTP时间同步

安装CentOS和所有其他基于RHEL的Linux系统的替代NTP软件包。

sudo dnf -y install chrony

安装包后,设置正确的时区。
运行Synchronization命令时,这将确保为计算机设置正确的时间。

sudo timedatectl set-timezone Africa/Nairobi

使用SystemCtl Comamnd启动和启用ChronyD服务。

sudo systemctl enable --now chronyd

同步时间以获得CentOS/RHEL系统中的正确日期和时间。

$sudo chronyc sources
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^- static.102.162.46.78.cli>     2   7   377    14  -3496us[-3496us] +/-   52ms
^- node2.eriomem.net             2   7   377   145  -5807us[-5831us] +/-   45ms
^* time.cloudflare.com           3   7   377    16    -27us[  -52us] +/-   15ms
^- ntp1.squareflow.net           2   7   377    15  -8346us[-8346us] +/-   61ms

确认当前时间设置。

$timedatectl
               Local time: Mon 2017-07-20 01:48:53 EAT
           Universal time: Sun 2017-07-19 22:48:53 UTC
                 RTC time: Sun 2017-07-19 22:48:53
                Time zone: Africa/Nairobi (EAT, +0300)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

如果返回错误的值,请重新检查时区是否正确设置。

第3步:添加Puppet和Foreman存储库

添加依赖关系和实际的Foreman Pack安装所需的Puppet和Foreman存储库。

sudo dnf -y install https://yum.puppet.com/puppet6-release-el-8.noarch.rpm

还可以使用DNF Package Manager拔出和安装发布RPM包来添加Foreman存储库。

sudo dnf -y install https://yum.theforeman.org/releases/2.1/el8/x86_64/foreman-release.rpm

第4步:在CentOS/RHEL 8上安装ForeMan安装程序。

添加了两个存储库,请在CentOS 8| RHEL 8中安装Foreman Installer 系统。

sudo dnf -y install foreman-installer

第5步:在CentOS 8 | rhel 8上运行Foreman安装程序

当Foreman Installer安装完成时,我们需要运行它来配置和准备拍摄者组件。
Foreman Installer是一组Puppet模块,可以在CentOS 8上安装完整的工作前门设置所需的一切

默认情况下,它将配置:Apache HTTP使用SSL(使用Puppet签名证书)Foreman在Mod_PassEnguppet代理配置为Puppet,TFTP和SSLPUPPET主服务器CompentedTFTP服务器(在Red Hat平台上的XinetD下)配置

请注意,默认情况下,Foreman运行的安装是非交互模式,但可以通过提供所列出的任何选项来自定义配置:

$foreman-installer --help

要以交互模式运行Foreman安装,请使用:

sudo foreman-installer -i

要以非交互模式运行安装,请使用:

sudo foreman-installer

如果智能代理,Puppet Master沿着Foreman安装,安装程序将在安装后输出有关它们的详细信息。

Preparing installation Done
Executing: foreman-rake upgrade:run
foreman-rake upgrade:run finished successfully!
  Success!
  * Foreman is running at https://foreman.example.com
      Initial credentials are admin/QAefJcYDnxQy2yEL
  * Foreman Proxy is running at https://foreman.example.com:8443
  The full log is at /var/log/foreman-installer/foreman.log

如果我们有活动防火墙服务,请打开所有必需的端口。

sudo firewall-cmd --add-port={22,53,80,443,3000,8140,3306,5432,8443,5910-5930}/tcp --permanent
sudo firewall-cmd --add-port=67-69/udp --permanent
sudo firewall-cmd --reload