openstack-manuals/doc/install-guide/section_nova-boot.xml
Lorin Hochstein c1e2121099 Document cirros password in install guide
Describe how to ssh to cirros using password.

Backport: havana

Change-Id: Ie45c2d343ef2b6bc560d59a67224aa79ccf48e87
2013-10-27 12:47:18 -04:00

184 lines
15 KiB
XML

<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.0"
xml:id="nova-boot">
<title>Booting an Image</title>
<para>After you've configured the Compute service, you
can now launch an instance. An instance is a virtual machine provisioned by
OpenStack on one of the Compute servers. Use the procedure below to launch a
low-resource instance using an image you've already downloaded.</para>
<note>
<para>This procedure assumes you have:
<itemizedlist>
<listitem><para>Appropriate environment
variables set to specify your credentials (see
<xref linkend="keystone-verify"/>
</para></listitem>
<listitem><para>Downloaded an image (see <xref linkend="glance-verify"/>).
</para></listitem>
<listitem><para>Configured networking (see <xref linkend="nova-network"/>).
</para></listitem>
</itemizedlist>
</para>
</note>
<procedure>
<title>Launch a Compute instance</title>
<step><para>Generate a keypair consisting of a private key and a public key to be able to launch instances
on OpenStack. These keys are injected into the instances to make
password-less SSH access to the instance. This depends on the way the
necessary tools are bundled into the images. For more details, see
"Manage instances" in the
<link xlink:href="http://docs.openstack.org/user-guide-admin/content/cli_manage_images.html">Administration User Guide</link>.</para>
<screen><prompt>$</prompt> <userinput>ssh-keygen</userinput>
<prompt>$</prompt> <userinput>cd .ssh</userinput>
<prompt>$</prompt> <userinput>nova keypair-add --pub_key id_rsa.pub mykey</userinput></screen>
<para>You have just created a new keypair called mykey. The private key id_rsa is
saved locally in ~/.ssh which can be used to connect to an instance
launched using mykey as the keypair. You can view available keypairs
using the <command>nova keypair-list</command> command.</para>
<screen><prompt>$</prompt> <userinput>nova keypair-list</userinput>
<computeroutput>+--------+-------------------------------------------------+
| Name | Fingerprint |
+--------+-------------------------------------------------+
| mykey | b0:18:32:fa:4e:d4:3c:1b:c4:6c:dd:cb:53:29:13:82 |
+--------+-------------------------------------------------+</computeroutput></screen>
</step>
<step><para>To launch an instance using OpenStack, you must specify the ID for the flavor you want to use
for the instance. A flavor is a resource allocation profile. For
example, it specifies how many virtual CPUs and how much RAM your
instance will get. To see a list of the available profiles, run the
<command>nova flavor-list</command> command.</para>
<screen><prompt>$</prompt> <userinput>nova flavor-list</userinput>
<computeroutput>+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+
| 1 | m1.tiny | 512 | 1 | 0 | | 1 | 1.0 | True |
| 2 | m1.small | 2048 | 20 | 0 | | 1 | 1.0 | True |
| 3 | m1.medium | 4096 | 40 | 0 | | 2 | 1.0 | True |
| 4 | m1.large | 8192 | 80 | 0 | | 4 | 1.0 | True |
| 5 | m1.xlarge | 16384 | 160 | 0 | | 8 | 1.0 | True |
+----+-----------+-----------+------+-----------+------+-------+-------------+-----------+</computeroutput></screen>
</step>
<step>
<para>Get the ID of the image you would like to use for the instance using the
<command>nova image-list</command> command.</para>
<screen><prompt>$</prompt> <userinput>nova image-list</userinput>
<computeroutput>+--------------------------------------+--------------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+--------------+--------+--------+
| 9e5c2bee-0373-414c-b4af-b91b0246ad3b | CirrOS 0.3.1 | ACTIVE | |
+--------------------------------------+--------------+--------+--------+</computeroutput></screen>
</step>
<step><para>Your instances need security group rules to be set for SSH and ping. Refer to the <link xlink:href="http://docs.openstack.org/user-guide/content/"><citetitle>OpenStack User Guide</citetitle></link> for detailed information.</para>
<screen><prompt>#</prompt> <userinput>nova secgroup-add-rule <replaceable>default</replaceable> tcp 22 22 0.0.0.0/0</userinput></screen>
<screen><prompt>#</prompt> <userinput>nova secgroup-add-rule <replaceable>default</replaceable> icmp -1 -1 0.0.0.0/0</userinput></screen></step>
<step><para>Create the instance using the <command>nova boot</command>.
<screen><prompt>$</prompt> <userinput>nova boot --flavor <replaceable>flavorType</replaceable> --key_name <replaceable>keypairName</replaceable> --image <replaceable>ID</replaceable> <replaceable>newInstanceName</replaceable></userinput> </screen>Create
an instance using flavor 1 or 2, for example:</para>
<screen><prompt>$</prompt> <userinput>nova boot --flavor 1 --key_name mykey --image 9e5c2bee-0373-414c-b4af-b91b0246ad3b --security_group default cirrOS</userinput>
<computeroutput>+--------------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------------+--------------------------------------+
| OS-EXT-STS:task_state | scheduling |
| image | CirrOS 0.3.1 |
| OS-EXT-STS:vm_state | building |
| OS-EXT-SRV-ATTR:instance_name | instance-00000001 |
| OS-SRV-USG:launched_at | None |
| flavor | m1.tiny |
| id | 3bdf98a0-c767-4247-bf41-2d147e4aa043 |
| security_groups | [{u'name': u'default'}] |
| user_id | 530166901fa24d1face95cda82cfae56 |
| OS-DCF:diskConfig | MANUAL |
| accessIPv4 | |
| accessIPv6 | |
| progress | 0 |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-AZ:availability_zone | nova |
| config_drive | |
| status | BUILD |
| updated | 2013-10-10T06:47:26Z |
| hostId | |
| OS-EXT-SRV-ATTR:host | None |
| OS-SRV-USG:terminated_at | None |
| key_name | mykey |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| name | cirrOS |
| adminPass | DWCDW6FnsKNq |
| tenant_id | e66d97ac1b704897853412fc8450f7b9 |
| created | 2013-10-10T06:47:23Z |
| os-extended-volumes:volumes_attached | [] |
| metadata | {} |
+--------------------------------------+--------------------------------------+</computeroutput></screen>
<note><para>If there is not enough RAM available for the instance, Compute will create the instance, but
will not start it (status 'Error').</para></note>
</step>
<step><para>After the instance has been created, it will show up in the output of <command>nova
list</command> (as the instance is booted up, the status will change from 'BUILD' to
'ACTIVE').</para>
<screen><prompt>$</prompt> <userinput>nova list</userinput>
<computeroutput>+--------------------------------------+-----------+--------+------------+-------------+----------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-----------+--------+------------+-------------+----------------+
| dcc4a894-869b-479a-a24a-659eef7a54bd | cirrOS | BUILD | spawning | NOSTATE | vmnet=10.0.0.3 |
+--------------------------------------+-----------+--------+------------+-------------+----------------+
</computeroutput><prompt>$</prompt> <userinput>nova list</userinput>
<computeroutput>+--------------------------------------+-----------+--------+------------+-------------+----------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-----------+--------+------------+-------------+----------------+
| dcc4a894-869b-479a-a24a-659eef7a54bd | cirrOS | ACTIVE | None | Running | vmnet=10.0.0.3 |
+--------------------------------------+-----------+--------+------------+-------------+----------------+</computeroutput>
</screen>
<note><para>You can also retrieve additional details about the specific instance using the
<command>nova show</command> command.</para>
<screen><prompt>$</prompt> <userinput>nova show dcc4a894-869b-479a-a24a-659eef7a54bd</userinput>
<computeroutput>+--------------------------------------+----------------------------------------------------------+
| Property | Value |
+--------------------------------------+----------------------------------------------------------+
| status | ACTIVE |
| updated | 2013-10-16T21:55:24Z |
| OS-EXT-STS:task_state | None |
| OS-EXT-SRV-ATTR:host | compute-node |
| key_name | mykey |
| image | cirros (918a1017-8a1b-41ff-8809-6106ba45366e) |
| vmnet network | 10.0.0.3 |
| hostId | 306d7c693911170ad4e5218f626f531cc68caa45f3a0f70f1aeba94d |
| OS-EXT-STS:vm_state | active |
| OS-EXT-SRV-ATTR:instance_name | instance-0000000a |
| OS-SRV-USG:launched_at | 2013-10-16T21:55:24.000000 |
| OS-EXT-SRV-ATTR:hypervisor_hostname | compute-node |
| flavor | m1.tiny (1) |
| id | dcc4a894-869b-479a-a24a-659eef7a54bd |
| security_groups | [{u'name': u'default'}] |
| OS-SRV-USG:terminated_at | None |
| user_id | 887ac8736b5b473b9dc3c5430a88b15f |
| name | cirrOS |
| created | 2013-10-16T21:54:52Z |
| tenant_id | 43ab520b2b484578bb6924c0ea926190 |
| OS-DCF:diskConfig | MANUAL |
| metadata | {} |
| os-extended-volumes:volumes_attached | [] |
| accessIPv4 | |
| accessIPv6 | |
| progress | 0 |
| OS-EXT-STS:power_state | 1 |
| OS-EXT-AZ:availability_zone | nova |
| config_drive | |
+--------------------------------------+----------------------------------------------------------+</computeroutput></screen>
</note>
</step>
<step><para>Once enough time has passed so that the instance is fully booted and initialized and your
security groups are set, you can <command>ssh</command> into the instance without a
password, using the keypair given to <command>nova boot</command>. You can obtain the IP
address of the instance from the output of <command>nova list</command>. You don't need to
specify the private key to use, because the private key of the mykey keypair was stored in
the default location for the <command>ssh</command> client
(<filename>~/.ssh/.id_rsa</filename>). <note>
<para>You must log in to a CirrOS instance as user cirros, not root.</para>
</note> You can also log in to the cirros account without an ssh key using the password
<literal>cubswin:)</literal></para>
<screen><prompt>$</prompt> ssh cirros@10.0.0.3</screen></step>
</procedure>
</section>