RedHat6.5 puppet配置(一)-准备工作

裴韬
2023-12-01

一、设备信息

openstack平台上创建4台Redhat6.5 64bit 虚拟机,其中一个作为puppet-master节点,其他3台作为puppet-client节点使用puppet模块安装部署glusterfs副本模式集群。信息如下

hostname(short)FQDNOS versionNetwork(eth0)NTP server
puppet-masterpuppet-master.example.comRedHat 6.5 min+DevTools10.59.2.20110.59.63.16
glusterfs01glusterfs01.example.comRedHat 6.5 min+DevTools10.59.2.20210.59.63.16
glusterfs02glusterfs02.example.comRedHat 6.5 min+DevTools10.59.2.20310.59.63.16
glusterfs03glusterfs03.example.comRedHat 6.5 min+DevTools10.59.2.20410.59.63.16

Puppet 要求所有机器有完整的域名,如果没有 DNS 服务器提供域名可以在两台机器上设置主机名(配置/etc/hosts文件)。需要先设置主机名再安装 Puppet,因为安装 Puppet 时会把主机名写入证书,客户端和服务端通信需要这个证书。本测试使用DNS服务,地址10.59.63.17,域名为example.com,即

[root@all-node ~#] cat /etc/resolv.conf
search example.com
nameserver 10.59.63.17

二. 本次环境配置将安装的puppet,glusterfs版本

nameversioncomment
puppet-server3.8.43系列最新版本
puppet3.8.43系列最新版本
puppet-dashboard1.2.23最新稳定版本
glusterfs*3.6.63.6系列最新版本
ruby1,8.7.352yum源封装版本
mysql5.1.71yum源封装版本

Redhat6.5 软件源下puppet、glusterfs版本比较低,不符合我们的要求,我们需要额外下载RPM包进行安装或者直接使用源代码编译安装

软件下载地址
puppethttp://downloads.puppetlabs.com/puppet/
puppet-dashboardhttp://downloads.puppetlabs.com/dashboard/
glusterfshttp://download.gluster.org/pub/gluster/glusterfs/3.6/3.6.6/

三. 系统初始配置

1. RedHat6.5 64bit软件源配置为本地软件源,信息如下

[root@puppet-master yum.repos.d]# cat epel.repo 
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://10.59.63.224/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=http://10.59.63.224/epel/6/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
[root@puppet-master yum.repos.d]# cat rhel-source.repo 
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=http://10.59.63.224/rhel6.5
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

2. 查询Redhatb6.5 软件源已包含puppet版本以及gluster-puppet版本

[root@puppet-master ~]# yum search all puppet
puppet-gluster.noarch      :A Puppet module for GlusterFS
puppet-gluster-doc.noarch  :A Puppet module for GlusterFS
puppet-server.noarch       :Server for the puppet system management tool
puppet.noarch              :A network tool for managing many disparate systems
facter.x86_64              :Command and ruby library for gathering system information

3. 查询RedHat6.5 puppet以及gluster的puppet模块的版本号

[root@puppet-master ~]# yum info puppet-server
Name        : puppet-server
Arch        : noarch
Version     : 2.7.26
Release     : 2.el6
Repo        : epel
Summary     : Server for the puppet system management tool

[root@puppet-master ~]# yum info puppet-gluster
Name        : puppet-gluster
Arch        : noarch
Version     : 0.0.3
Release     : 1.el6
Repo        : epel
Summary     : A Puppet module for GlusterFS

[root@puppet-master ~]# yum info glusterfs
Name        : glusterfs
Arch        : x86_64
Version     : 3.4.0.36rhs
Release     : 1.el6
Repo        : rhel-source
Summary     : Cluster File System

可以看到本地源封装的puppet以及gluster模块包版本比较低,本文档采用采用在线下载rpm方式部署比较新的版本。

4. 关闭服务器的Selinux,iptables,配置ntp服务器

# 关闭selinux
[root@puppet-master ~]# sed -i '/SELINUX/ s/enforcing/disabled/g' /etc/selinux/config
# 停止iptables服务,并禁止自启动
[root@puppet-master ~]# chkconfig iptables off
[root@puppet-master ~]# service iptables stop
安装配置ntp服务
[root@puppet-master ~]# yum install ntp
[root@puppet-master ~]# chkconfig ntpd on
[root@puppet-master ~]# service ntpd start
[root@puppet-master ~]# cp /etc/ntpd.conf /etc/ntpd.conf.ori

# 配置npt.conf,完成后如下
[root@puppet-master ~]# cat /etc/ntp.conf
server  10.59.63.16
driftfile /var/lib/ntp/drift
keys            /etc/ntp/keys

[root@puppet-master ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.59.63.16     202.112.31.197   3 u   78  128  377    0.534   -2.059   0.450

5. 配置hostname解析[Optional]

本实验采用DNS服务器,所以该步骤不会执行,而是如开头编辑/etc/resolv.cof配置DNS域名解析。

如果没有使用DNS服务,需要puppet-master以及各个puppetclient节点配置hostname解析

[root@XXXXXX ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.59.2.201 puppet-master puppet-master.example.com
10.59.2.202 glusterfs01   glusterfs01.example.com
10.59.2.203 glusterfs02   glusterfs02.example.com
10.59.2.204 glusterfs03   glusterfs03.example.com
 类似资料: