环境准备:
安装操作系统 CentOS-7-x86_64 x86_64
我的版本号:CentOS Linux release 7.2.1511 (Core)3.10.0-327.36.2.el7.x86_64
在本档中所使用的IP地址是:
Controller :192.168.31.100
node01 :192.168.31.101
1、修改主机名,并修改/etc/hosts
#vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.31.100 controller
192.168.31.101 node01
修改主机名(也可以在安装系统时直接命名为相应的名称):
#hostnamectl set-hostname controller
修改hosts文件
注:替换对应的IP地址
2、关闭防火墙并设置开机不启动
停止防火墙
#systemctl stop firewalld.service
禁止防火墙开机启动
`#systemctl disable firewalld.service`
3、关闭selinux
#sed -i "s/^SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
4、修改国内镜像源 安装epel源
#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
注:我这里使用的是阿里云的源,建议编辑repo文件将测试的地址注释掉
5、清理并生成缓存
#yum clean all
#yum makecache
6、安装NTP服务
#yum install chrony -y
7、编辑 /etc/chrony.conf 配置时间服务器地址
#vim /etc/chrony.conf
"code" class="html">...
server 192.168.31.100 iburst
...
allow 192.168.31.0/24
...
在配置文件的最后加入允许连接到控制节点的chrony后台进程
下边是对应的时间服务器地址,我使用的是中国的地址
区域[zone] 域名[Domain] IP池[IP Pool]
中国[China] cn.ntp.org.cn [202.108.6.95] [202.112.29.82] [110.75.190.198] [115.28.122.198] [182.92.12.11] [120.25.108.11] [110.75.186.249] [110.75.186.248] [110.75.186.247]
台湾 tw.ntp.org.cn [120.119.28.1]
美国[America] us.ntp.org.cn [24.56.178.140] [131.107.13.100]
新加坡 sgp.ntp.org.cn [139.162.20.174] [103.11.143.248]
韩国[korea] kr.ntp.org.cn [218.234.23.44] [211.233.40.78]
德国[Germany] de.ntp.org.cn [131.188.3.220] [131.188.3.223]
日本[Japan] jp.ntp.org.cn [133.243.238.243] [157.7.152.213]
注:将所有计算节点的服务器地址设置为控制节点的IP地址
server 192.168.31.100 iburst
8、启动NTP服务并设置NTP开机启动并查看状态
#systemctl enable chronyd.service
#systemctl start chronyd.service
#systemctl status chronyd.service
9、验证
#chronyc sources
根据不同地域或DNS显示会不一致(控制器)
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* time6.aliyun.com 2 6 17 0 +551us[ +189us] +/- 41ms
下边是计算或其它节点显示的相关内容
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^? controller 3 6 3 0 +1149us[+1149us] +/- 41ms
10、安装openstack mitaka 源
#yum install centos-release-openstack-mitaka -y
将Mitaka修改为国内源地址
#vim /etc/yum.repos.d/CentOS-OpenStack-mitaka.repo
直接将下列的内容拷贝至repo文件中
[centos-openstack-mitaka]
name=CentOS-7 - OpenStack mitaka
baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-mitaka/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud
[centos-openstack-mitaka-test]
name=CentOS-7 - OpenStack mitaka Testing
baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-mitaka/
gpgcheck=0
enabled=0
[centos-openstack-mitaka-debuginfo]
name=CentOS-7 - OpenStack mitaka - Debug
baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud
[centos-openstack-mitaka-source]
name=CentOS-7 - OpenStack mitaka - Source
baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-mitaka/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud
[rdo-trunk-mitaka-tested]
name=OpenStack mitaka Trunk Tested
baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/rdo-trunk-mitaka-tested/
gpgcheck=0
enabled=0
11、删除两个暂时没有使用的repo文件,不然在安装时全出一些错误
#rm -rf /etc/yum.repos.d/CentOS-Ceph-Hammer.repo
#rm -rf /etc/yum.repos.d/CentOS-QEMU-EV.repo
12、清理并生成缓存
#yum clean all
#yum makecache
13、更新操作系统,时间取决于网速,请耐心等待
#yum update -y
14、重启操作系统
#reboot
15、虚拟机可以关机后做个快照
#init 0