openstack-L版安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openstack-L版安装相关的知识,希望对你有一定的参考价值。


参照官方install document:
http://docs.openstack.org/liberty/install-guide-rdo/

 

 

实验环境:
centos7.2
桥接: 192.168.1.71 主机名:computer computer节点
nat:
桥接:192.168.1.72 主机名:controller controller节点
nat:

一、基础配置:(两台机器多要配置)

关闭selinux和iptables:
setenforce 0

iptables -F
iptables -t nat -F
systemctl stop firewalld
systemctl disable firewalld

systemctl stop NetworkManager
systemctl disable NetworkManager

设置主机名、hosts文件解析等

时间同步:controller上安装ntp服务:
yum install -y chrony
vim /etc/chrony.conf
allow 192.168.1.0/24

systemctl enable chronyd.service
systemctl start chronyd.service
#监听端口 udp123

compute上:作为时间服务器的客户端
yum install -y chrony
vim /etc/chrony.conf
server controller iburst

systemctl enable chronyd.service
systemctl start chronyd.service

使用dhclient网卡获取ip:
dhclient eno33554976
#下次使用dhclient时需要kill掉dhclient

#重启网卡命令:
systemctl restart network.service

准备阿里源、epel源:
yum install -y centos-release-openstack-liberty
yum upgrade
init 6

安装openstack 客户端和openstack-selinux
yum install -y python-openstackclient openstack-selinux


二、配置安装openstack前的基础依赖服务:

controller节点:

安装mysql
yum install -y mariadb mariadb-server MySQL-python

写入配置文件:
vi /etc/my.cnf.d/mariadb_openstack.cnf
[mysqld]
bind-address = 192.168.1.72
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
init-connect = ‘SET NAMES utf8‘
character-set-server = utf8
启动mariadb:
systemctl enable mariadb.service
systemctl start mariadb.service

设置root密码
mysql_secure_installation
设置root密码为 123456
mysql -uroot -p123456


安装nosql数据库被Telemetry service用到:
这里我们安装的是mongodb为例
yum install -y mongodb-server mongodb

编辑配置文件
vim /etc/mongod.conf
bind_ip = 192.168.1.72
smallfiles = true

启动服务
systemctl enable mongod.service
systemctl start mongod.service


安装消息队列:(端口5672)

rabbitmq消息队列服务在openstack中起到非常关键的作用,它好比是一个交通枢纽,各个组件之间的通信由它来完成。
yum install -y rabbitmq-server

启动rabbitmq-server服务
systemctl enable rabbitmq-server
systemctl start rabbitmq-server

添加openstack用户(rabbitmq的用户)
rabbitmqctl add_user openstack 123456
#密码 123456 用户名为openstack

为openstack用户授权
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
#允许openstack用户可以配置,可以写,可以读


三、安装openstack:

controller节点:

安装keystone:

tenants 租户(租房子的人可以租很多个房子)
user 用户(租房子的人)
role 角色(房子的类型)
Endpoint 服务 ()
Credential 用户身份证
Authentication 认证过程
Token 钥匙


登陆mysql,创建keystone数据库:
mysql -uroot -p123456
>create database keystone;
>GRANT ALL PRIVILEGES ON keystone.* TO ‘keystone‘@‘localhost‘ IDENTIFIED BY ‘keystone‘;
>GRANT ALL PRIVILEGES ON keystone.* TO ‘keystone‘@‘%‘ IDENTIFIED BY ‘keystone‘;

安装相应的软件包:
yum install -y openstack-keystone httpd mod_wsgi memcached python-memcached

启动memcached服务
systemctl enable memcached.service
systemctl start memcached.service

编辑keystone配置文件
vi /etc/keystone/keystone.conf
[DEFAULT]
admin_token = 123456
verbose = true #调试模式
[database]
connection = mysql://keystone:[email protected]/keystone
#用户名:密码@主机名/库名
[memcache]
servers = localhost:11211
[token]
provider = uuid
driver = memcache
[revoke]
driver = sql

导入keystone相关的数据:
su -s /bin/sh -c "keystone-manage db_sync" keystone
#这里会有个提示 No handlers could be found for logger "oslo_config.cfg" 忽略它,不影响

检查有没有正常导入数据:
mysql -ukeystone -pkeystone -hcontroller -t keystone -e "show tables"


