中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

OpenStack-Rocky版單機部署

發布時間:2020-05-30 01:40:45 來源:網絡 閱讀:5528 作者:灬落魄灬 欄目:云計算

1.安裝環境:

操作系統:centos 7.5
地址規劃:192.168.254.10 openstack-server
架構:所有組件(包括控制節點、計算節點、網絡節點)全部安裝一個節點

2.系統配置:

[root@localhost ~]# hostname openstack-server
[root@openstack-server ~]# vim /etc/hostname
openstack-server
[root@openstack-server ~]# vim /etc/hosts
192.168.254.10  openstack-server openstack-server.smoke.com
[root@openstack-server ~]# ifconfig
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.254.10  netmask 255.255.255.224  broadcast 192.168.254.31
        inet6 fe80::119a:26d0:b028:74d0  prefixlen 64  scopeid 0x20<link>
        ether 00:e0:4c:0f:ff:a9  txqueuelen 1000  (Ethernet)
        RX packets 42277  bytes 39441483 (37.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14912  bytes 1016294 (992.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 32  bytes 2792 (2.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 32  bytes 2792 (2.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

3.安裝時間同步服務NTP:
[root@openstack-server ~]# yum install chrony

修改chrony服務配置:

[root@openstack-server ~]# vim /etc/chrony.conf
allow 192.168.254.0/27

啟動chrony服務:

[root@openstack-server ~]# systemctl enable chronyd.service
[root@openstack-server ~]# systemctl start chronyd.service

設置時區:
[root@openstack-server ~]# timedatectl set-timezone Asia/Shanghai

4.安裝阿里的OpenStack源:

[root@openstack-server ~]# vim /etc/yum.repos.d/OpenStack-Rocky.repo
[openstack-rocky]
name=openstack-rocky
baseurl=https://mirrors.aliyun.com/centos/7.5.1804/cloud/x86_64/openstack-rocky/
gpgcheck=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
repo_gpgcheck=0
enabled=1
[root@openstack-server ~]# yum clean all
[root@openstack-server ~]# yum makecache

還可以使用官方yum源方式:

[root@openstack-server ~]#  yum install centos-release-openstack-rocky
[root@openstack-server ~]# yum install https://rdoproject.org/repos/rdo-release.rpm  

升級軟件包:
[root@openstack-server ~]# yum -y upgrade

安裝OpenStack client:
[root@openstack-server ~]# yum -y install python-openstackclient

安裝openstack-selinux:
[root@openstack-server ~]# yum -y install openstack-selinux

5.安裝Mariadb:
[root@openstack-server ~]# yum -y install mariadb mariadb-server python2-PyMySQL

修改Mariadb配置文件:

[root@openstack-server ~]# mv /etc/my.cnf /etc/my.cnf.bak
[root@openstack-server ~]# cp /usr/share/mariadb/my-large.cnf /etc/my.cnf
[root@openstack-server ~]# vim /etc/my.cnf
[mysqld]
bind-address = 192.168.254.10

default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

啟動Mariadb服務:

[root@openstack-server ~]# systemctl enable mariadb.service
[root@openstack-server ~]# systemctl start mariadb.service

初始化Mariadb:
[root@openstack-server ~]# mysql_secure_installation(按提示操作設置root密碼)

6.安裝rabbitmq-server:
[root@openstack-server ~]# yum -y install rabbitmq-server

啟動rabbitmq-server服務:

[root@openstack-server ~]# systemctl enable rabbitmq-server.service
[root@openstack-server ~]# systemctl start rabbitmq-server.service

添加openstack用戶:

[root@openstack-server ~]# rabbitmqctl add_user openstack openstack
[root@openstack-server ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"

開啟web管理插件:
[root@openstack-server ~]# rabbitmq-plugins enable rabbitmq_management

使用web訪問rabbitmq-server(默認賬號guest,密碼guest):
OpenStack-Rocky版單機部署

設置openstack用戶Tags為administrator(點擊Admin -- openstack):
OpenStack-Rocky版單機部署

點擊Update this user:
OpenStack-Rocky版單機部署

查看設置:
OpenStack-Rocky版單機部署

7.安裝memcached:
[root@openstack-server ~]# yum -y install memcached python-memcached

修改memcached服務配置:

[root@openstack-server ~]# vim  /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 0.0.0.0,::1"

啟動memcached服務:

[root@openstack-server ~]# systemctl enable memcached.service
[root@openstack-server ~]# systemctl start memcached.service

8.安裝etcd服務:
[root@openstack-server ~]# yum -y install etcd

修改etcd服務配置:

[root@openstack-server ~]# vim  /etc/etcd/etcd.conf
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://192.168.254.10:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.254.10:2379"
ETCD_NAME="openstack-server"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://192.168.254.10:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.254.10:2379"
ETCD_INITIAL_CLUSTER="openstack-server=http://192.168.254.10:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"

啟動etcd服務:

[root@openstack-server ~]# systemctl enable etcd
[root@openstack-server ~]# systemctl start etcd

9.安裝keystone:
在Mariadb創建keystone庫和用戶:

[root@openstack-server ~]# mysql -uroot -psmoke520 -e "CREATE DATABASE keystone;"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystone';"

安裝keystone:
[root@openstack-server ~]# yum -y install openstack-keystone httpd mod_wsgi

修改keystone服務配置:

[root@openstack-server ~]# vim /etc/keystone/keystone.conf
[database]
connection = mysql+pymysql://keystone:keystone@openstack-server/keystone
[token]
provider = fernet

同步數據庫:
[root@openstack-server ~]# su -s /bin/sh -c "keystone-manage db_sync" keystone

初始化Fernet key倉庫:

[root@openstack-server ~]# keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
[root@openstack-server ~]# keystone-manage credential_setup --keystone-user keystone --keystone-group keystone

引導身份服務:

[root@openstack-server ~]# keystone-manage bootstrap --bootstrap-password admin \
>   --bootstrap-admin-url http://openstack-server:5000/v3/ \
>   --bootstrap-internal-url http://openstack-server:5000/v3/ \
>   --bootstrap-public-url http://openstack-server:5000/v3/ \
>   --bootstrap-region-id RegionOne

修改httpd服務配置:

[root@openstack-server ~]# vim /etc/httpd/conf/httpd.conf
ServerName openstack-server

創建wsgi-keysone配置文件鏈接:
[root@openstack-server ~]# ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/

啟動httpd服務:

[root@openstack-server ~]# systemctl enable httpd.service
[root@openstack-server ~]# systemctl start httpd.service
[root@openstack-server ~]# vim admin-openrc.sh
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://openstack-server:5000/v3
export OS_IDENTITY_API_VERSION=3

創建域,項目,用戶,角色:

[root@openstack-server ~]# . admin-openrc.sh
[root@openstack-server ~]# openstack domain create --description "An Example Domain" example
[root@openstack-server ~]# openstack project create --domain default \
>   --description "Service Project" service
[root@openstack-server ~]# openstack project create --domain default \
>   --description "Demo Project" myproject
[root@openstack-server ~]# openstack user create --domain default \
>   --password-prompt myuser
[root@openstack-server ~]# openstack role create myrole
[root@openstack-server ~]# openstack role add --project myproject --user myuser myrole

驗證keystone是否安裝成功:

[root@openstack-server ~]# unset OS_AUTH_URL OS_PASSWORD
[root@openstack-server ~]# openstack --os-auth-url http://openstack-server:5000/v3 --os-project-domain-name Default --os-user-domain-name Default   --os-project-name admin --os-username admin token issue

創建myuser環境變量:

[root@openstack-server ~]# vim myuser-openrc.sh
export OS_USERNAME=myuser
export OS_PASSWORD=myuser
export OS_PROJECT_NAME=myproject
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://openstack-server:5000/v3
export OS_IDENTITY_API_VERSION=3

使用myuser用戶進行測試:

[root@openstack-server ~]# . myuser-openrc.sh
[root@openstack-server ~]#  openstack --os-auth-url http://openstack-server:5000/v3 \
>   --os-project-domain-name Default --os-user-domain-name Default \
>   --os-project-name myproject --os-username myuser token issue

修改用戶環境變量腳本:

[root@openstack-server ~]# vim admin-openrc.sh
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://openstack-server:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
[root@openstack-server ~]# vim myuser-openrc.sh
export OS_USERNAME=myuser
export OS_PASSWORD=myuser
export OS_PROJECT_NAME=myproject
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://openstack-server:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2

使用腳本測試:

[root@openstack-server ~]# . admin-openrc.sh
[root@openstack-server ~]# openstack token issue

10.安裝glance:
在Mariadb創建glance庫和用戶:

[root@openstack-server ~]# mysql -uroot -psmoke520 -e "CREATE DATABASE glance;"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance';"

創建glance用戶,服務,端點:

[root@openstack-server ~]# . admin-openrc.sh
[root@openstack-server ~]# openstack user create --domain default --password-prompt glance
[root@openstack-server ~]# openstack role add --project service --user glance admin
[root@openstack-server ~]# openstack service create --name glance \
>   --description "OpenStack Image" image
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   image public http://openstack-server:9292
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   image internal http://openstack-server:9292
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   image admin http://openstack-server:9292

安裝glance:
[root@openstack-server ~]# yum -y install openstack-glance

修改glance-api和glance-registry服務配置:

[root@openstack-server ~]# vim /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:glance@openstack-server/glance
[keystone_authtoken]
www_authenticate_uri = http://openstack-server:5000
auth_url = http://openstack-server:5000
memcached_servers = openstack-server:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images
[root@openstack-server ~]# vim /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:glance@openstack-server/glance
[keystone_authtoken]
www_authenticate_uri = http://openstack-server:5000
auth_url = http://openstack-server:5000
memcached_servers = openstack-server:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance
[paste_deploy]
flavor = keystone

同步glance數據庫:
[root@openstack-server ~]# su -s /bin/sh -c "glance-manage db_sync" glance

啟動glance-api和glance-registry服務:

[root@openstack-server ~]# systemctl enable openstack-glance-api.service \
>   openstack-glance-registry.service
[root@openstack-server ~]# systemctl start openstack-glance-api.service \
>   openstack-glance-registry.service

使用sdb1創建lvm用于存儲鏡像:

[root@openstack-server ~]# fdisk -l /dev/sdb

磁盤 /dev/sdb:250.1 GB, 250059350016 字節,488397168 個扇區
Units = 扇區 of 1 * 512 = 512 bytes
扇區大小(邏輯/物理):512 字節 / 512 字節
I/O 大小(最小/最佳):512 字節 / 512 字節
磁盤標簽類型:dos
磁盤標識符:0x441e1e17

   設備 Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   104859647    52428800   8e  Linux LVM
[root@openstack-server ~]# pvcreate /dev/sdb1
[root@openstack-server ~]# vgcreate glance-vg /dev/sdb1
[root@openstack-server ~]# lvcreate -L 50G -n glance-lv glance-vg
[root@openstack-server ~]# mkfs.xfs /dev/glance-vg/glance-lv
[root@openstack-server ~]# blkid /dev/glance-vg/glance-lv
/dev/glance-vg/glance-lv: UUID="072c4d36-7502-484b-b857-357a870dcc87" TYPE="xfs"
[root@openstack-server ~]# vim /etc/fstab
UUID=072c4d36-7502-484b-b857-357a870dcc87       /var/lib/glance/images/ xfs     defaults        0 0
[root@openstack-server ~]# mount -a
[root@openstack-server ~]# chown -R glance:glance /var/lib/glance/

驗證操作:

[root@openstack-server ~]# . admin-openrc.sh
[root@openstack-server ~]# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
[root@openstack-server ~]# openstack image create "cirros" \
>   --file cirros-0.4.0-x86_64-disk.img \
>   --disk-format qcow2 --container-format bare \
>   --public
[root@openstack-server ~]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 99b186e3-b29f-4366-ab5c-ebf5e53ef262 | cirros | active |
+--------------------------------------+--------+--------+

11.安裝nova:
在Mariadb創建nova相關庫和用戶(控制節點):

[root@openstack-server ~]# mysql -uroot -psmoke520 -e "CREATE DATABASE nova_api;"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "CREATE DATABASE nova;"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "CREATE DATABASE nova_cell0;"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "CREATE DATABASE placement;"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
> IDENTIFIED BY 'nova';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
> IDENTIFIED BY 'nova';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
>  IDENTIFIED BY 'nova';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
>  IDENTIFIED BY 'nova';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \
>  IDENTIFIED BY 'nova';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' \
>  IDENTIFIED BY 'nova';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' \
>  IDENTIFIED BY 'placement';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' \
>  IDENTIFIED BY 'placement';"

創建nova用戶,服務,端點;

[root@openstack-server ~]# . admin-openrc.sh
[root@openstack-server ~]# openstack user create --domain default --password-prompt nova
[root@openstack-server ~]# openstack role add --project service --user nova admin
[root@openstack-server ~]# openstack service create --name nova \
>   --description "OpenStack Compute" compute
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   compute public http://openstack-server:8774/v2.1
[root@openstack-server ~]#  openstack endpoint create --region RegionOne \
>   compute internal http://openstack-server:8774/v2.1
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   compute admin http://openstack-server:8774/v2.1

創建placement用戶,服務,端點:

[root@openstack-server ~]#  openstack user create --domain default --password-prompt placement
[root@openstack-server ~]# openstack role add --project service --user placement admin
[root@openstack-server ~]# openstack service create --name placement \
>   --description "Placement API" placement
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   placement public http://openstack-server:8778
[root@openstack-server ~]#  openstack endpoint create --region RegionOne \
>   placement internal http://openstack-server:8778
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   placement admin http://openstack-server:8778

安裝nove-api、nova-conductor、nova-console、nova-novncproxy、nova-schedule、nova-placement-api服務(控制節點):

[root@openstack-server ~]# yum -y install openstack-nova-api openstack-nova-conductor \
>   openstack-nova-console openstack-nova-novncproxy \
>   openstack-nova-scheduler openstack-nova-placement-api

修改nova服務配置:

[root@openstack-server ~]# vim /etc/nova/nova.conf
[DEFAULT]
enabled_apis=osapi_compute,metadata
transport_url=rabbit://openstack:openstack@openstack-server
my_ip=192.168.254.10
use_neutron=true
firewall_driver=nova.virt.firewall.NoopFirewallDriver
[api_database]
connection=mysql+pymysql://nova:nova@openstack-server/nova_api
[database]
connection=mysql+pymysql://nova:nova@openstack-server/nova
[placement_database]
connection=mysql+pymysql://placement:placement@openstack-server/placement
[api]
auth_strategy=keystone
[keystone_authtoken]
auth_url=http://openstack-server:5000/v3
memcached_servers=openstack-server:11211
auth_type=password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova
[vnc]
enabled=true
server_listen=0.0.0.0
server_proxyclient_address=$my_ip
[glance]
api_servers=http://openstack-server:9292
[oslo_concurrency]
lock_path=/var/lib/nova/tmp
[placement]
region_name=RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://openstack-server:5000/v3
username = placement
password = placement

官網文檔提示包bug問題,需要修改 /etc/httpd/conf.d/00-nova-placement-api.conf,添加/usr/bin相關內容到文件尾部;

[root@openstack-server ~]# vim  /etc/httpd/conf.d/00-nova-placement-api.conf
<Directory /usr/bin>
   <IfVersion >= 2.4>
      Require all granted
   </IfVersion>
   <IfVersion < 2.4>
      Order allow,deny
      Allow from all
   </IfVersion>
</Directory>

重啟httpd服務:
[root@openstack-server ~]# systemctl restart httpd

同步nova數據庫:

[root@openstack-server ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
[root@openstack-server ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
[root@openstack-server ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova
28087259-877a-4ff7-b2a3-a4367a1fbd8d
[root@openstack-server ~]# su -s /bin/sh -c "nova-manage db sync" nova
[root@openstack-server ~]# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova

啟動nova-api、nova-scheduler、nova-conductor、nova-novncproxy服務:

[root@openstack-server ~]# systemctl enable openstack-nova-api.service \
>   openstack-nova-scheduler.service openstack-nova-conductor.service \
>   openstack-nova-novncproxy.service
[root@openstack-server ~]# systemctl start openstack-nova-api.service \
>   openstack-nova-scheduler.service openstack-nova-conductor.service \
>   openstack-nova-novncproxy.service

安裝nova-compute(計算節點):
[root@openstack-server ~]# yum install openstack-nova-compute

修改nova配置文件:

[root@openstack-server ~]# vim /etc/nova/nova.conf
[DEFAULT]
enabled_apis=osapi_compute,metadata
transport_url=rabbit://openstack:openstack@openstack-server
my_ip=192.168.254.10
use_neutron=true
firewall_driver=nova.virt.firewall.NoopFirewallDriver
[api]
auth_strategy=keystone
[keystone_authtoken]
auth_url = http://openstack-server:5000/v3
memcached_servers=openstack-server:11211
auth_type=password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = nova
[vnc]
enabled=true
server_listen=0.0.0.0
server_proxyclient_address=$my_ip
novncproxy_base_url = http://openstack-server:6080/vnc_auto.html
[glance]
api_servers=http://openstack-server:9292
[oslo_concurrency]
lock_path=/var/lib/nova/tmp
[placement]
region_name=RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://openstack-server:5000/v3
username = placement
password = placement

查看cpu是否支持虛擬化(0代表不支持):

[root@openstack-server ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
4

修改虛擬化類型,如果不支持cpu虛擬化使用qemu,如果支持使用kvm:

[root@openstack-server ~]# vim /etc/nova/nova.conf
[libvirt]
virt_type=kvm

啟動nova-compute和libvirtd服務:

[root@openstack-server ~]#  systemctl enable libvirtd.service openstack-nova-compute.service
[root@openstack-server ~]# systemctl start libvirtd.service openstack-nova-compute.service

將計算節點cell數據庫:

[root@openstack-server ~]# . admin-openrc.sh
[root@openstack-server ~]# openstack compute service list --service nova-compute
[root@openstack-server ~]# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

編輯nova服務配置:

[root@openstack-server ~]# vim /etc/nova/nova.conf
[scheduler]
discover_hosts_in_cells_interval=300

驗證操作:
[root@openstack-server ~]# . admin-openrc.sh

[root@openstack-server ~]# openstack compute service list
+----+----------------+------------------+----------+---------+-------+----------------------------+
| ID | Binary         | Host             | Zone     | Status  | State | Updated At                 |
+----+----------------+------------------+----------+---------+-------+----------------------------+
|  1 | nova-conductor | openstack-server | internal | enabled | up    | 2018-10-23T13:45:26.000000 |
|  3 | nova-scheduler | openstack-server | internal | enabled | up    | 2018-10-23T13:45:26.000000 |
| 10 | nova-compute   | openstack-server | nova     | enabled | up    | 2018-10-23T13:45:27.000000 |
+----+----------------+------------------+----------+---------+-------+----------------------------+
[root@openstack-server ~]# openstack catalog list
+-----------+-----------+-----------------------------------------------+
| Name      | Type      | Endpoints                                     |
+-----------+-----------+-----------------------------------------------+
| glance    | image     | RegionOne                                     |
|           |           |   internal: http://openstack-server:9292      |
|           |           | RegionOne                                     |
|           |           |   public: http://openstack-server:9292        |
|           |           | RegionOne                                     |
|           |           |   admin: http://openstack-server:9292         |
|           |           |                                               |
| keystone  | identity  | RegionOne                                     |
|           |           |   admin: http://openstack-server:5000/v3/     |
|           |           | RegionOne                                     |
|           |           |   internal: http://openstack-server:5000/v3/  |
|           |           | RegionOne                                     |
|           |           |   public: http://openstack-server:5000/v3/    |
|           |           |                                               |
| placement | placement | RegionOne                                     |
|           |           |   public: http://openstack-server:8778        |
|           |           | RegionOne                                     |
|           |           |   admin: http://openstack-server:8778         |
|           |           | RegionOne                                     |
|           |           |   internal: http://openstack-server:8778      |
|           |           |                                               |
| nova      | compute   | RegionOne                                     |
|           |           |   public: http://openstack-server:8774/v2.1   |
|           |           | RegionOne                                     |
|           |           |   admin: http://openstack-server:8774/v2.1    |
|           |           | RegionOne                                     |
|           |           |   internal: http://openstack-server:8774/v2.1 |
|           |           |                                               |
+-----------+-----------+-----------------------------------------------+
[root@openstack-server ~]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 99b186e3-b29f-4366-ab5c-ebf5e53ef262 | cirros | active |
+--------------------------------------+--------+--------+
[root@openstack-server ~]# nova-status upgrade check
+-------------------------------+
| 升級檢查結果                  |
+-------------------------------+
| 檢查: Cells v2                |
| 結果: 成功                    |
| 詳情: None                    |
+-------------------------------+
| 檢查: Placement API           |
| 結果: 成功                    |
| 詳情: None                    |
+-------------------------------+
| 檢查: Resource Providers      |
| 結果: 成功                    |
| 詳情: None                    |
+-------------------------------+
| 檢查: Ironic Flavor Migration |
| 結果: 成功                    |
| 詳情: None                    |
+-------------------------------+
| 檢查: API Service Version     |
| 結果: 成功                    |
| 詳情: None                    |
+-------------------------------+
| 檢查: Request Spec Migration  |
| 結果: 成功                    |
| 詳情: None                    |
+-------------------------------+

12.安裝neutron:
在Mariadb創建neutron相關庫和用戶(控制節點):

[root@openstack-server ~]# mysql -uroot -psmoke520 -e "CREATE DATABASE neutron;"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost'   IDENTIFIED BY 'neutron';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%'   IDENTIFIED BY 'neutron';"

創建neutron用戶、服務、端點;

[root@openstack-server ~]# . admin-openrc.sh
[root@openstack-server ~]# openstack user create --domain default --password-prompt neutron
[root@openstack-server ~]#  openstack role add --project service --user neutron admin
[root@openstack-server ~]# openstack service create --name neutron \
>   --description "OpenStack Networking" network
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   network public http://openstack-server:9696
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   network internal http://openstack-server:9696
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   network admin http://openstack-server:9696

Networking Option 1: Provider networks:
安裝neutron、neutron-ml2、neutron-linuxbridge、ebtables:

[root@openstack-server ~]# yum -y install openstack-neutron openstack-neutron-ml2 \
>   openstack-neutron-linuxbridge ebtables

修改neutron服務配置:

[root@openstack-server ~]# vim /etc/neutron/neutron.conf
[database]
connection = mysql+pymysql://neutron:neutron@openstack-server/neutron
[DEFAULT]
core_plugin = ml2
transport_url = rabbit://openstack:openstack@openstack-server
auth_strategy = keystone
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
[keystone_authtoken]
www_authenticate_uri = http://openstack-server:5000
auth_url = http://openstack-server:5000
memcached_servers = openstack-server:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron
[nova]
auth_url = http://openstack-server:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = nova
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp

修改ml2配置文件:

[root@openstack-server ~]# vim /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = flat,vlan
tenant_network_types = flat
mechanism_drivers = linuxbridge
extension_drivers = port_security
[ml2_type_flat]
flat_networks = provider
[securitygroup]
enable_ipset = true

修改linuxbridge_agent配置文件:

[root@openstack-server ~]# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:enp4s0
[vxlan]
enable_vxlan = false
[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

開啟系統內核支持網絡橋防火墻:

[root@openstack-server ~]# modprobe bridge
[root@openstack-server ~]# modprobe br_netfilter
[root@openstack-server ~]# vim /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
[root@openstack-server ~]# sysctl -p /etc/sysctl.conf

修改dhcp_agent配置文件:

[root@openstack-server ~]# vim /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true

Networking Option 2: Self-service networks:
安裝openstack-neutron、openstack-neutron-ml2、openstack-neutron-linuxbridge、ebtables服務;

[root@openstack-server ~]# yum install openstack-neutron openstack-neutron-ml2 \
>   openstack-neutron-linuxbridge ebtables

修改neutron服務配置:

[root@openstack-server ~]# vim  /etc/neutron/neutron.conf
[database]
connection = mysql+pymysql://neutron:neutron@openstack-server/neutron
[DEFAULT]
core_plugin = ml2
service_plugins = router
transport_url = rabbit://openstack:openstack@openstack-server
auth_strategy = keystone
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
[keystone_authtoken]
www_authenticate_uri = http://openstack-server:5000
auth_url = http://openstack-server:5000
memcached_servers = openstack-server:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron
[nova]
auth_url = http://openstack-server:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = nova
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp

修改ml2配置文件:

[root@openstack-server ~]# vim /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = flat,vlan,vxlan
tenant_network_types = vxlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security
[ml2_type_flat]
flat_networks = provider
[ml2_type_vxlan]
vni_ranges = 1:1000
[securitygroup]
enable_ipset = true

修改linuxbridge_agent配置文件:

[root@openstack-server ~]# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:enp4s0
[vxlan]
enable_vxlan = true
local_ip = 192.168.254.10
l2_population = true
[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

開啟系統內核支持網絡橋防火墻:

[root@openstack-server ~]# modprobe bridge
[root@openstack-server ~]# modprobe br_netfilter
[root@openstack-server ~]# vim /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
[root@openstack-server ~]# sysctl -p /etc/sysctl.conf

修改layer-3_agent配置文件:

[root@openstack-server ~]# vim /etc/neutron/l3_agent.ini
[DEFAULT]
interface_driver = linuxbridge

修改dhcp_agent配置文件:

[root@openstack-server ~]# vim /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true

修改metadata_agent配置文件:

[root@openstack-server ~]# vim  /etc/neutroNetworking Option 2: Self-service networks:
n/metadata_agent.ini
[DEFAULT]
nova_metadata_host = openstack-server
metadata_proxy_shared_secret = neutron(neutron和nova通信共享秘鑰)

修改nova服務配置:

[root@openstack-server ~]# vim /etc/nova/nova.conf
[neutron]
url = http://openstack-server:9696
auth_url = http://openstack-server:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron
service_metadata_proxy = true
metadata_proxy_shared_secret = neutron(nova和neutron通信共享秘鑰)

創建網絡服務初始化腳本軟連接:
[root@openstack-server ~]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

同步neutron數據庫:

[root@openstack-server ~]# su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \
>   --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron

重啟nova-api服務:
[root@openstack-server ~]# systemctl restart openstack-nova-api.service

啟動neutron-server、 neutron-linuxbridge-agent、neutron-dhcp-agent、neutron-metadata-agent服務:

[root@openstack-server ~]# systemctl enable neutron-server.service \
>   neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
>   neutron-metadata-agent.service
[root@openstack-server ~]# systemctl start neutron-server.service \
>   neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
>   neutron-metadata-agent.service

如果使用Networking Option 2: Self-service networks還需要啟動neutron-l3-agent服務:

[root@openstack-server ~]# systemctl enable neutron-l3-agent.service
[root@openstack-server ~]# systemctl start neutron-l3-agent.service

安裝openstack-neutron-linuxbridge、ebtables、ipset(計算節點):
[root@openstack-server ~]# yum install openstack-neutron-linuxbridge ebtables ipset

修改neutron服務配置:

[root@openstack-server ~]# vim  /etc/neutron/neutron.conf
[DEFAULT]
transport_url = rabbit://openstack:openstack@openstack-server
auth_strategy = keystone
[keystone_authtoken]
www_authenticate_uri = http://openstack-server:5000
auth_url = http://openstack-server:5000
memcached_servers = openstack-server:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = neutron
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp

Networking Option 1: Provider networks:
修改linuxbridge_agent配置文件:

[root@openstack-server ~]# vim  /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:enp4s0
[vxlan]
enable_vxlan = false
[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

開啟系統內核支持網絡橋防火墻:

[root@openstack-server ~]# modprobe bridge
[root@openstack-server ~]# modprobe br_netfilter
[root@openstack-server ~]# cat >> /etc/sysctl.conf << EOF
> net.bridge.bridge-nf-call-iptables = 1
> net.bridge.bridge-nf-call-ip6tables = 1
> EOF
[root@openstack-server ~]# sysctl -p /etc/sysctl.conf

Networking Option 2: Self-service networks:
修改linuxbridge_agent配置文件:

[root@openstack-server ~]# vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:enp4s0
[vxlan]
enable_vxlan = true
local_ip = 192.168.254.10
l2_population = true
[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

開啟系統內核支持網絡橋防火墻:

[root@openstack-server ~]# modprobe bridge
[root@openstack-server ~]# modprobe br_netfilter
[root@openstack-server ~]# cat >> /etc/sysctl.conf << EOF
> net.bridge.bridge-nf-call-iptables = 1
> net.bridge.bridge-nf-call-ip6tables = 1
> EOF
[root@openstack-server ~]# sysctl -p /etc/sysctl.conf

修改nova服務配置:

[root@openstack-server ~]# vim  /etc/nova/nova.conf
[neutron]
url = http://openstack-server:9696
auth_url = http://openstack-server:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron

重啟nova-compute服務(控制節點):
[root@openstack-server ~]# systemctl restart openstack-nova-compute.service

啟動neutron-linuxbridge-agent服務:

[root@openstack-server ~]# systemctl enable neutron-linuxbridge-agent.service
[root@openstack-server ~]# systemctl start neutron-linuxbridge-agent.service

驗證操作:
[root@openstack-server ~]# . admin-openrc.sh

[root@openstack-server ~]# openstack extension list --network
+-----------------------------------------------------------------------------------------------------------------------------------------+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Name                                                                                                                                    | Alias                          | Description                                                                                                                                              |
+-----------------------------------------------------------------------------------------------------------------------------------------+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Default Subnetpools                                                                                                                     | default-subnetpools            | Provides ability to mark and use a subnetpool as the default.                                                                                            |
| Network IP Availability                                                                                                                 | network-ip-availability        | Provides IP availability data for each network and subnet.                                                                                               |
| Network Availability Zone                                                                                                               | network_availability_zone      | Availability zone support for network.                                                                                                                   |
| Network MTU (writable)                                                                                                                  | net-mtu-writable               | Provides a writable MTU attribute for a network resource.                                                                                                |
| Port Binding                                                                                                                            | binding                        | Expose port bindings of a virtual port to external application                                                                                           |
| agent                                                                                                                                   | agent                          | The agent management extension.                                                                                                                          |
| Subnet Allocation                                                                                                                       | subnet_allocation              | Enables allocation of subnets from a subnet pool                                                                                                         |
| DHCP Agent Scheduler                                                                                                                    | dhcp_agent_scheduler           | Schedule networks among dhcp agents                                                                                                                      |
| Neutron external network                                                                                                                | external-net                   | Adds external network attribute to network resource.                                                                                                     |
| Neutron Service Flavors                                                                                                                 | flavors                        | Flavor specification for Neutron advanced services.                                                                                                      |
| Network MTU                                                                                                                             | net-mtu                        | Provides MTU attribute for a network resource.                                                                                                           |
| Availability Zone                                                                                                                       | availability_zone              | The availability zone extension.                                                                                                                         |
| Quota management support                                                                                                                | quotas                         | Expose functions for quotas management per tenant                                                                                                        |
| Tag support for resources with standard attribute: subnet, trunk, router, network, policy, subnetpool, port, security_group, floatingip | standard-attr-tag              | Enables to set tag on resources with standard attribute.                                                                                                 |
| Availability Zone Filter Extension                                                                                                      | availability_zone_filter       | Add filter parameters to AvailabilityZone resource                                                                                                       |
| If-Match constraints based on revision_number                                                                                           | revision-if-match              | Extension indicating that If-Match based on revision_number is supported.                                                                                |
| Filter parameters validation                                                                                                            | filter-validation              | Provides validation on filter parameters.                                                                                                                |
| Multi Provider Network                                                                                                                  | multi-provider                 | Expose mapping of virtual networks to multiple physical networks                                                                                         |
| Quota details management support                                                                                                        | quota_details                  | Expose functions for quotas usage statistics per project                                                                                                 |
| Address scope                                                                                                                           | address-scope                  | Address scopes extension.                                                                                                                                |
| Empty String Filtering Extension                                                                                                        | empty-string-filtering         | Allow filtering by attributes with empty string value                                                                                                    |
| Subnet service types                                                                                                                    | subnet-service-types           | Provides ability to set the subnet service_types field                                                                                                   |
| Neutron Port MAC address regenerate                                                                                                     | port-mac-address-regenerate    | Network port MAC address regenerate                                                                                                                      |
| Resource timestamps                                                                                                                     | standard-attr-timestamp        | Adds created_at and updated_at fields to all Neutron resources that have Neutron standard attributes.                                                    |
| Provider Network                                                                                                                        | provider                       | Expose mapping of virtual networks to physical networks                                                                                                  |
| Neutron Service Type Management                                                                                                         | service-type                   | API for retrieving service providers for Neutron advanced services                                                                                       |
| Neutron Extra DHCP options                                                                                                              | extra_dhcp_opt                 | Extra options configuration for DHCP. For example PXE boot options to DHCP clients can be specified (e.g. tftp-server, server-ip-address, bootfile-name) |
| Port filtering on security groups                                                                                                       | port-security-groups-filtering | Provides security groups filtering when listing ports                                                                                                    |
| Resource revision numbers                                                                                                               | standard-attr-revisions        | This extension will display the revision number of neutron resources.                                                                                    |
| Pagination support                                                                                                                      | pagination                     | Extension that indicates that pagination is enabled.                                                                                                     |
| Sorting support                                                                                                                         | sorting                        | Extension that indicates that sorting is enabled.                                                                                                        |
| security-group                                                                                                                          | security-group                 | The security groups extension.                                                                                                                           |
| RBAC Policies                                                                                                                           | rbac-policies                  | Allows creation and modification of policies that control tenant access to resources.                                                                    |
| standard-attr-description                                                                                                               | standard-attr-description      | Extension to add descriptions to standard attributes                                                                                                     |
| IP address substring filtering                                                                                                          | ip-substring-filtering         | Provides IP address substring filtering when listing ports                                                                                               |
| Port Security                                                                                                                           | port-security                  | Provides port security                                                                                                                                   |
| Allowed Address Pairs                                                                                                                   | allowed-address-pairs          | Provides allowed address pairs                                                                                                                           |
| project_id field enabled                                                                                                                | project-id                     | Extension that indicates that project_id field is enabled.                                                                                               |
| Port Bindings Extended                                                                                                                  | binding-extended               | Expose port bindings of a virtual port to external application                                                                                           |
+-----------------------------------------------------------------------------------------------------------------------------------------+--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@openstack-server ~]# openstack network agent list
+--------------------------------------+--------------------+------------------+-------------------+-------+-------+---------------------------+
| ID                                   | Agent Type         | Host             | Availability Zone | Alive | State | Binary                    |
+--------------------------------------+--------------------+------------------+-------------------+-------+-------+---------------------------+
| 12d016a1-f747-49cc-b6be-0d793877d394 | Linux bridge agent | openstack-server | None              | :-)   | UP    | neutron-linuxbridge-agent |
| 9639fcea-da54-4bad-b3a6-16ffb96f3243 | Metadata agent     | openstack-server | None              | :-)   | UP    | neutron-metadata-agent    |
| dc6d79c5-62e0-48fb-8a19-556b68bc7063 | DHCP agent         | openstack-server | nova              | :-)   | UP    | neutron-dhcp-agent        |
+--------------------------------------+--------------------+------------------+-------------------+-------+-------+---------------------------+

13.安裝Dashboard:
安裝openstack-dashboard(控制節點):
[root@openstack-server ~]# yum -y install openstack-dashboard

修改dashboard配置文件:

[root@openstack-server ~]# vim /etc/openstack-dashboard/local_settings
OPENSTACK_HOST = "openstack-server"
ALLOWED_HOSTS = ['openstack-server', 'localhost']
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'

CACHES = {
    'default': {
         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
         'LOCATION': 'openstack-server:11211',
    }
}
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
OPENSTACK_API_VERSIONS = {
    "identity": 3,
    "image": 2,
    "volume": 2,
}
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'Default'
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
OPENSTACK_NEUTRON_NETWORK = {
    'enable_router': False,
    'enable_quotas': False,
    'enable_distributed_router': False,
    'enable_ha_router': False,
    'enable_lb': False,
    'enable_firewall': False,
    'enable_***': False,
    'enable_fip_topology_check': False,
}
TIME_ZONE = "Asia/Shanghai"

修改openstack-dashboard服務配置:

[root@openstack-server ~]# vim /etc/httpd/conf.d/openstack-dashboard.conf
WSGIApplicationGroup %{GLOBAL}

重啟httpd服務:
[root@openstack-server ~]# systemctl restart httpd.service memcached.service

驗證操作:
通過瀏覽器訪問http://openstack-server/dashboard 輸入域default,賬號myuser,密碼myuser;
OpenStack-Rocky版單機部署

14.安裝cinder:
在Mariadb創建cinder相關庫和用戶(控制節點):

[root@openstack-server ~]# mysql -uroot -psmoke520 -e "CREATE DATABASE cinder;"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' IDENTIFIED BY 'cinder';"
[root@openstack-server ~]# mysql -uroot -psmoke520 -e "GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' IDENTIFIED BY 'cinder';"

創建cinder用戶、服務、端點;

[root@openstack-server ~]# . admin-openrc.sh
[root@openstack-server ~]# openstack user create --domain default --password-prompt cinder
[root@openstack-server ~]# openstack role add --project service --user cinder admin
[root@openstack-server ~]#  openstack service create --name cinderv2 \
>   --description "OpenStack Block Storage" volumev2
[root@openstack-server ~]# openstack service create --name cinderv3 \
>   --description "OpenStack Block Storage" volumev3
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   volumev2 public http://openstack-server:8776/v2/%\(project_id\)s
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   volumev2 internal http://openstack-server:8776/v2/%\(project_id\)s
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   volumev2 admin http://openstack-server:8776/v2/%\(project_id\)s
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   volumev3 public http://openstack-server:8776/v3/%\(project_id\)s
[root@openstack-server ~]#  openstack endpoint create --region RegionOne \
>   volumev3 internal http://openstack-server:8776/v3/%\(project_id\)s
[root@openstack-server ~]# openstack endpoint create --region RegionOne \
>   volumev3 admin http://openstack-server:8776/v3/%\(project_id\)s

安裝openstack-cinder:
[root@openstack-server ~]# yum -y install openstack-cinder

修改cinder服務配置:
[root@openstack-server ~]# vim /etc/cinder/cinder.conf

[database]
connection = mysql+pymysql://cinder:cinder@openstack-server/cinder
[DEFAULT]
transport_url = rabbit://openstack:openstack@openstack-server
auth_strategy = keystone
my_ip = 192.168.254.10
[keystone_authtoken]
auth_uri = http://openstack-server:5000
auth_url = http://openstack-server:5000
memcached_servers = openstack-server:11211
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = cinder
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp

同步cinder數據庫:
[root@openstack-server ~]# su -s /bin/sh -c "cinder-manage db sync" cinder

修改nova服務配置:

[root@openstack-server ~]# vim /etc/nova/nova.conf
[cinder]
os_region_name = RegionOne

重啟nova-api服務:
[root@openstack-server ~]# systemctl restart openstack-nova-api.service

啟動cinder-api、cinder-scheduler服務:

[root@openstack-server ~]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
[root@openstack-server ~]# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

安裝lvm2、device-mapper-persistent-data(計算節點):
[root@openstack-server ~]# yum -y install lvm2 device-mapper-persistent-data

啟動lvm2-lvmetad服務:

[root@openstack-server ~]# systemctl enable lvm2-lvmetad.service
[root@openstack-server ~]# systemctl start lvm2-lvmetad.service

將/dev/sdb2作為vlm塊存儲設備:

[root@openstack-server ~]# fdisk -l /dev/sdb

磁盤 /dev/sdb:250.1 GB, 250059350016 字節,488397168 個扇區
Units = 扇區 of 1 * 512 = 512 bytes
扇區大小(邏輯/物理):512 字節 / 512 字節
I/O 大小(最小/最佳):512 字節 / 512 字節
磁盤標簽類型:dos
磁盤標識符:0x441e1e17

   設備 Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   106956799    53477376   8e  Linux LVM
/dev/sdb2       106956800   276826111    84934656   8e  Linux LVM
[root@openstack-server ~]# pvcreate /dev/sdb2
[root@openstack-server ~]# vgcreate cinder-volumes /dev/sdb2

修改lvm配置文件:

[root@openstack-server ~]# vim /etc/lvm/lvm.conf
devices {
...
filter = [ "a/sdb2/","r/.*/"]
...
}

安裝openstack-cinder、targetcli python-keystone服務:
[root@openstack-server ~]# yum -y install openstack-cinder targetcli python-keystone

修改cinder服務配置:

[root@openstack-server ~]# vim /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:cinder@openstack-server/cinder
[DEFAULT]
transport_url = rabbit://openstack:openstack@openstack-server
auth_strategy = keystone
my_ip = 192.168.254.10
enabled_backends = lvm
glance_api_servers = http://openstack-server:9292
[keystone_authtoken]
www_authenticate_uri = http://openstack-server:5000
auth_url = http://openstack-server:5000
memcached_servers = openstack-server:11211
auth_type = password
project_domain_id = default
user_domain_id = default
project_name = service
username = cinder
password = cinder
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp

啟動cinder-volume、target服務:

[root@openstack-server ~]# systemctl enable openstack-cinder-volume.service target.service
[root@openstack-server ~]# systemctl start openstack-cinder-volume.service target.service

驗證操作:

[root@openstack-server ~]# openstack volume service list
+------------------+----------------------+------+---------+-------+----------------------------+
| Binary           | Host                 | Zone | Status  | State | Updated At                 |
+------------------+----------------------+------+---------+-------+----------------------------+
| cinder-scheduler | openstack-server     | nova | enabled | up    | 2018-10-25T14:07:19.000000 |
| cinder-volume    | openstack-server@lvm | nova | enabled | up    | 2018-10-25T14:07:24.000000 |
+------------------+----------------------+------+---------+-------+----------------------------+

15.啟動虛擬機實例:
創建Provider network網絡:

[root@openstack-server ~]# . myuser-openrc.sh
[root@openstack-server ~]# openstack network create  --share --external \
>   --provider-physical-network provider \
>   --provider-network-type flat provider
[root@openstack-server ~]#  openstack subnet create --network provider \
>    --allocation-pool start=192.168.254.11,end=192.168.254.15 \
>    --dns-nameserver 114.114.114.114 --gateway 192.168.254.1 \
>    --subnet-range 192.168.254.0/27 provider
[root@openstack-server ~]#  openstack network list
+--------------------------------------+----------+--------------------------------------+
| ID                                   | Name     | Subnets                              |
+--------------------------------------+----------+--------------------------------------+
| 9979b724-3868-42b9-9e0b-61b42fd794a0 | provider | 12dbf504-9f38-40d1-b273-e1409bc712b2 |
+--------------------------------------+----------+--------------------------------------+

創建Self-service network網絡:

[root@openstack-server ~]# . myuser-openrc.sh
[root@openstack-server ~]# openstack network create selfservice
[root@openstack-server ~]#  openstack subnet create --network selfservice \
>   --dns-nameserver 114.114.114.114 --gateway 172.16.1.1 \
>   --subnet-range 172.16.1.0/24 selfservice
[root@openstack-server ~]# openstack router create router
[root@openstack-server ~]#  openstack router add subnet router selfservice
[root@openstack-server ~]# openstack router set router --external-gateway provider

驗證操作:

[root@openstack-server ~]# . admin-openrc.sh
[root@openstack-server ~]# ip netns
qrouter-0251f464-87d3-466e-9889-5b58eaeeb19b (id: 2)
qdhcp-ad37ab93-04df-4b47-99d3-10dc0b2e630e (id: 1)
qdhcp-cd105ed5-cb4d-4fd9-a4f3-3ab1642d7cb4 (id: 0)
[root@openstack-server ~]# openstack port list --router router
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------+--------+
| ID                                   | Name | MAC Address       | Fixed IP Addresses                                                            | Status |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------+--------+
| 6390935b-7ab1-4608-a386-8f8d068a2ee0 |      | fa:16:3e:4a:74:9e | ip_address='192.168.254.14', subnet_id='9e8f1c21-fc37-4dd7-b111-b4e25160b731' | ACTIVE |
| d44e3892-fb37-4c8e-b962-f1035f164409 |      | fa:16:3e:c1:1c:72 | ip_address='172.16.1.1', subnet_id='f5ae3b68-4397-4caf-be61-63ef193e024c'     | ACTIVE |
+--------------------------------------+------+-------------------+-------------------------------------------------------------------------------+--------+

創建flavor模板:
[root@openstack-server ~]# openstack flavor create --id 0 --vcpus 1 --ram 64 --disk 1 m1.nano

創建秘鑰鏈:

[root@openstack-server ~]# . myuser-openrc.sh
[root@openstack-server ~]# ssh-keygen -q -N ""
[root@openstack-server ~]# openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey

驗證操作:

[root@openstack-server ~]# openstack keypair list
+-------+-------------------------------------------------+
| Name  | Fingerprint                                     |
+-------+-------------------------------------------------+
| mykey | f3:95:1d:7f:24:e0:ba:a2:7f:9a:e8:98:7a:79:f7:f6 |
+-------+-------------------------------------------------+

添加安全組:

[root@openstack-server ~]# openstack security group rule create --proto icmp default
[root@openstack-server ~]# openstack security group rule create --proto tcp --dst-port 22 default
[root@openstack-server ~]# openstack security group list
+--------------------------------------+---------+-------------+----------------------------------+------+
| ID                                   | Name    | Description | Project                          | Tags |
+--------------------------------------+---------+-------------+----------------------------------+------+
| 5c642955-4c0d-4913-83ac-ecd7fdc95846 | default | 缺省安全組  | f9d82471a2d84cdca15994649ad3ce17 | []   |
+--------------------------------------+---------+-------------+----------------------------------+------+

Launch an instance on the provider network(在provider網絡運行實例):

[root@openstack-server ~]# . demo-openrc
[root@openstack-server ~]# openstack flavor list
+----+---------+-----+------+-----------+-------+-----------+
| ID | Name    | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+---------+-----+------+-----------+-------+-----------+
| 0  | m1.nano |  64 |    1 |         0 |     1 | True      |
+----+---------+-----+------+-----------+-------+-----------+
[root@openstack-server ~]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 68cc1d9d-3018-4c42-a20c-70d0e4215a24 | cirros | active |
+--------------------------------------+--------+--------+
[root@openstack-server ~]# openstack network list
+--------------------------------------+-------------+--------------------------------------+
| ID                                   | Name        | Subnets                              |
+--------------------------------------+-------------+--------------------------------------+
| ad37ab93-04df-4b47-99d3-10dc0b2e630e | selfservice | f5ae3b68-4397-4caf-be61-63ef193e024c |
| cd105ed5-cb4d-4fd9-a4f3-3ab1642d7cb4 | provider    | 9e8f1c21-fc37-4dd7-b111-b4e25160b731 |
+--------------------------------------+-------------+--------------------------------------+
[root@openstack-server ~]# openstack security group list
+--------------------------------------+---------+-------------+----------------------------------+------+
| ID                                   | Name    | Description | Project                          | Tags |
+--------------------------------------+---------+-------------+----------------------------------+------+
| 48512492-a516-4219-9a94-c81ac593963d | default | 缺省安全組  | c6b624a854694b4bb6dacd361bd7589d | []   |
+--------------------------------------+---------+-------------+----------------------------------+------+
[root@openstack-server ~]# openstack server create --flavor m1.nano --image cirros \
>   --nic net-id=9979b724-3868-42b9-9e0b-61b42fd794a0 --security-group default \
>   --key-name mykey provider-instance

[root@openstack-server ~]# openstack console url show selfservice-instance(獲取vnc url)

Launch an instance on the self-service network(在self-service網絡運行實例):

[root@openstack-server ~]# . myuser-openrc.sh
[root@openstack-server ~]# openstack flavor list
+----+---------+-----+------+-----------+-------+-----------+
| ID | Name    | RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+---------+-----+------+-----------+-------+-----------+
| 0  | m1.nano |  64 |    1 |         0 |     1 | True      |
+----+---------+-----+------+-----------+-------+-----------+
[root@openstack-server ~]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| 68cc1d9d-3018-4c42-a20c-70d0e4215a24 | cirros | active |
+--------------------------------------+--------+--------+
[root@openstack-server ~]# openstack network list
+--------------------------------------+-------------+--------------------------------------+
| ID                                   | Name        | Subnets                              |
+--------------------------------------+-------------+--------------------------------------+
| ad37ab93-04df-4b47-99d3-10dc0b2e630e | selfservice | f5ae3b68-4397-4caf-be61-63ef193e024c |
| cd105ed5-cb4d-4fd9-a4f3-3ab1642d7cb4 | provider    | 9e8f1c21-fc37-4dd7-b111-b4e25160b731 |
+--------------------------------------+-------------+--------------------------------------+
[root@openstack-server ~]# openstack security group list
+--------------------------------------+---------+-------------+----------------------------------+------+
| ID                                   | Name    | Description | Project                          | Tags |
+--------------------------------------+---------+-------------+----------------------------------+------+
| 48512492-a516-4219-9a94-c81ac593963d | default | 缺省安全組  | c6b624a854694b4bb6dacd361bd7589d | []   |
+--------------------------------------+---------+-------------+----------------------------------+------+
[root@openstack-server ~]# openstack server create --flavor m1.nano --image cirros \
>   --nic net-id=ad37ab93-04df-4b47-99d3-10dc0b2e630e --security-group default \
>   --key-name mykey selfservice-instance
[root@openstack-server ~]# openstack server list
+--------------------------------------+----------------------+--------+-------------------------+--------+---------+
| ID                                   | Name                 | Status | Networks                | Image  | Flavor  |
+--------------------------------------+----------------------+--------+-------------------------+--------+---------+
| 105e9757-7ba5-4a3f-81b7-cecdff2fa167 | selfservice-instance | ACTIVE | selfservice=172.16.1.10 | cirros | m1.nano |

+--------------------------------------+----------------------+--------+-------------------------+--------+---------+

[root@openstack-server ~]# openstack console url show selfservice-instance(獲取vnc url)

創建卷:

[root@openstack-server ~]# . myuser-openrc.sh
[root@openstack-server ~]# openstack volume create --size 1 volume1
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2018-11-04T14:38:32.000000           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | 2a67c881-b7d6-47fb-9da4-c37dcb0ccf72 |
| multiattach         | False                                |
| name                | volume1                              |
| properties          |                                      |
| replication_status  | None                                 |
| size                | 1                                    |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | None                                 |
| updated_at          | None                                 |
| user_id             | 2a2e5a1a1a464efaabaca83b439999e4     |
+---------------------+--------------------------------------+
[root@openstack-server ~]# openstack volume list
+--------------------------------------+---------+-----------+------+----------------------------------+
| ID                                   | Name    | Status    | Size | Attached to                      |
+--------------------------------------+---------+-----------+------+----------------------------------+
| 2a67c881-b7d6-47fb-9da4-c37dcb0ccf72 | volume1 | available |    1 |                                  |
| a63a0afe-3be8-45aa-b7be-820d88874fc4 |         | in-use    |   20 | Attached to centos6 on /dev/vda  |
+--------------------------------------+---------+-----------+------+----------------------------------+
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

临颍县| 鹿泉市| 车险| 乌鲁木齐县| 临澧县| 渝北区| 岳池县| 沾化县| 嘉义县| 萍乡市| 张家口市| 合江县| 南澳县| 宕昌县| 运城市| 九龙县| 芷江| 珲春市| 长白| 芒康县| 策勒县| 根河市| 滦南县| 额尔古纳市| 阿拉善左旗| 奉贤区| 沿河| 东兴市| 内黄县| 洪洞县| 卓尼县| 吉隆县| 修水县| 板桥市| 邵阳县| 乌拉特前旗| 萨嘎县| 苗栗市| 顺昌县| 漯河市| 蓬安县|