2.7Create a virtual machine2.7.1Create a provider virtual network
a On the control node, load the admin credentials to get the command access that the administrator can perform
Sourceadmin-openstack
b Create a network
OpenStack Network Create--share \
--provider-physical-network public \
--provider-network-type Flat Public
Verify
[Email protected]~]# Neutron net-list
+--------------------------------------+--------+---------+
| ID | Name |subnets |
+--------------------------------------+--------+---------+
| 98f8acb1-6ee4-43c4-b28b-d2a71b76a870| Public | |
+--------------------------------------+--------+---------+
C Create a subnet on the network
OpenStack Subnet Create--network public \
--allocation-pool start=192.168.56.100,end=192.168.56.200 \
--dns-nameserver 192.168.56.2--gateway 192.168.56.2 \
--subnet-range 192.168.56.0/24 public-subnet
Verify
[Email protected]~]# Neutron subnet-list
+-------------------------------------+---------------+-----------------+-------------------------------------+
| ID | name | cidr| Allocation_pools |
+-------------------------------------+---------------+-----------------+-------------------------------------+
|5f912ae8-fa19-426d-91ca-| public-subnet | 192.168.56.0/24 | {"Start": "192.168.56.100", "End": |
| 043e2e2d9664 | | | "192.168.56.200"} |
+-------------------------------------+---------------+-----------------+-------------------------------------+
[Email protected]~]# Neutron net-list
+--------------------------------------+--------+------------------------------------------------------+
| ID | Name |subnets |
+--------------------------------------+--------+------------------------------------------------------+
|98f8acb1-6ee4-43c4-b28b-d2a71b76a870 | Public |5f912ae8-fa19-426d-91ca-043e2e2d9664 192.168.56.0/24 |
+--------------------------------------+--------+------------------------------------------------------+
2.7.2Create M1.nano type
The default minimum size of the host requires MB of memory. For less than 4 GB of compute node memory in the environment, we recommend creating a host that requires only a size of "M1.nano". For testing purposes only, use the "M1.nano" version of the host to load the Cirros image
OpenStack flavorcreate--id 0--vcpus 1--ram--disk 1 M1.nano
a generates a key-value pair
Import Demo Project voucher
Sourcedemo-openstack
b generating and adding key pairs
SSH-KEYGEN-Q-N ""
OpenStack keypaircreate--public-key ~/.ssh/id_rsa.pub MyKey
+-------------+-------------------------------------------------+
| Field | Value |
+-------------+-------------------------------------------------+
| Fingerprint |ee:3d:2e:97:d4:e2:6a:54:6d:0d:ce:43:39:2c:ba:4d |
| name | MyKey |
| USER_ID |58126687cbcc4888bfa9ab73a2256f27 |
+-------------+-------------------------------------------------+
C Verifying the addition of public keys
$ OpenStack Keypairlist
+-------+-------------------------------------------------+
| Name | Fingerprint |
+-------+-------------------------------------------------+
| MyKey |ee:3d:2e:97:d4:e2:6a:54:6d:0d:ce:43:39:2c:ba:4d |
+-------+-------------------------------------------------+
2.7.3.Adding security groups
a Add a rule to the default security group
OpenStack securitygroup rule Create--proto ICMP default
b allow access to secure Shell (SSH)
OpenStack securitygroup rule Create--proto TCP--dst-port default
2.7.4create an instance of the public network
On the control node, get Admin Credentials to obtain access to only the commands that an administrator can perform:
Sourcedemo-openstack
An instance specifies the approximate allocation of virtual machine resources, including processor, memory, and storage.
[Email protected]~]# openstack Flavor List
+----+---------+-----+------+-----------+-------+-----------+
| ID | Name | RAM | Disk | Ephemeral | Vcpus | is public |
+----+---------+-----+------+-----------+-------+-----------+
| 0 | M1.nano | 64| 1 | 0 | 1 | True |
+----+---------+-----+------+-----------+-------+-----------+
a list available mirrors
[Email protected]~]# openstack image list
+--------------------------------------+--------+--------+
| ID | Name | Status |
+--------------------------------------+--------+--------+
|01d13e57-6ae1-4bf8-98e2-0d83f3c7dd75 | Cirros | active |
+--------------------------------------+--------+--------+
b list available security groups
[Email protected]~]# openstack Security Group List
+--------------------------------------+---------+------------------------+----------------------------------+
| ID | Name | Description | Project |
+--------------------------------------+---------+------------------------+----------------------------------+
|14f5bf0e-58ba-4be9-9967-89b59331ff74 | Default | Default Security Group |a6c20f56f252445b85b247501b995e50 |
+--------------------------------------+---------+------------------------+----------------------------------+
C list Available networks
[Email protected]~]# openstack Network list
+--------------------------------------+--------+--------------------------------------+
| ID | Name | Subnets |
+--------------------------------------+--------+--------------------------------------+
|98f8acb1-6ee4-43c4-b28b-d2a71b76a870 | Public | 5f912ae8-fa19-426d-91ca-043e2e2d9664|
+--------------------------------------+--------+--------------------------------------+
D start a virtual machine
OpenStack servercreate--flavor M1.nano--image cirros \
--nicnet-id=98f8acb1-6ee4-43c4-b28b-d2a71b76a870--security-group default \
--key-name mykeydemo-instance
e Check the status of an instance
[Email protected]~]# openstack Server List
+--------------------------------------+---------------+--------+-----------------------+------------+
| ID | Name | Status | Networks | Image Name |
+--------------------------------------+---------------+--------+-----------------------+------------+
| c50d1093-1059-4a2c-9b88-89feab212f3b| Demo-instance | ACTIVE | public=192.168.56.101 | Cirros |
+--------------------------------------+---------------+--------+-----------------------+------------+
F accessing instances using the Virtual Console
OpenStack Consoleurl Show Provider-instance
Get your powerful Virtual Network Computing (VNC) session URL and access it from a Web browser:
[[email protected]~]# openstack console URL show demo-instance
+-------+------------------------------------------------------------------------------------+
| Field | Value |
+-------+------------------------------------------------------------------------------------+
| Type | Novnc |
| URL |http://192.168.56.11:6080/vnc_auto.html?token=d7ec4e02-e485-47c1-b276-ae517779af26|
+-------+------------------------------------------------------------------------------------+
+-------+------------------------------------------------------------------------------------+
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/8C/80/wKiom1huIDyRNZAJAACN8GIKbak050.png-wh_500x0-wm_ 3-wmp_4-s_1275936088.png "title=" 33.png "alt=" Wkiom1huidyrnzajaacn8gikbak050.png-wh_50 "/>
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8C/7D/wKioL1huIEnArk2xAABLk5QduLM743.png-wh_500x0-wm_ 3-wmp_4-s_1979284189.png "title=" 44.png "alt=" Wkiol1huienark2xaablk5qdulm743.png-wh_50 "/>
Cirros The image contains the traditional username/password authentication method and is required to provide these certifications in the login prompt. After logging in to Cirros, you can connect to the virtual machine and log in.
This article is from the "Dream It Man" blog, please be sure to keep this source http://runningyongboy.blog.51cto.com/8234857/1889436
Cloud computing OpenStack (N Edition) virtual machine creation