Welcome to Elvin's blog

openstack集群环境准备

 #0.openstack集群环境准备

openstack pike 部署 目录汇总 http://www.cnblogs.com/elvi/p/7613861.html

#openstack集群环境准备
#centos7.4 x86_64

#更改grub启动项,更改等待时间,更改字符界面
[[ `uname -r` = *el6* ]] && { Grubcfg=/boot/grub/grub.cfg; } || { Grubcfg=/boot/grub2/grub.cfg; }
echo  "修改 $Grubcfg"
cp $Grubcfg{,.bak}
sed -i 's#timeout=5#timeout=2#g' $Grubcfg
sed -i 's#rhgb##g' $Grubcfg

#关闭selinux、防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state
sed -i '/^SELINUX=.*/c SELINUX=disabled' /etc/selinux/config
sed -i 's/^SELINUXTYPE=.*/SELINUXTYPE=disabled/g' /etc/selinux/config
grep --color=auto '^SELINUX' /etc/selinux/config
setenforce 0

#时间同步
/usr/sbin/ntpdate ntp6.aliyun.com 
echo "*/3 * * * * /usr/sbin/ntpdate ntp6.aliyun.com  &> /dev/null" > /tmp/crontab
crontab /tmp/crontab

#推荐部署几个内网时间同步服务
#chrony时间同步 http://www.cnblogs.com/elvi/p/7658021.html
#NTP时间同步 http://www.cnblogs.com/elvi/p/7657994.html



#设置hostname, 每个节点分别设置
hostnamectl set-hostname controller1

#设置ip
NetName=ens37 #网卡名称
rm -f /etc/sysconfig/network-scripts/ifcfg-$NetName
nmcli con add con-name $NetName ifname $NetName autoconnect yes type ethernet ip4 192.168.58.99/24 \
 ipv4.dns "172.16.11.14 172.16.11.13" #ipv4.gateway "192.168.58.1"
nmcli connection reload #重新加载网络

#查看本机IP
ip add|sed -nr  's#^.*inet (.*)/24.*$#\1#gp'

#系统2个网络
#192.168.58.0 内部网络
#10.2.1.0     外部网络

#IP规划,hosts设置
echo '
10.2.1.10       controller #vip
192.168.58.21   controller1
192.168.58.22   controller2
192.168.58.23   controller3
192.168.58.24   cinder1
192.168.58.31   computer01
192.168.58.32   computer02
'>>/etc/hosts

# ssh免密验证
#############################
controller1设置
ssh-keygen -t rsa -P '' -f ~/.ssh/id_dsa
ssh-copy-id -i ~/.ssh/id_dsa.pub root@controller2
ssh-copy-id -i ~/.ssh/id_dsa.pub root@controller3

#可使用shell脚本批量设置 http://www.cnblogs.com/elvi/p/7681779.html
#controller1、controller2、controller3都要设置

#验证
ssh controller1 hostname
ssh controller2 hostname
ssh controller3 hostname
###############################

#备份默认yum源(不使用自建源就不要操作)
mkdir -p ./it/yum.bak
mv /etc/yum.repos.d/*.repo ./it/yum.bak/

#使用自建yum源非常重要,保证后续添加新的节点,软件版本一致
#自建yum源部署,参考http://www.cnblogs.com/elvi/p/7657770.html
wget -O /etc/yum.repos.d/Lan7.repo http://172.16.11.25/share/Lan7.repo
yum clean all && yum makecache #生成缓存
# #若没自建源,安装OpenStack官方源
# #yum install centos-release-openstack-pike -y 

##OpenStack tools 安装
yum install -y python-openstackclient openstack-selinux python2-PyMySQL openstack-utils 

#升级,重启
yum update -y  && reboot

 

posted @ 2017-10-26 20:23  blog-elvin-vip  阅读(4364)  评论(0编辑  收藏  举报