配置httpd:
先编辑配置文件 /etc/httpd/conf/httpd.conf
ServerName controller

编辑配置文件
vim /etc/httpd/conf.d/wsgi-keystone.conf

Listen 5000
Listen 35357
<VirtualHost *:5000>
WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-public
WSGIScriptAlias / /usr/bin/keystone-wsgi-public
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
ErrorLog /var/log/httpd/keystone-error.log
CustomLog /var/log/httpd/keystone-access.log combined
<Directory /usr/bin>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
</Directory>
</VirtualHost>

启动httpd:
systemctl enable httpd.service
systemctl start httpd.service


创建服务实例:

首先设置环境变量:
export OS_TOKEN=123456
export OS_URL=http://controller:35357/v3
export OS_IDENTITY_API_VERSION=3

检查环境变量:
echo $OS_IDENTITY_API_VERSION

创建服务实例
openstack service create --name keystone --description "OpenStack Identity" identity

创建端点
openstack endpoint create --region RegionOne identity public http://controller:5000/v2.0
openstack endpoint create --region RegionOne identity internal http://controller:5000/v2.0
openstack endpoint create --region RegionOne identity admin http://controller:35357/v2.0

创建admin租户
openstack project create --domain default --description "Admin Project" admin

创建admin用户 (密码为123456、要输入的)
openstack user create --domain default --password-prompt admin

创建admin角色
openstack role create admin

给admin租户和用户赋予admin的角色
openstack role add --project admin --user admin admin

创建一个service 租户(后面用到)
openstack project create --domain default --description "Service Project" service

创建demo租户
openstack project create --domain default --description "Demo Project" demo

创建demo用户 (密码1234567)
openstack user create --domain default --password-prompt demo

创建角色user
openstack role create user

给demo租户和demo用户赋予demo角色
openstack role add --project demo --user demo user

验证admin用户和demo用户是否能正常登陆:
首先做一个安全设置:
vi /usr/share/keystone/keystone-dist-paste.ini
#搜索admin_token_auth
#从[pipeline:public_api], [pipeline:admin_api]和[pipeline:api_v3]中,
#把admin_token_auth去掉
#例如把
#pipeline = sizelimit url_normalize request_id build_auth_context token_auth admin_token_auth json_body ec2_extension user_crud_extension public_service
#改为
#pipeline = sizelimit url_normalize request_id build_auth_context token_auth json_body ec2_extension user_crud_extension public_service

取消环境变量OS_TOKEN和OS_URL
unset OS_TOKEN OS_URL

然后再登陆admin和demo用户 (密码123456、1234567)
openstack --os-auth-url http://controller:35357/v3 --os-project-domain-id default --os-user-domain-id default --os-project-name admin --os-username admin --os-auth-type password token issue
openstack --os-auth-url http://controller:5000/v3 --os-project-domain-id default --os-user-domain-id default --os-project-name demo --os-username demo --os-auth-type password token issue


创建admin用户变量:
vim admin.sh
export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_NAME=admin
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=123456
export OS_AUTH_URL=http://controller:35357/v3
export OS_IDENTITY_API_VERSION=3
执行脚本
source admin.sh
申请认证令牌
openstack token issue


创建demo用户变量:
vim demo.sh
export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_NAME=demo
export OS_TENANT_NAME=demo
export OS_USERNAME=demo
export OS_PASSWORD=1234567
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3
执行脚本
source demo.sh
申请认证令牌
openstack token issue

 

glance安装:

管理镜像的一个组件,我们用镜像来安装操作系统。
glance支持让用户自己管理自定义镜像。


创建glance库和用户
mysql -uroot -p123456
> CREATE database glance;
> GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘localhost‘ IDENTIFIED BY ‘glance‘;
> GRANT ALL PRIVILEGES ON glance.* TO ‘glance‘@‘%‘ IDENTIFIED BY ‘glance‘;

执行 admin-openrc.sh 脚本
source admin.sh

创建glance用户(密码为123456)
openstack user create --domain default --password-prompt glance

给glance用户和service租户赋予admin角色
openstack role add --project service --user glance admin

创建glance服务实体
openstack service create --name glance --description "OpenStack Image service" image

