Martin's lab 主服务器搭建

Red-Hat-open-hybrid-cloud-1000x563_0

上图是红帽产品和技术架构的全貌。来源是:http://www.redhat.com/en/technologies/cloud-computing 这张图我用在了我的首次给公司内部的全体销售培训上。由于我是 IT 管理背景的,因此我很习惯从云管理层往下看云引擎的各个层面。但是管理层产品,其实是后来整合纳入的。红帽起家的旗舰产品还是在底层的 RHEL。总之,我想在一个 Lab 里面实现以上所有的部分,所谓实现是让其每个部分都能在运行在假象的一个有意义的业务场景里。还好,红帽的产品全都是基于 x86 平台的,因此我用几个笔记本,再加上我家里的这台 HP MicroServer G8 服务器应该能够全部部署出来。

做这样的一个 lab 还是要一定的规划和设计的,这些初步的规划和设计都在我的本子里手写的,就不在这里敲字了,随后我会抽空上几张图。

主服务器基本配置

硬件:Lenovo W540 CPU Intel i7, RAM 32 GB, SSD 512GB, HD 1TB

OS : RHEL 7.1

订阅是红帽公司的业务模式,也是红帽认为最自豪的部分,红帽相信可以成为开源技术和用户之间的催化剂,它不断参与最优秀的开源技术创新,并为其用户提供最强有利的技术服务和支持。红帽技术员工可以申请一个红帽雇员订阅。我的订阅可以在网上查到如下图所示:

employee-sub

红帽的服务必须是基于订阅的每一个节点(物理、虚拟)都需要有有效的订阅,否则红帽的支持服务不能生效。对于一个已经成功注册到红帽官网,并且状态正常的服务器,应该显示如下的注册状态:

[bash] [root@w540 ~]# subscription-manager list

+——————————————-+ 安装的产品状态 +——————————————-+ 产品名称: Red Hat Enterprise Linux Server 产品 ID: 69 版本: 7.0 构架: x86_64 状态: 已订阅 状态详情: 开始: 2014 年 09 月 09 日 结束: 2015 年 12 月 08 日 [/bash]

红帽员工订阅意味着所有红帽产品。

基本服务配置

KVM

KVM 的上手还真比我想象的速度要慢一些,起码比我用 XenServer 的经历更加纠结一些。总之现在可以彻底的忘记其它任何的选项,KVM 可以满足我的所有需求了。由于主服务器有 512SSD + 32GB RAM + 8 vCPU,所以我打算把产品里的所有管理控制节点 VM 都部署在这个机器上。预计有 10 个左右的虚拟机。 安装配置方面这里就不赘述了。只把困扰我许久的几个网络配置贴出来,供参考。

网桥 0 的功能是为所有虚拟机提供外网链接,使他们和主机一样直通主机所物理链接的局域网。 [bash] [root@w540 ~]# cat /etc/sysconfig/network-scripts/ifcfg-br0 DEVICE=br0 ONBOOT=yes TYPE=Bridge BOOTPROTO=none STP=on DELAY=0 DNS1=192.168.0.1 DEFROUTE=yes IPV4_FAILURE_FATAL=yes IPV6INIT=no DNS2=4.4.4.4 IPADDR=192.168.0.5 PREFIX=24 GATEWAY=192.168.0.1 NM_CONTROLLED=no [/bash]

