Home > Ubuntu, Ubuntu Server > Run your own Ubuntu Enterprise Cloud, part 2

Run your own Ubuntu Enterprise Cloud, part 2

Disclaimer: I’m now working on the OpenStack project, which provides the same kind of functionality as Eucalyptus.

Important update: This howto was targeted at 9.10. The 10.04 release of UEC introduces plenty of simplification (autoregistration of components, uec-publish-tarball automatically registering cloud images…) that makes some of this guide obsolete. Please see https://help.ubuntu.com/community/UEC/ which is kept much more up to date. As an alternative, see http://testcases.qa.ubuntu.com/Install/ServerUECTopology1, which details the testcase we run to validate UEC internally.

In part 1 of this series, we saw how to install the cloud infrastructure. In this article, we’ll bundle and upload an EMI (Eucalyptus Machine Image), based on Ubuntu Server 9.10 Beta, and validate that we can run an instance of it.

Download required elements

Go to the cloud/cluster controller and download the required items.

For a 64-bit image:

$ URL="http://uec-images.ubuntu.com/releases/karmic"
$ wget -O image.gz $URL/beta/ubuntu-uec-karmic-amd64.img.gz
$ wget -O vmlinuz $URL/beta/ubuntu-uec-karmic-amd64-vmlinuz-2.6.31-11-server
$ wget -O initrd $URL/beta/ubuntu-uec-karmic-amd64-initrd.img-2.6.31-11-server

For a 32-bit image:

$ URL="http://uec-images.ubuntu.com/releases/karmic"
$ wget -O image.gz $URL/beta/ubuntu-uec-karmic-i386.img.gz
$ wget -O vmlinuz $URL/beta/ubuntu-uec-karmic-i386-vmlinuz-2.6.31-11-generic-pae
$ wget -O initrd $URL/beta/ubuntu-uec-karmic-i386-initrd.img-2.6.31-11-generic-pae

Bundle the EMI

First you should unpack and resize your image to the desired size, lets say 4Gb. This can take a very long time (15 minutes !) on slow disks as you unpack 10Gb-worth of image space:

$ zcat -f image.gz | cp --sparse=always /dev/stdin image
$ e2fsck -f image
$ resize2fs image 4G
$ truncate --size=4G image

Then bundle and upload the kernel:

$ . eucarc
$ euca-bundle-image -i vmlinuz --kernel true
$ euca-upload-bundle -b ueckernel -m /tmp/vmlinuz.manifest.xml
$ euca-register ueckernel/vmlinuz.manifest.xml
IMAGE     eki-KKKKKKKK

Take note of the EKI reference, you’ll need it later. Then bundle, upload and register the ramdisk:

$ euca-bundle-image -i initrd --ramdisk true
$ euca-upload-bundle -b uecramdisk -m /tmp/initrd.manifest.xml
$ euca-register uecramdisk/initrd.manifest.xml
IMAGE     eri-RRRRRRRR

Take note of the ERI reference. Finally, bundle the image with the kernel and ramdisk, upload and register:

$ euca-bundle-image -i image --kernel eki-KKKKKKKK --ramdisk eri-RRRRRRRR
$ euca-upload-bundle -b uecimage -m /tmp/image.manifest.xml
$ euca-register uecimage/image.manifest.xml
IMAGE     emi-XXXXXXXX

Bundling will also take a lot of time ! Take note of your EMI reference.

Start an instance of your EMI

In order to access your instance using SSH, you’ll need to setup a few one-time things (create a SSH key and authorize access to port 22 of your instances):

$ euca-add-keypair mykey > mykey.priv
$ chmod 0600 mykey.priv
$ euca-authorize default -P tcp -p 22 -s 0.0.0.0/0

Now it’s time to start your instance !

$ euca-run-instances -k mykey emi-XXXXXXXX -t c1.medium

