本文介绍在Ubuntu 20.04(Focal Fossa)服务器上安装Foreman和配置的方法,当前安装的版本为Foreman 2.0,按照以下步骤操作即可。
步骤1:设置系统主机名 您需要为计算机配置正确的主机名,该主机名可以解析为IP地址: sudo hostnamectl set-hostname foreman.example.com echo "192.168.100.21 foreman.example.com" | sudo tee -a /etc/hosts 用您的实际值替换主机名和IP地址。参考使用nmcli在Linux命令行中更改或设置主机名的方法。 确保以下命令显示的是真实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文件中更改或删除该条目。
步骤2:更新系统 正确配置主机名后,请更新系统以获取最新的软件包: sudo apt update && sudo apt upgrade sudo systemctl reboot
步骤3:添加Puppet和Foreman存储库 添加依赖项和实际Foreman软件包安装所需的Puppet和Foreman存储库。 将Puppet存储库添加到Ubuntu 20.04服务器上: sudo apt update sudo apt -y install ca-certificates wget wget https://apt.puppet.com/puppet6-release-focal.deb sudo apt install ./puppet6-release-focal.deb 注:focal指的是Ubuntu 20.04(Focal Fossa)。 将Foreman存储库添加到系统: sudo apt -y install gpg ca-certificates echo "deb http://deb.theforeman.org/ bionic 2.0" | sudo tee /etc/apt/sources.list.d/foreman.list echo "deb http://deb.theforeman.org/ plugins 2.0" | sudo tee -a /etc/apt/sources.list.d/foreman.list wget -q https://deb.theforeman.org/pubkey.gpg -O- | sudo apt-key add -
步骤4:安装Foreman安装程序 添加存储库后,就应该准备在Ubuntu 20.04(Focal Fossa)上安装Foreman: sudo apt update sudo apt install foreman-installer 按y键以接受安装,将安装以下附加软件包: libgdbm-compat4 libruby2.5 puppet-agent rake ruby ruby-ansi ruby-clamp ruby-did-you-mean ruby-hashie ruby-highline ruby-kafo ruby-kafo-parsers ruby-kafo-wizards ruby-little-plugger ruby-logging ruby-minitest ruby-multi-json ruby-net-telnet ruby-power-assert ruby-powerbar ruby-test-unit ruby2.5 rubygems-integration Suggested packages: ri ruby-dev bundler Recommended packages: zip ruby-oj fonts-lato libjs-jquery The following NEW packages will be installed: foreman-installer libgdbm-compat4 libruby2.5 puppet-agent rake ruby ruby-ansi ruby-clamp ruby-did-you-mean ruby-hashie ruby-highline ruby-kafo ruby-kafo-parsers ruby-kafo-wizards ruby-little-plugger ruby-logging ruby-minitest ruby-multi-json ruby-net-telnet ruby-power-assert ruby-powerbar ruby-test-unit ruby2.5 rubygems-integration 0 upgraded, 24 newly installed, 0 to remove and 0 not upgraded. Need to get 27.4 MB of archives. After this operation, 162 MB of additional disk space will be used. Do you want to continue? [Y/n] y 注:用键盘输入y即可自动完成上述安装过程。
步骤5:在Ubuntu 20.04上配置Foreman安装程序 Foreman安装程序是Puppet模块的集合,可在Ubuntu 20.04上安装完整的Foreman配置所需的一切。 默认情况下,它将配置:带有SSL的Apache HTTP、Foreman在mod_passenger下运行、为Puppet,TFTP和SSL配置的智能代理、在mod_passenger下运行的Puppet master、配置了Puppet agent、TFTP服务器。 请注意,默认情况下,安装Foreman运行是非交互模式,但是可以通过提供以下列出的任何选项来自定义配置: $ foreman-installer --help 要以交互方式运行Foreman安装,请使用: sudo foreman-installer -i 要以非交互方式运行安装,请使用: sudo foreman-installer 如果是Smart Proxy,Puppet master随Foreman一起安装,安装程序将在安装后输出有关它们的详细信息: Preparing installation Done Success! * Foreman is running at https://foreman.example.com Initial credentials are admin / yafNTaFNNJRUGP84 * Foreman Proxy is running at https://foreman.example.com:8443 The full log is at /var/log/foreman-installer/foreman.log 以下是Foreman控制中心的登陆界面:
登陆进去后就可以看到控制中心了,如下图所示,里面的选项都可以进行基本的配置:
至此,在Ubuntu 20.04服务器上安装和配置Foreman全部完成。
相关主题 |