主机原本的一块物理网卡的配置,由于增加了这个网桥,需求更新如下: [bash] [root@w540 ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp0s25 DEVICE=enp0s25 ONBOOT=yes BRIDGE=br0 NM_CONTROLLED=no BOOTPROTO=none [/bash]

kvm 这块处理这个折腾我很久的 br0 之外,其它的功能看起来还不错,运行在 SSD 上的虚拟机也启动和运行速度飞快。

Repo 服务器

Repos 是红帽软件仓库的简称。它具体指每个订阅内所有软件频道里面下载出来的软件包目录。下载到的某个软件包频道的 repos 目录中是一堆的 rpm 包文件,这样的目录可以制作成本地 Repos 服务器,能够提供给所有 LAN 里 RHEL OS 用来做软件的安装和升级用。 用主服务器上 1TB 的慢速普通盘来保存这些下载的 repos,安装 http 服务器,把它共享给本 lab 的 lan 中。具体的几个参考脚本如下。

在把本服务器注册到红帽网站之后,他会默认 attach 一堆可能不需要的 repos,因此我的做法是先关闭掉所有的默认开启,然后再开启我所需要并且关注的东西。 [bash] [root@w540 repos]# subscription-manager repos –disable="*" [/bash] 以上命令的结果会反问,所有的被关闭的 repos。下面许开启我当前需求的 repos。 [bash] [root@w540 repos]# cat rhel7-enable.sh subscription-manager repos –enable=rhel-7-server-extras-rpms subscription-manager repos –enable=rhel-7-server-satellite-capsule-optional-6.0-rpms subscription-manager repos –enable=rhel-ha-for-rhel-7-server-rpms subscription-manager repos –enable=jb-eap-6-for-rhel-7-server-rpms subscription-manager repos –enable=rhel-7-server-satellite-capsule-6.1-rpms subscription-manager repos –enable=rhel-7-server-rt-rpms subscription-manager repos –enable=rhel-7-server-openstack-6.0-rpms subscription-manager repos –enable=rhel-server-rhscl-7-rpms subscription-manager repos –enable=rhel-7-server-rhn-tools-rpms subscription-manager repos –enable=rhel-7-server-satellite-capsule-6.0-rpms subscription-manager repos –enable=rhel-7-server-openstack-5.0-rpms subscription-manager repos –enable=rhel-7-server-rhevh-rpms subscription-manager repos –enable=rhel-atomic-host-rpms subscription-manager repos –enable=rhel-rs-for-rhel-7-server-rpms subscription-manager repos –enable=rhel-7-server-satellite-capsule-optional-6.1-rpms subscription-manager repos –enable=rhel-7-server-rhev-mgmt-agent-rpms subscription-manager repos –enable=rhel-7-server-openstack-6.0-installer-rpms subscription-manager repos –enable=rhel-7-server-rh-common-rpms subscription-manager repos –enable=jb-eap-6.3-for-rhel-7-server-rpms subscription-manager repos –enable=rhel-7-server-satellite-optional-6.0-rpms subscription-manager repos –enable=rhel-7-server-rpms subscription-manager repos –enable=rhel-7-server-satellite-6.1-rpms subscription-manager repos –enable=rhel-7-server-supplementary-rpms subscription-manager repos –enable=rhel-7-server-satellite-optional-6.1-rpms subscription-manager repos –enable=rhel-7-server-optional-rpms subscription-manager repos –enable=rhel-7-server-satellite-6.0-rpms subscription-manager repos –enable=jb-ews-2-for-rhel-7-server-rpms [/bash]

接下来可以用命令来从红帽 CDN 同步下载每个 Repos 里面的软件包。 [bash] [root@w540 rhel70]# cat sync.sh reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-satellite-6.0-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-extras-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-rhevh-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-satellite-capsule-6.0-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-openstack-5.0-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-rhev-mgmt-agent-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-atomic-host-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-optional-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-rs-for-rhel-7-server-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-rh-common-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-server-rhscl-7-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-openstack-6.0-installer-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-openstack-6.0-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=jb-eap-6.3-for-rhel-7-server-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-ha-for-rhel-7-server-rpms –download_path=/data/Repos/rhel70/ reposync –gpgcheck –newest-only –plugins –downloadcomps –repoid=rhel-7-server-supplementary-rpms –download_path=/data/Repos/rhel70/ [/bash]

安装 httpd 的过程就不叙述了,下面就贴一个本机的配置文件。 [bash] Alias /repos “/data/repos” <Directory “/data/repos”> Options None AllowOverride None Order allow,deny Allow from all Require all granted

[/bash]

最后,在任何需要的机器上本地 repos 源的配置文件可以类似如下: [bash] [root@sat6-leb yum.repos.d]# ls rhel70.repo [root@sat6-leb yum.repos.d]# cat rhel70.repo [rhel-7-server-rpms] name=rhel-7-server-rpms baseurl=http://192.168.0.5/repos/rhel70/rhel-7-server-rpms/ gpgcheck=0 enable=1

[/bash]

当然,我的目标是以后这个 lab 网内所有的机器都需要受到 satellite 6 服务器的管理和控制,并不需要在每个服务器上手动的去安装和管理 repos 内容和订阅。下面分阶段安装各种控制器节点的时候,在详细说明如何使用 satellite 6 做种子服务器生出所有的其他节点。这里的 repo 服务器还是作为最初的种子服务器,它使安装 satellite 6 服务器的源。也是作为 lab 中对于 satellite6 的一个备份选项。

NFS 服务器

本机的存储空间比较大,可以作为慢速 NFS 共享存储和 ISO 镜像文件服务器使用,因此,安装 nfs 服务器之后,就可以把本地的满速普通硬盘使用 nfs 的方式共享到 lab 内网了。配置文件参考如下: [bash] [root@w540 ~]# cat /etc/exports /data/nfs 192.168.0.(rw,async) /data/iso 192.168.0.(rw,async) /home/test 192.168.0.(rw,async) [root@w540 ~]# showmount -e localhost Export list for localhost: /home/test 192.168.0. /data/iso 192.168.0._ /data/nfs 192.168.0._ [root@w540 ~]# [/bash]

NTP 服务器

根据红帽知识库文档,选择本机这个物理服务器作为 lab 内网的时钟服务器,所有的虚拟机和其他物理机都和他同步时钟。最终的配置还没有确定。随后更新靠谱的可以供参考的配置

comments powered by Disqus
本博客始于 2007 年
Built with Hugo
主题 StackJimmy 设计