先电云iaas(openstack)超级详细搭建(三)安装服务

版权声明:@抛物线 https://blog.csdn.net/qq_28513801/article/details/90145192

注意:接与上一篇博客内容 进行更新
由于整个开源openstack安装过程过于繁琐,命令太长,太繁琐,于是把整个安装命令写成shell脚本。

脚本数量内容过多,已经推送自我的github源码托管中心了。

这是本篇脚本内容所在的github仓库位置
[root@controller centos]# cd /usr/local/bin/这是所有需要的脚本的整个路径
脚本内容介绍

#/bin/bash
source /etc/xiandian/openrc.sh
# config env network
systemctl  stop firewalld.service
systemctl  disable  firewalld.service >> /dev/null 2>&1
systemctl stop NetworkManager >> /dev/null 2>&1
systemctl disable NetworkManager >> /dev/null 2>&1
sed -i 's/SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config
setenforce 0
yum remove -y NetworkManager firewalld
service network restart
#----  ntp  ---------------------------------
yum install ntp  iptables-services  -y
if [ 0  -ne  $? ]; then
        echo -e "\033[31mThe installation source configuration errors\033[0m"
        exit 1
fi
systemctl enable iptables
systemctl restart iptables
iptables -F
iptables -X
iptables -X
service iptables save
# install package
sed -i -e 's/#UseDNS yes/UseDNS no/g' -e 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
yum upgrade -y
yum -y install openstack-selinux python-openstackclient crudini -y
if [[ `ip a |grep -w $HOST_IP ` != '' ]];then
        hostnamectl set-hostname $HOST_NAME
elif [[ `ip a |grep -w $HOST_IP_NODE ` != '' ]];then
        hostnamectl set-hostname $HOST_NAME_NODE
else
        hostnamectl set-hostname $HOST_NAME
fi
sed -i -e "/$HOST_NAME/d" -e "/$HOST_NAME_NODE/d" /etc/hosts
echo "$HOST_IP $HOST_NAME" >> /etc/hosts
echo "$HOST_IP_NODE $HOST_NAME_NODE" >> /etc/hosts
printf "\033[35mPlease Reboot or Reconnect the terminal\n\033[0m"

1.5通过脚本安装服务

1.6-1.9的基础配置操作命令已经编写成shell脚本,通过脚本进行一键安装。如下:
#Controller节点和Compute节点
执行脚本iaas-pre-host.sh进行安装
# 安装完成后同时重启
[root@controller ~]# reboot


下面是整个安装细节命令(脚本中已经包含该命令)

1.6安装Openstack包
# controller和compute节点
# yum -y install openstack-utils openstack-selinux python-openstackclient
# yum upgrade
1.7配置域名解析
修改/etc/hosts添加一下内容
(1)controller 节点
20.0.0.10   controller
20.0.0.20   compute
(2)compute 节点
20.0.0.10   controller
20.0.0.20   compute
1.8配置防火墙和Selinux
编辑selinux文件
# vi /etc/selinux/config
SELINUX=permissive
关闭防火墙并设置开机不自启
# systemctl stop firewalld.service
# systemctl disable firewalld.service
# yum remove -y NetworkManager firewalld
# yum -y install iptables-services
# systemctl enable iptables
# systemctl restart iptables
# iptables -F
# iptables -X
# iptables -X
# service iptables save
1.9安装ntp服务
(1)controller和compute节点
# yum -y install ntp
(2)配置controller节点
编辑/etc/ntp.conf文件
添加以下内容(删除默认sever规则)
server 127.127.1.0
fudge 127.127.1.0   stratum 10
启动ntp服务器
# service ntpd start 
# chkconfig ntpd on
(3)配置compute节点
# ntpdate controller
# chkconfig ntpdate on

猜你喜欢

转载自blog.csdn.net/qq_28513801/article/details/90145192
今日推荐