---
title: 配置部署环境
description: "在所有主机上执行以下操作。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengcpfs/ecosystemEnable/OpenStack/kunpengopenstackceph_04_0003.html
sourcePath: /source/zh/kunpengcpfs/ecosystemEnable/OpenStack/kunpengopenstackceph_04_0003.html
indexId: 468d9e24eee8afc594e130d2122c27db13912b977c7dc04617e54ed5bfbd9ceb82
---
# 配置部署环境

#### 配置主机名

在所有主机上执行以下操作。


1. 修改主机名。
  1 hostnamectl set-hostname 主机名 --static

2. 修改“/etc/hosts”文件。
  1 vim /etc/hosts

  在hosts文件中添加集群所有节点的“地址-主机名”映射关系。


#### 关闭防火墙与SELinux

Linux系统默认开启的SELinux安全机制对于OpenStack等相关服务会做安全控制拦截，同时会阻止Ceph集群间的互相通信，导致无法正常部署OpenStack和Ceph集群。这是Linux OS本身的行为，鲲鹏BoostKit虚拟化使能套件并不对此提供详细解决方案。如果客户想在自己的系统中使用SELinux，则需要自行寻找解决方法。

针对此限制，我们提供了快速的禁用SELinux的方法。鲲鹏BoostKit虚拟化使能套件中，提供的SELinux配置方法仅供参考，需用户自行评估并承担相应风险。

禁用SELinux可能会导致安全问题，如果客户最终的解决方案本身就没有规划启用SELinux，建议通过端到端的整体方案来弥补SELinux关闭带来的风险，且需自行承担安全风险。如果客户有SELinux的需求，建议根据实际的SELinux问题进行细粒度的规则配置，并保证整个系统的安全。


1. 在Ceph1、Ceph2和Ceph3节点上关闭防火墙。
  1 2 3 [root@ceph1 ~]# systemctl stop firewalld.service && systemctl disable firewalld.service [root@ceph2 ~]# systemctl stop firewalld.service && systemctl disable firewalld.service [root@ceph3 ~]# systemctl stop firewalld.service && systemctl disable firewalld.service

2. 在所有节点关闭SELinux。
  1 setenforce 0

  该操作为临时关闭SELinux，若需永久关闭，请修改配置文件“/etc/selinux/config”，配置“SELINUX=disabled”。


#### 配置时间同步

1. 在所有节点上安装NTP服务。
  1 yum -y install ntp ntpdate

2. 在所有节点上备份旧的配置。
  1 cd /etc && mv ntp.conf ntp.conf.bak

3. 在ceph1上执行编辑文件“/etc/ntp.conf”。
  1 vim /etc/ntp.conf

  并新增以下内容： 1 2 3 4 5 restrict 127.0.0.1 restrict ::1 restrict 192.168.21.0 mask 255.255.255.0 server 127.127.1.0 fudge 127.127.1.0 stratum 8

4. 在除ceph1之外的所有节点上编辑文件“/etc/ntp.conf”。
  1 vim /etc/ntp.conf

  并新增以下内容使这些节点与ceph1进行时间同步：

```
server 192.168.21.1
```


5. 在所有节点上启动NTP服务。
  1 systemctl enable ntpd && systemctl start ntpd

6. 在除ceph1之外的所有节点执行以下命令。
  1 2 ntpdate ceph1 hwclock -w


#### 配置SSH免密登录

1. 在ceph1节点生成公钥，然后分发到所有的主机/客户机节点。
  1 ssh-keygen -t rsa

  全部回车，采取默认配置。

  1 2 3 4 5 ssh-copy-id ceph1 ssh-copy-id ceph2 ssh-copy-id ceph3 ssh-copy-id controller ssh-copy-id compute

2. 在OpenStack controller节点生成公钥，然后分发到所有的主机/客户机节点。
  1 ssh-keygen -t rsa

  全部回车，采取默认配置。

  1 2 3 4 5 ssh-copy-id ceph1 ssh-copy-id ceph2 ssh-copy-id ceph3 ssh-copy-id controller ssh-copy-id compute