The “c1.medium” VM type is sufficient by default to run a 4Gb instance. You should take note of the i-YYYYYYYY reference that is displayed on your INSTANCE line. The first time you start an EMI, it can take some time (like 10 minutes) to move from “pending” state to “running”, depending on size. You can use the following command to automatically watch the output of euca-describe-instances, every 5 seconds:

$ watch -n 5 euca-describe-instances

Take note of the first ZZZ.ZZZ.ZZZ.ZZZ IP address mentioned in the output of the command. When the instance is “running”, ctrl-C to exit watch, then:

$ ssh -i mykey.priv ubuntu@ZZZ.ZZZ.ZZZ.ZZZ

You are in ! When you’re done playing with your instance, just run the following command on the cloud/cluster controller.

$ euca-terminate-instances i-YYYYYYYY

In the third and last part of this series of articles, we’ll talk about how to run instances from another workstation, as a cloud “customer”.

About these ads
Categories: Ubuntu, Ubuntu Server
  1. Sapan
    October 9, 2009 at 13:17

    This is great, I’ve done part 1 and now part 2, is part 3 out yet?

    I’d also like to make a Windows image to run in my cloud, any idea how to do that?

    Thanks,
    Sapan

    • Thierry Carrez
      October 9, 2009 at 14:48

      Part 3 should be out early next week, stay tuned ! At that point, I have no idea how to bundle a Windows image, sorry.

  2. October 28, 2009 at 19:12

    I try to start a intance of the emi, but i got :

    “EC2_ACCESS_KEY environment variable must be set”.

    Can you help me with this ?

    • Thierry Carrez
      October 28, 2009 at 19:24

      This is set in eucarc, the “. eucarc” should source the required env variables and set them for further commands.

    • Eric
      January 11, 2010 at 22:03

      did you get this working? i’m having same error. don’t understand what Thierry said.

      • July 25, 2011 at 14:08

        Do the configuration in “OpenStack Compute Admin Manual” section 3.6

    • Vik
      September 8, 2011 at 19:01

      try this command –

      source ~/.euca/eucarc

      and then

      euca-describe-availability-zones verbose

  3. AbriNation
    November 26, 2009 at 20:03

    For me it is not possible to ping my instance, and it is not possible to connect to it from the cloud controller. Does anyone have an idea whats wrong? The running instance is pingable from the cloud nodes…
    thank you!

    • AbriNation
      November 26, 2009 at 21:44

      now my instance is pingable, but it is not possible to login via ssh – always promting for password when executing command: ssh -i mykey.priv ubuntu@ipaddressofinstance

      thank you for suggestions!

      • Thierry Carrez
        November 27, 2009 at 07:15

        Double-check that you ran euca-run-instance with “-k mykey”, it should show up in euca-describe-instances output.

  4. AbriNation
    November 27, 2009 at 11:29

    Thank you Thierry,

    i checked what you mentoined, but i have still the same problem. trying to login via ssh, i am always asked for a password. i really do not know whahts going wrong.

    euca-describe-instances “output”:
    RESERVATION r-4A1708D3 admin default
    INSTANCE i-42200852 emi-DE62106D 192.168.1.101 172.19.1.2 running mykey 0 m1.small 2009-11-27T11:22:11.846Z mycloud eki-F47910E4 eri-08E2114F

    Thank your for additional suggestions.

    • AbriNation
      November 27, 2009 at 15:19

      Now it works for me. After several time of allocating an instance, it is possible to login via ssh.

      i used following command:

      ssh -i mykey.priv -l ubuntu

      the command with ubuntu@ does not work for me. I do not know why …

  5. Nilesh
    January 7, 2010 at 09:54

    I got below error while excuting command euca-upload-bundle -b ueckernel -m /tmp/vmlinuz.manifest.xml

    File “/usr/bin/euca-upload-bundle”, line 226, in
    main()
    File “/usr/bin/euca-upload-bundle”, line 209, in main
    bucket_instance = ensure_bucket(conn, bucket, canned_acl)
    File “/usr/bin/euca-upload-bundle”, line 92, in ensure_bucket
    bucket_instance = create_bucket(connection, bucket, canned_acl)
    File “/usr/bin/euca-upload-bundle”, line 81, in create_bucket
    return connection.create_bucket(bucket, policy=canned_acl)
    File “/usr/lib/pymodules/python2.6/boto/s3/connection.py”, line 277, in create_bucket
    data=data)
    File “/usr/lib/pymodules/python2.6/boto/s3/connection.py”, line 305, in make_request
    data, host, auth_path, sender)
    File “/usr/lib/pymodules/python2.6/boto/connection.py”, line 419, in make_request
    return self._mexe(method, path, data, headers, host, sender)
    File “/usr/lib/pymodules/python2.6/boto/connection.py”, line 398, in _mexe
    raise e
    httplib.BadStatusLine

    Can you please help me?

    • Thierry Carrez
      January 7, 2010 at 12:57
      • Nilesh
        January 12, 2010 at 09:12

        I got problem, due to some how Eucalyptus service was stopped whice I have started and problem was resolved. One thing I noticed here is you need to reboot the server before starting bundle and upload the kernel to avoid this error.

  6. Jim W
    February 24, 2010 at 01:49

    Everything went great until euca-authorize …
    I get the message “Warning: failed to parse error message from AWS: :2:42 not well-formed (invalid token)”

    along with a traceback with the last line saying “xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 147″

    Any assistance would be welcome. This has been a great tutorial, and I am anxious to get to the end.

    Thanks for a great blog, Jim.

  7. Jim W
    February 27, 2010 at 18:15

    Thanks Thierry!

  8. nosh
    March 4, 2010 at 16:10

    Hi :)
    Thank you for you guideline. I have installed NC and CC. but the problem is that my instance goes to termination state immediately after running.
    Do you have idea ? Thanks

    • Thierry Carrez
      March 5, 2010 at 07:16

      No. I would suggest checking all the eucalyptus logs, and if the problem is not obvious from there, file a bug.

  9. MrGibons
    March 11, 2010 at 03:56

    How do I change it so it saves the image to a different drive in this step “$ zcat -f image.gz | cp –sparse=always /dev/stdin image” I made my Linux partition rather small on the idea that I would still be able to use my other drives.

  10. John
    April 19, 2010 at 16:30

    I had an error here:
    euca-upload-bundle -b ueckernel -m /tmp/vmlinuz.manifest.xml

    and got what is attached at the end, I can’t figure what is wrong with it, ANY guess?
    I tried the same command but with sudo and it returned “EC2_ACCESS_KEY environment variable must be set”
    is it the error? where do I set it and with what must I set it?

    THANKS!

    Checking bucket: ueckernel
    Traceback (most recent call last):
    File “/usr/bin/euca-upload-bundle”, line 226, in
    main()
    File “/usr/bin/euca-upload-bundle”, line 209, in main
    bucket_instance = ensure_bucket(conn, bucket, canned_acl)
    File “/usr/bin/euca-upload-bundle”, line 87, in ensure_bucket
    bucket_instance = connection.get_bucket(bucket)
    File “/usr/lib/pymodules/python2.6/boto/s3/connection.py”, line 238, in get_bucket
    rs = bucket.get_all_keys(None, maxkeys=0)
    File “/usr/lib/pymodules/python2.6/boto/s3/bucket.py”, line 204, in get_all_keys
    headers=headers, query_args=s)
    File “/usr/lib/pymodules/python2.6/boto/s3/connection.py”, line 305, in make_request
    data, host, auth_path, sender)
    File “/usr/lib/pymodules/python2.6/boto/connection.py”, line 419, in make_request
    return self._mexe(method, path, data, headers, host, sender)
    File “/usr/lib/pymodules/python2.6/boto/connection.py”, line 398, in _mexe
    raise e
    socket.error: [Errno 113] No route to host

    • Thierry Carrez
      April 19, 2010 at 18:41

      You should get cloud credentials (through the web UI or euca_conf –get-credentials), then source the .eucarc file… That should give you all you need.

  11. May 5, 2010 at 21:02

    Thierry tyvm for the answer!

    I’m having the same problem, I followed this guide:

    https://help.ubuntu.com/community/Eucalyptus%2Benvironment

    and I’m still having the same problem, I don’t get what could be wrong.

    Thanks for the help!

  12. James Carter
    May 18, 2010 at 13:31

    Hi all, I have a trouble with my cloud. My instances change state “pending” to ” shutting-down” and never “running”. I don’t know about my error.Sometimes, it changes to state “running” for a few second then “shutting-down”.
    Help me.
    Thank all.

    • maedot
      March 15, 2011 at 18:35

      I have same problem. And more to it is that, I cant ssh to the instance when it was running. It tells me that there is no route to the host. Any ideas?

      • maedot
        June 27, 2011 at 20:21

        I solved my problems, i had all the problems because the processor was not VT enabled and hence the hypervisor was not working.

  13. Jenifer
    September 10, 2010 at 15:52

    i enter this command:
    $ euca-authorize default -P tcp -p 22 -s 0.0.0.0/0
    and i get [Errno 113]No route to host
    what should i do? please help..

  14. Girish L C
    October 29, 2010 at 13:45

    Please help me to register images,

    $ euca-register mybucket/kernel.manifest.xml
    Image: Only administrators can register kernel images.

    when I tried https://front-end-ip:8443/ (tried with https://locahost:8443) and 8773
    got below error,

    XML Parsing Error: undefined entity
    Location: jar:file:///usr/lib/firefox-3.6.10/chrome/toolkit.jar!/content/global/netError.xhtml
    Line Number 60, Column 12: &loadError.label;

    • Thierry Carrez
      November 3, 2010 at 08:09

      You must use an admin UEC account to register kernel images (you can get such creds from “sudo euca_conf –get-credentials mycreds.zip”). If that doesn’t work, you should file a bug in Launchpad, as blog comments are not the proper place for a support discussion.

  15. w
    December 28, 2010 at 06:53

    this site is very good

  16. Simon Vo
    February 17, 2011 at 05:41

    Hi Expert,
    I have issue , after start instance , i can not Ping or login via SSH , how can i solve it ?
    cladmin@cc:~$ euca-describe-instances
    RESERVATION r-5B1709B0 admin default
    INSTANCE i-423A07CA emi-E02C107C 192.168.5.28 172.19.1.3 running mykey 0 m1.small 2011-02-16T11:14:29.848Z cluster1 eki-F64610EF eri-0ADF1166
    RESERVATION r-4A030754 admin default
    INSTANCE i-4015070F emi-E02C107C 192.168.5.25 172.19.1.2 running eucakey 0 m1.small 2011-02-16T12:02:58.999Z cluster1 eki-F64610EF eri-0ADF1166
    cladmin@cc:~$ ssh -i .euca/mykey.priv ubuntu@192.168.5.25
    ssh: connect to host 192.168.5.25 port 22: No route to host
    Thanks very much
    Simon

  17. lemon1707
    May 2, 2011 at 14:40

    Hi expert,
    How to attach volume to instance? I have a trouble with attachment volume to instance. My cloud is setup on single machine. Can I atatch volume to instance with installation on single machine? Please help me !
    Thank you very much.

  18. shanu
    January 10, 2012 at 12:37

    how to find the amount of load on a node in a ubuntu enterprise cloud environment??

  19. vinay vasoya
    February 13, 2012 at 09:13

    Same problem with Ubuntu 9.10 Cloud (eucalyptus).
    Instance first is in “pending” status, then few secs – “running” and then “terminated”.
    Did somebody find solution ?
    thanx in adv!!

  20. September 6, 2012 at 05:03

    can i upload a website in this cloud

  1. October 19, 2009 at 10:29
  2. October 31, 2009 at 22:35
  3. June 21, 2010 at 10:29
  4. June 21, 2010 at 13:59
  5. June 23, 2010 at 11:49
  6. July 30, 2010 at 09:46

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 33 other followers