OpenStack搭建之基础环境配置(一)

该页面的操作所有环境都要配置

一、环境信息

Hostnameeth0(管理)eth1(存储)eth2en(VXLAN)OS
controller10.168.1.103 192.168.100.103vlan_flatTrunkcentos7.9
compute0110.168.1.104192.168.100.104vlan_flatTrunkcentos7.9
compute0210.168.1.105192.168.100.105vlan_flatTrunkcentos7.9

二、设置hosts

controller节点

hostnamectl set-hostname controller
cat <<EOF>>/etc/hosts
192.168.100.103 controller
192.168.100.104 compute01
192.168.100.105 compute02
EOF

compute01节点

hostnamectl set-hostname compute01
cat <<EOF>>/etc/hosts
192.168.100.103 controller
192.168.100.104 compute01
192.168.100.105 compute02
EOF

compute02节点

hostnamectl set-hostname compute02
cat <<EOF>>/etc/hosts
192.168.100.103 controller
192.168.100.104 compute01
192.168.100.105 compute02
EOF

每个节点都测试下是否生效

ping -c1 controller
ping -c1 compute01
ping -c1 compute02

三、关闭防火墙和selinux

关闭防火墙和防火墙的开机启动

systemctl stop firewalld
systemctl disable firewalld

关闭selinux

setenforce 0
sed -i '/SELINUX/s/enforcing/disabled/g' /etc/selinux/config

四、关闭swap

sed -i '/swap/s/^/#/g' /etc/fstab
swapoff -a

五、配置yum源并安装基础软件

设置yum base源为清华源

sudo sed -e 's|^mirrorlist=|#mirrorlist=|g'          -e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos|g'          -i.bak          /etc/yum.repos.d/CentOS-*.repo

设置epel扩展源为清华源

sudo yum install -y epel-release
sudo sed -e 's!^metalink=!#metalink=!g' \
    -e 's!^#baseurl=!baseurl=!g' \
    -e 's!https\?://download\.fedoraproject\.org/pub/epel!https://mirrors.tuna.tsinghua.edu.cn/epel!g' \
    -e 's!https\?://download\.example/pub/epel!https://mirrors.tuna.tsinghua.edu.cn/epel!g' \
    -i /etc/yum.repos.d/epel*.repo

重建yum索引

yum makecache

六、设置时间同步服务

安装ntpupdate服务

yum install -y ntpdate

设置定时任务,五分钟执行一次时间同步

echo "*/5 * * * * /usr/sbin/ntpdate cn.pool.ntp.org">>/tmp/crontab.txt>>/var/spool/cron/root
ntpdate cn.pool.ntp.org

七、配置OpenStack仓库

yum install -y centos-release-openstack-train
yum install -y python-openstackclient
yum install -y openstack-selinux
yum upgrade -y

执行完上面的步骤之后需要重启下所有服务器,一定要重启!!!

reboot

发表评论

后才能评论