注:完全参考官方文档实验,仅学习记录,后续不作说明。
使用VBOX实验,创建2个虚拟机分别用于控制和计算节点,分配2个网卡,其中一个网卡可以使用“NAT网络”,将自动生成的网卡设置为10.0.0.1,作为虚拟机网关同时以便实体机能直接访问虚拟机。另一个网卡使用桥接模式。如果使用XSHELL连接,可以使用“NAT网络”中端口映射以便访问10.0.0.X。使用“NAT网络”而不是“NAT”的好处一可以定义IP地址段,二可以上网。其他节点仅需分配一个网卡,使用“NAT网络”。
一.环境准备
1.1配置网卡,设置静态IP地址和DNS,VBOX中网卡需要开启混杂模式,即”允许全部“
[root@controller1 ~]#vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 [root@controller1 ~]#vi /etc/resolv.conf [root@compute1 ~]#vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 [root@compute1 ~]#vi /etc/resolv.conf
1.2设置主机名称和HOSTS文件并PING测试
[root@controller1 ~]# hostnamectl set-hostname controller1[root@controller1 ~]# vi /etc/hosts10.0.0.11 controller1 controller110.0.0.31 compute110.0.0.41 block110.0.0.51 object1 10.0.0.52 object2[root@controller1 ~]# hostnamectl status[root@compute1 ~]#hostnamectl set-hostname compute1[root@compute1 ~]#vi /etc/hosts10.0.0.11 controller1 controller110.0.0.31 compute110.0.0.41 block110.0.0.51 object1 10.0.0.52 object2[root@compute1 ~]# hostnamectl status
1.3关闭防火墙和SELINUX
[root@compute1 ~]# systemctl stop firewalld.service[root@compute1 ~]# systemctl disable firewalld.serviceRemoved symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.[root@compute1 ~]# vi /etc/selinux/config SELINUX=disabled
1.4更新系统
[root@compute1 ~]# yum update
2.1配置时间同步(controller1)
[root@comtroller1 ~]# yum remove chrony[root@compute1 ~]# yum install ntp[root@comtroller1 ~]# vi /etc/ntp.conf restrict 10.0.0.0 mask 255.255.255.0 nomodify notrapserver s2m.time.edu.cnserver 210.72.145.44restrict 210.72.145.44 nomodify notrap noqueryserver 127.127.0.1fudge 127.127.0.1 stratum 10[root@comtroller1 ~]# systemctl start ntpd.service[root@comtroller1 ~]# systemctl enable ntpd.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
2.2配置节点时间同步(compute1)
[root@compute1 ~]# yum remove chrony[root@compute1 ~]# yum install ntp[root@compute1 ~]# vi /etc/ntp.confserver controller1restrict controller1 nomodify notrap noqueryserver 127.127.0.1fudge 127.127.0.1 stratum 10[root@compute1 ~]# systemctl start ntpd.service[root@compute1 ~]# systemctl enable ntpd.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.[root@compute1 ~]# ntpstatsynchronised to NTP server (10.0.0.11) at stratum 5 time correct to within 113 ms polling server every 64 s [root@compute1 ~]# ntpdate -u 10.0.0.1114 Jul 14:51:51 ntpdate[15782]: adjust time server 10.0.0.11 offset -0.011970 sec[root@compute1 ~]# hwclock --systohc
3.1安装OpenStack packages
[root@controller1 ~]# yum install centos-release-openstack-liberty
3.2更新系统
[root@controller1 ~]# yum upgrade
3.3安装OpenStack客户端
[root@controller1 ~]# yum install python-openstackclient
3.4如果开启了SELINUX,则需要安装如下包
[root@controller1 ~]# yum install openstack-selinux
4.1数据库安装
[root@comtroller1 ~]# yum install mariadb mariadb-server MySQL-python
4.2拷贝并编辑配置文件
[root@comtroller1 ~]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf.d/mariadb_openstack.cnf[root@comtroller1 ~]# vi /etc/my.cnf.d/mariadb_openstack.cnf[mysqld]bind-address = 10.0.0.11default-storage-engine = innodb innodb_file_per_table collation-server = utf8_general_ci init-connect = 'SET NAMES utf8' character-set-server = utf8
4.3启动和设置开机自启动
[root@comtroller1 ~]# systemctl enable mariadb.service[root@comtroller1 ~]# systemctl start mariadb.service
4.4设置数据库密码
[root@comtroller1 ~]# mysql_secure_installation
4.5验证数据库配置
[root@comtroller1 ~]# mysql -uroot -p
5.1安装mongodb (nosql数据库,仅安装Telemetry 时需要)
[root@comtroller1 ~]# yum install mongodb-server mongodb
5.2编辑配置文件
[root@comtroller1 ~]# vi /etc/mongod.confbind_ip = 10.0.0.11smallfiles = true ##此处可选配置,手册描述和实际有差,待确认
5.3启动和设置开机自启动
[root@controller1 mongodb]# systemctl enable mongod.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/mongod.service to /usr/lib/systemd/system/mongod.service.[root@controller1 mongodb]# systemctl start mongod.service
6.1安装消息队列rabbitmq
[root@controller1 ~]# yum install rabbitmq-server
6.2启动和设置开机自启动
[root@controller1 ~]# systemctl enable rabbitmq-server.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.[root@controller1 ~]# systemctl start rabbitmq-server.service
6.3添加用户并设置密码
[root@controller1 ~]# rabbitmqctl add_user openstack openstackCreating user "openstack" ...
6.4设置用户权限
[root@controller1 ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"Setting permissions for user "openstack" in vhost "/" ...