创建image服务api 端点
openstack endpoint create --region RegionOne image public http://controller:9292
openstack endpoint create --region RegionOne image internal http://controller:9292
openstack endpoint create --region RegionOne image admin http://controller:9292


安装glance:
yum install -y openstack-glance python-glance python-glanceclient

编辑配置文件
vim /etc/glance/glance-api.conf
[database]
connection = mysql://glance:[email protected]/glance
# 用户名:密码@主机名/库名
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = 123456
[paste_deploy]
flavor = keystone
[glance_store]
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
[DEFAULT]
notificaction_driver = noop
verbose=True

编辑配置文件
vim /etc/glance/glance-registry.conf
[DEFAULT]
notificaction_driver = noop
verbose=True
[database]
connection = mysql://glance:[email protected]/glance
# 用户名:密码@主机名/库名

[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = glance
password = 123456
[paste_deploy]
flavor = keystone

同步glance数据库数据
su -s /bin/sh -c "glance-manage db_sync" glance
#进入数据库检查是否同步

启动服务
systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service

添加环境变量(在两个用户的环境变量脚本中追加了一条)
echo "export OS_IMAGE_API_VERSION=2" | tee -a admin.sh demo.sh

执行admin.sh
source admin.sh

下载镜像
wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

把刚刚下载的镜像上传到镜像服务中心
glance image-create --name "cirros" \
--file cirros-0.3.4-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--visibility public --progress

镜像目录:(这个文件的名字和id是一致的。)
/var/lib/glance/images/

查看镜像:
glance image-list


安装nova:

创建nova库,并创建nova用户
mysql -uroot -p123456
> CREATE DATABASE nova;
> GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@‘localhost‘ IDENTIFIED BY ‘nova‘;
> GRANT ALL PRIVILEGES ON nova.* TO ‘nova‘@‘%‘ IDENTIFIED BY ‘nova‘;

初始化环境变量
source admin.sh

创建nova用户 密码为 123456
openstack user create --domain default --password-prompt nova

添加admin角色到nova用户
openstack role add --project service --user nova admin

创建nova服务实例
openstack service create --name nova --description "OpenStack Compute" compute

创建api端点
openstack endpoint create --region RegionOne compute public http://controller:8774/v2/%\(tenant_id\)s
openstack endpoint create --region RegionOne compute internal http://controller:8774/v2/%\(tenant_id\)s
openstack endpoint create --region RegionOne compute admin http://controller:8774/v2/%\(tenant_id\)s

安装nova组件:
yum install openstack-nova-api openstack-nova-cert \
openstack-nova-conductor openstack-nova-console \
openstack-nova-novncproxy openstack-nova-scheduler python-novaclient -y

编辑配置文件
vim /etc/nova/nova.conf
[database]
connection = mysql://nova:[email protected]/nova
[DEFAULT]
rpc_backend=rabbit
my_ip=192.168.1.72
auth_strategy=keystone
network_api_class = nova.network.neutronv2.api.API
security_group_api = neutron
linuxnet_interface_driver = nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
enabled_apis=osapi_compute,metadata
verbose=true
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = nova
password = 123456
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 123456
[vnc]
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[glance]
host = controller
[oslo_concurrency]
lock_path = /var/lib/nova/tmp

同步数据创建nova库
su -s /bin/sh -c "nova-manage db sync" nova

启动服务
systemctl enable openstack-nova-api.service \
openstack-nova-cert.service openstack-nova-consoleauth.service \
openstack-nova-scheduler.service openstack-nova-conductor.service \
openstack-nova-novncproxy.service

systemctl start openstack-nova-api.service \
openstack-nova-cert.service openstack-nova-consoleauth.service \
openstack-nova-scheduler.service openstack-nova-conductor.service \
openstack-nova-novncproxy.service

 

computer节点:

使用如下命令检查你的机器cpu是否支持虚拟化
egrep -c ‘(vmx|svm)‘ /proc/cpuinfo

如果不支持需要修改配置文件:
vim /etc/nova/nova.conf
[libvirt]
virt_type = qemu

 

安装nova-compute包
yum install -y openstack-nova-compute sysfsutils

编辑配置文件
vim /etc/nova/nova.conf
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 192.168.1.71
network_api_class = nova.network.neutronv2.api.API
security_group_api = neutron
linuxnet_interface_driver = nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
verbose=true
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 123456
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = nova
password = 123456
[vnc]
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html
[glance]
host = controller
[oslo_concurrency]
lock_path = /var/lib/nova/tmp

启动服务
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service


controller节点:

执行脚本
source admin.sh

列出服务组件
nova service-list
共有5个:nova-consoleauth nova-conductor nova-scheduler nova-cert nova-compute

列出api端点,
nova endpoints
一共有9组: nova三组,glance三组,keystone三组
如果有提示
WARNING: nova has no endpoint in ! Available endpoints for this service:
可以忽略掉,也可以编辑 admin.sh 增加一行 export OS_REGION_NAME=RegionOne

列出镜像
nova image-list

 

controller节点:

安装network:

Networking又叫做Neutron,是Openstack必不可少的组件,它其实是网络虚拟化的实现工具,可以让我们模拟出路由器、交换机、网卡等网络设备。
Neutron支持两种网络模式,
第一种是非常简单的网络架构,它仅支持是让实例连接外网,不支持自定义网络、路由器以及浮动ip。只有管理员或者授权的用户有权限去管理网络。
第二种网络功能比较强大,支持自定义网络管理,支持自建路由器并且也支持浮动ip。即使没有授权的用户也可以管理网络,支持用户自己配置和管理。

创建库、授权账号 mysql -uroot -p123456
> CREATE DATABASE neutron;
> GRANT ALL PRIVILEGES ON neutron.* TO ‘neutron‘@‘localhost‘ IDENTIFIED BY ‘neutron‘;
> GRANT ALL PRIVILEGES ON neutron.* TO ‘neutron‘@‘%‘ IDENTIFIED BY ‘neutron‘;

执行脚本
source admin.sh

创建neutron用户(密码为123456)
openstack user create --domain default --password-prompt neutron

把admin角色添加到neutron用户里
openstack role add --project service --user neutron admin

创建neutron实例
openstack service create --name neutron --description "OpenStack Networking" network

创建networking服务api终端
openstack endpoint create --region RegionOne network public http://controller:9696
openstack endpoint create --region RegionOne network internal http://controller:9696
openstack endpoint create --region RegionOne network admin http://controller:9696


安装组件
yum install openstack-neutron openstack-neutron-ml2 \
openstack-neutron-linuxbridge python-neutronclient ebtables ipset

配置服务端组件
vim /etc/neutron/neutron.conf
[DEFAULT]
core_plugin = ml2
service_plugins =
rpc_backend = rabbit
auth_strategy = keystone
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
nova_url = http://controller:8774/v2
verbose = True
[database]
connection = mysql://neutron:[email protected]/neutron

[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 123456

[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = 123456

[nova]
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = nova
password = 123456
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp

配置ml2 插件
vim /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = flat,vlan
tenant_network_types =
mechanism_drivers = linuxbridge
extension_drivers = port_security
[ml2_type_flat]
flat_networks = public
[securitygroup]
enable_ipset = True

编辑linux桥接agent
vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = public:eno16777736
#创建的虚拟机的桥接的网卡
[vxlan]
enable_vxlan = False
[agent]
prevent_arp_spoofing = True
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

配置dhcp agent
vim /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True
verbose = True

编辑配置文件
vi /etc/neutron/metadata_agent.ini
[DEFAULT]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_region = RegionOne
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = 123456
nova_metadata_ip = controller
metadata_proxy_shared_secret = 123456
verbose = True
#说明:需要删除掉配置文件里原有的 auth_url auth_region admin_tenant_name admin_user admin_password

编辑配置文件
vim /etc/nova/nova.conf
[neutron]
url = http://controller:9696
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = 123456

service_metadata_proxy = True
metadata_proxy_shared_secret = 123456

创建ml2插件配置文件创建软连接
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini

生成数据
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

重启compute api服务
systemctl restart openstack-nova-api.service

启动服务
systemctl enable neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
systemctl start neutron-server.service \
neutron-linuxbridge-agent.service neutron-dhcp-agent.service \
neutron-metadata-agent.service
systemctl enable neutron-l3-agent.service
systemctl start neutron-l3-agent.service

 


computer节点:


安装组件
yum install -y openstack-neutron openstack-neutron-linuxbridge ebtables ipset

配置普通组件
vi /etc/neutron/neutron.conf
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
verbose = True
[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 123456
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = neutron
password = 123456
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp

配置linux桥接agent
vi /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = public:eno16777736

[vxlan]
enable_vxlan = False

[agent]
prevent_arp_spoofing = True

[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

配置compute使用网络
vi /etc/nova/nova.conf
[neutron]
url = http://controller:9696
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = 123456

启动服务
systemctl restart openstack-nova-compute.service
systemctl enable neutron-linuxbridge-agent.service
systemctl start neutron-linuxbridge-agent.service


controller节点:

执行环境变量脚本
source admin.sh

列出所有的扩展
neutron ext-list

列出所有agent
neutron agent-list
agent type如下:
Linux bridge agent
Linux bridge agent
DHCP agent
Metadata agent
必须要有4个,否则说明上面的某个步骤配置有问题。

 

controller节点:

安装dashboard:

安装包 yum install -y openstack-dashboard
编辑配置文件
vi /etc/openstack-dashboard/local_settings
OPENSTACK_HOST = "controller"
ALLOWED_HOSTS = [‘*‘, ]
CACHES = {
‘default‘: {
‘BACKEND‘: ‘django.core.cache.backends.locmem.LocMemCache‘,
‘LOCATION‘: ‘127.0.0.1:11211‘,
} }
#使用的是mamcached 不是memcached的注释掉

OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
OPENSTACK_API_VERSIONS = {
"identity": 3,
"volume": 2,
}
TIME_ZONE = "Asia/Shanghai"

重启服务
systemctl restart httpd.service memcached.service
此时可以去访问了 http://controller/dashboard
使用账号admin或者demon用户登陆即可,域为default


controller节点:

controller:
对象存储:cinder


controller节点:

命令行操作:
创建实例:

创建网络:
先停止vmwork 的dhcp服务:

执行初始化脚本
source admin.sh

创建网络
neutron net-create public --shared --provider:physical_network public \
--provider:network_type flat

创建子网
neutron subnet-create public 192.168.1.0/24 --name public \
--allocation-pool start=192.168.1.10,end=192.168.1.30 \
--dns-nameserver 119.29.29.29 --gateway 192.168.1.1
说明:这里的公网,实际上是虚拟机用的那个网段,
我们暂时把它作为公网,在这里因为涉及到dhcp服务,
会和局域网内的路由器上的dhcp服务产生冲突,所以需要先把路由器上的dhcp服务关掉。


创建key:

执行初始化脚本
source demo.sh
生成密钥
ssh-keygen -q -N ""
nova keypair-add --pub-key ~/.ssh/id_rsa.pub mykey
验证密钥
nova keypair-list
增加安全组规则
nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0
允许ssh 访问
nova secgroup-add-rule default tcp 22 22 0.0.0.0/0


创建虚拟机实例:

执行初始化脚本
source demo-openrc.sh
列出实例类型
nova flavor-list
列出所有镜像
nova image-list
列出可用网络
neutron net-list
列出安全组
nova secgroup-list
运行实例
nova boot --flavor m1.tiny --image cirros --nic net-id=PUBLIC_NET_ID \
--security-group default --key-name mykey public-instance
说明:这里的PUBLIC_NET_ID需要替换为可用网络里面public网络的id

检测实例状态
nova list


使用vnc连接(使用下面命令可以列出vnc的连接)
nova get-vnc-console public-instance novnc
#会返回一个http连接,在浏览器中打开

验证网络(在实例里面)
ping -c 4 192.168.1.1
ping www.baidu.com

远程连接实例
首先用nova list 查看实例的ip(假如为192.168.1.13)
验证ip
ping -c4 192.168.1.33
远程ssh登录 ssh [email protected]

 

 


以上是关于openstack-L版安装的主要内容,如果未能解决你的问题,请参考以下文章

OpenStack pike版 安装openstack服务 续安装openstack服务    

OpenStack pike版 安装openstack服务 续基本环境部署

五分钟学会企业的OpenStack(T版)——简介及安装方式

五分钟学会企业的OpenStack(T版)——简介及安装方式

openstack Rocky 社区版部署1.3 安装OpenStack packages

openstack-o版安装keystone