个人工具

“UbuntuHelp:UEC/BundlingImages”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(创建新页面为 '{{From|https://help.ubuntu.com/community/UEC/BundlingImages}} {{Languages|UbuntuHelp:UEC/BundlingImages}} Using UEC consists of creating and registering images with the Cloud Co...')
 
 
第2行: 第2行:
 
{{Languages|UbuntuHelp:UEC/BundlingImages}}
 
{{Languages|UbuntuHelp:UEC/BundlingImages}}
 
Using UEC consists of creating and registering images with the Cloud Controller.
 
Using UEC consists of creating and registering images with the Cloud Controller.
 +
This page describes the process for Ubuntu 10.04 LTS.  If you are running Ubuntu 9.10, you will need to follow [[UbuntuHelp:UEC/BundlingImages9.10|this process]].
 
There is more than one way to obtain a virtual image:
 
There is more than one way to obtain a virtual image:
 
* Download an image from the network, bundle and upload it
 
* Download an image from the network, bundle and upload it
 
* Create a custom image using VMBuilder
 
* Create a custom image using VMBuilder
 
* Use the Image store to download and install and image
 
* Use the Image store to download and install and image
Here we will describe the process of downloading one of the [http://uec-images.ubuntu.com/releases/karmic/ Official Ubuntu UEC Images] that we publish and maintain on a regular basis.
+
Here we will describe the process of downloading one of the [http://uec-images.ubuntu.com/lucid/ daily builds] that are built and published automatically. The process is similar for [http://uec-images.ubuntu.com/releases/ Official Released Images]
 
{|border="1" cellspacing="0"
 
{|border="1" cellspacing="0"
 
| '''Note:''' the shell variables that are set in the below code snippets are very useful for scripts or to reuse them when typing commands.  
 
| '''Note:''' the shell variables that are set in the below code snippets are very useful for scripts or to reuse them when typing commands.  
第14行: 第15行:
 
<pre><nowiki>
 
<pre><nowiki>
 
TIMESTAMP=$(date +%Y%m%d%H%M%S)
 
TIMESTAMP=$(date +%Y%m%d%H%M%S)
RELEASE=karmic
+
RELEASE=lucid
 
ARCH=amd64    # Or this might be i386
 
ARCH=amd64    # Or this might be i386
 
[ $ARCH = "amd64" ] && IARCH=x86_64 || IARCH=i386
 
[ $ARCH = "amd64" ] && IARCH=x86_64 || IARCH=i386
UEC_IMG=$RELEASE-uec-$ARCH
+
UEC_IMG=$RELEASE-server-uec-$ARCH
 
URL=http://uec-images.ubuntu.com/$RELEASE/current/
 
URL=http://uec-images.ubuntu.com/$RELEASE/current/
[ ! -e $UEC_IMG.tar.gz ] &&  wget $URL/$UEC_IMG.tar.gz # This may take a bit, depending on your connectivity
+
[ ! -e $UEC_IMG.tar.gz ] &&  wget $URL/$UEC_IMG.tar.gz
 +
uec-publish-tarball $UEC_IMG.tar.gz $RELEASE-$TIMESTAMP
 
</nowiki></pre>
 
</nowiki></pre>
<ol><li>Next, you will need to bundle, upload and register a kernel, ramdisk and finally your image:
+
<ol><li>Now, your kernel and image will have been uploaded into Eucalyptus and should be ready to run.  To confirm, run the following command:</li></ol>
<ol><li>Unpack the UEC image tarball</li></ol>
+
 
+
<pre><nowiki>
+
[ ! -e $UEC_IMG.img ] && tar -S -xzf $UEC_IMG.tar.gz
+
</nowiki></pre>
+
<ol><li>Bundle the kernel</li></ol>
+
 
+
<pre><nowiki>
+
BUCKET_KERNEL="k-$TIMESTAMP"
+
UEC_KERNEL=$UEC_IMG-vmlinuz-virtual
+
euca-bundle-image -i $UEC_KERNEL -r $IARCH --kernel true
+
euca-upload-bundle -b $BUCKET_KERNEL -m /tmp/$UEC_KERNEL.manifest.xml
+
EKI=$(euca-register $BUCKET_KERNEL/$UEC_KERNEL.manifest.xml | grep "^IMAGE" | awk '{print $2}') && echo $EKI
+
</nowiki></pre>
+
<ol><li>Bundle the initrd</li></ol>
+
 
+
<pre><nowiki>
+
BUCKET_INITRD="r-$TIMESTAMP"
+
UEC_INITRD=$UEC_IMG-initrd-virtual
+
euca-bundle-image -i $UEC_INITRD -r $IARCH --ramdisk true
+
euca-upload-bundle -b $BUCKET_INITRD -m /tmp/$UEC_INITRD.manifest.xml
+
ERI=$(euca-register $BUCKET_INITRD/$UEC_INITRD.manifest.xml | grep "^IMAGE" | awk '{print $2}') && echo $ERI
+
</nowiki></pre>
+
<ol><li>Bundle the image itself (this can take some time)</li></ol>
+
 
+
<pre><nowiki>
+
BUCKET_IMAGE="i-$TIMESTAMP"
+
UEC_IMG=$RELEASE-uec-$ARCH
+
euca-bundle-image -i $UEC_IMG.img -r $IARCH --kernel $EKI --ramdisk $ERI # This will take a long time (~10m)
+
euca-upload-bundle -b $BUCKET_IMAGE -m /tmp/$UEC_IMG.img.manifest.xml
+
EMI=$(euca-register $BUCKET_IMAGE/$UEC_IMG.img.manifest.xml | grep "^IMAGE" | awk '{print $2}') && echo $EMI
+
</nowiki></pre>
+
{|border="1" cellspacing="0"
+
| '''Alternate:''' The [https://code.launchpad.net/~ubuntu-on-ec2/ubuntu-on-ec2/uec-tools uec-tools] branch has a script named 'register-uec-tarball' that combines the steps above.
+
|}
+
<pre><nowiki>
+
# invoke as ./register-uec-tarball <tarball> <bucket> [<arch>]
+
./register-uec-tarball ubuntu-9.10-uec-amd64.tar.gz ubuntu-9.10-uec-release-amd64
+
</nowiki></pre>
+
<ol><li>Now, your kernel, ramdisk and image will have been uploaded into Eucalyptus and should be ready to run.  To confirm, run the following command:</li></ol>
+
  
 
<pre><nowiki>
 
<pre><nowiki>
 
euca-describe-images
 
euca-describe-images
 
</nowiki></pre>
 
</nowiki></pre>
You should see a registered kernel, ramdisk and image and they should be marked as 'available'.
+
You should see a registered kernel and image and they should be marked as 'available'.
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2010年5月20日 (四) 00:37的最新版本

Using UEC consists of creating and registering images with the Cloud Controller. This page describes the process for Ubuntu 10.04 LTS. If you are running Ubuntu 9.10, you will need to follow this process. There is more than one way to obtain a virtual image:

  • Download an image from the network, bundle and upload it
  • Create a custom image using VMBuilder
  • Use the Image store to download and install and image

Here we will describe the process of downloading one of the daily builds that are built and published automatically. The process is similar for Official Released Images

Note: the shell variables that are set in the below code snippets are very useful for scripts or to reuse them when typing commands.
  1. Download the UEC image for the architecture you want. You can do it from your browser or from the command line:
TIMESTAMP=$(date +%Y%m%d%H%M%S)
RELEASE=lucid
ARCH=amd64    # Or this might be i386
[ $ARCH = "amd64" ] && IARCH=x86_64 || IARCH=i386
UEC_IMG=$RELEASE-server-uec-$ARCH
URL=http://uec-images.ubuntu.com/$RELEASE/current/
[ ! -e $UEC_IMG.tar.gz ] &&  wget $URL/$UEC_IMG.tar.gz
uec-publish-tarball $UEC_IMG.tar.gz $RELEASE-$TIMESTAMP
  1. Now, your kernel and image will have been uploaded into Eucalyptus and should be ready to run. To confirm, run the following command:
euca-describe-images

You should see a registered kernel and image and they should be marked as 'available'.