Atom feed of this document
 

 Booting a test image

The following assumes you are using QEMU or KVM in your deployment.

Download a CirrOS test image:

$ wget https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img
            

Add the image to glance:

$ name=cirros-0.3-x86_64
$ image=cirros-0.3.0-x86_64-disk.img
$ glance image-create --name=$name --is-public=true --container-format=bare --disk-format=qcow2 < $image
            

Check that adding the image was successful (Status should be ACTIVE when the operation is complete):

$ nova image-list

+--------------------------------------+---------------------+--------+--------+
|                  ID                  |         Name        | Status | Server |
+--------------------------------------+---------------------+--------+--------+
| 254c15e1-78a9-4b30-9b9e-2a39b985001c | cirros-0.3.0-x86_64 | ACTIVE |        |
+--------------------------------------+---------------------+--------+--------+

            

Create a keypair so you can ssh to the instance:

$ nova keypair-add test > test.pem
$ chmod 600 test.pem
            

In general, you need to use an ssh keypair to log in to a running instance, although some images have built-in accounts created with associated passwords. However, since images are often shared by many users, it is not advised to put passwords into the images. Nova therefore supports injecting ssh keys into instances before they are booted. This allows a user to log in to the instances that he or she creates securely. Generally the first thing that a user does when using the system is create a keypair.

Keypairs provide secure authentication to your instances. As part of the first boot of a virtual image, the private key of your keypair is added to authorized_keys file of the login account. Nova generates a public and private key pair, and sends the private key to the user. The public key is stored so that it can be injected into instances.

Run (boot) a test instance:

$ nova boot --image cirros-0.3.0-x86_64 --flavor m1.small --key_name test my-first-server
            

Here's a description of the parameters used above:

  • --image: the name or ID of the image we want to launch, as shown in the output of nova image-list

  • --flavor: the name or ID of the size of the instance to create (number of vcpus, available RAM, available storage). View the list of available flavors by running nova flavor-list

  • -key_name: the name of the key to inject into the instance at launch.

Check the status of the instance you launched:

$ nova list
            

The instance will go from BUILD to ACTIVE in a short time, and you should be able to connect via ssh as 'cirros' user, using the private key you created. If your ssh keypair fails for some reason, you can also log in with the default cirros password: cubswin:)

$ ipaddress=... # Get IP address from "nova list"
$ ssh -i test.pem -l cirros $ipaddress
        

The 'cirros' user is part of the sudoers group, so you can escalate to 'root' via the following command when logged in to the instance:

$ sudo -i
        
Log a bug against this page


loading table of contents...