特殊:Badtitle/NS100:UEC/CreateYourImage:修订间差异
小 创建新页面为 '{{From|https://help.ubuntu.com/community/UEC/CreateYourImage}} {{Languages|UbuntuHelp:UEC/CreateYourImage}} == Creating your own image == There are a few different ways one can ...' |
小无编辑摘要 |
||
第36行: | 第36行: | ||
mkdir ramdisk | mkdir ramdisk | ||
sudo sh -c 'grep -q acpiphp || | sudo sh -c 'grep -q acpiphp /etc/initramfs-tools/modules || | ||
printf "#acpiphp needed for ebs\nacpiphp\n" > /etc/initramfs-tools/modules' | printf "#acpiphp needed for ebs\nacpiphp\n" > /etc/initramfs-tools/modules' | ||
sudo mkinitramfs -o ./ramdisk/initrd.img-$(uname -r) | sudo mkinitramfs -o ./ramdisk/initrd.img-$(uname -r) |
2010年5月20日 (四) 00:38的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/UEC/CreateYourImage }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/af | • {{#if: UbuntuHelp:UEC/CreateYourImage|Afrikaans| [[::UEC/CreateYourImage/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/ar | • {{#if: UbuntuHelp:UEC/CreateYourImage|العربية| [[::UEC/CreateYourImage/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/az | • {{#if: UbuntuHelp:UEC/CreateYourImage|azərbaycanca| [[::UEC/CreateYourImage/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/bcc | • {{#if: UbuntuHelp:UEC/CreateYourImage|جهلسری بلوچی| [[::UEC/CreateYourImage/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/bg | • {{#if: UbuntuHelp:UEC/CreateYourImage|български| [[::UEC/CreateYourImage/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/br | • {{#if: UbuntuHelp:UEC/CreateYourImage|brezhoneg| [[::UEC/CreateYourImage/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/ca | • {{#if: UbuntuHelp:UEC/CreateYourImage|català| [[::UEC/CreateYourImage/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/cs | • {{#if: UbuntuHelp:UEC/CreateYourImage|čeština| [[::UEC/CreateYourImage/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/de | • {{#if: UbuntuHelp:UEC/CreateYourImage|Deutsch| [[::UEC/CreateYourImage/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/el | • {{#if: UbuntuHelp:UEC/CreateYourImage|Ελληνικά| [[::UEC/CreateYourImage/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/es | • {{#if: UbuntuHelp:UEC/CreateYourImage|español| [[::UEC/CreateYourImage/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/fa | • {{#if: UbuntuHelp:UEC/CreateYourImage|فارسی| [[::UEC/CreateYourImage/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/fi | • {{#if: UbuntuHelp:UEC/CreateYourImage|suomi| [[::UEC/CreateYourImage/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/fr | • {{#if: UbuntuHelp:UEC/CreateYourImage|français| [[::UEC/CreateYourImage/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/gu | • {{#if: UbuntuHelp:UEC/CreateYourImage|ગુજરાતી| [[::UEC/CreateYourImage/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/he | • {{#if: UbuntuHelp:UEC/CreateYourImage|עברית| [[::UEC/CreateYourImage/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/hu | • {{#if: UbuntuHelp:UEC/CreateYourImage|magyar| [[::UEC/CreateYourImage/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/id | • {{#if: UbuntuHelp:UEC/CreateYourImage|Bahasa Indonesia| [[::UEC/CreateYourImage/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/it | • {{#if: UbuntuHelp:UEC/CreateYourImage|italiano| [[::UEC/CreateYourImage/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/ja | • {{#if: UbuntuHelp:UEC/CreateYourImage|日本語| [[::UEC/CreateYourImage/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/ko | • {{#if: UbuntuHelp:UEC/CreateYourImage|한국어| [[::UEC/CreateYourImage/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/ksh | • {{#if: UbuntuHelp:UEC/CreateYourImage|Ripoarisch| [[::UEC/CreateYourImage/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/mr | • {{#if: UbuntuHelp:UEC/CreateYourImage|मराठी| [[::UEC/CreateYourImage/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/ms | • {{#if: UbuntuHelp:UEC/CreateYourImage|Bahasa Melayu| [[::UEC/CreateYourImage/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/nl | • {{#if: UbuntuHelp:UEC/CreateYourImage|Nederlands| [[::UEC/CreateYourImage/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/no | • {{#if: UbuntuHelp:UEC/CreateYourImage|norsk| [[::UEC/CreateYourImage/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/oc | • {{#if: UbuntuHelp:UEC/CreateYourImage|occitan| [[::UEC/CreateYourImage/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/pl | • {{#if: UbuntuHelp:UEC/CreateYourImage|polski| [[::UEC/CreateYourImage/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/pt | • {{#if: UbuntuHelp:UEC/CreateYourImage|português| [[::UEC/CreateYourImage/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/ro | • {{#if: UbuntuHelp:UEC/CreateYourImage|română| [[::UEC/CreateYourImage/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/ru | • {{#if: UbuntuHelp:UEC/CreateYourImage|русский| [[::UEC/CreateYourImage/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/si | • {{#if: UbuntuHelp:UEC/CreateYourImage|සිංහල| [[::UEC/CreateYourImage/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/sq | • {{#if: UbuntuHelp:UEC/CreateYourImage|shqip| [[::UEC/CreateYourImage/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/sr | • {{#if: UbuntuHelp:UEC/CreateYourImage|српски / srpski| [[::UEC/CreateYourImage/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/sv | • {{#if: UbuntuHelp:UEC/CreateYourImage|svenska| [[::UEC/CreateYourImage/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/th | • {{#if: UbuntuHelp:UEC/CreateYourImage|ไทย| [[::UEC/CreateYourImage/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/tr | • {{#if: UbuntuHelp:UEC/CreateYourImage|Türkçe| [[::UEC/CreateYourImage/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/vi | • {{#if: UbuntuHelp:UEC/CreateYourImage|Tiếng Việt| [[::UEC/CreateYourImage/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/yue | • {{#if: UbuntuHelp:UEC/CreateYourImage|粵語| [[::UEC/CreateYourImage/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/zh | • {{#if: UbuntuHelp:UEC/CreateYourImage|中文| [[::UEC/CreateYourImage/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/zh-hans | • {{#if: UbuntuHelp:UEC/CreateYourImage|中文(简体)| [[::UEC/CreateYourImage/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:UEC/CreateYourImage | UbuntuHelp:UEC/CreateYourImage | {{#if: | :}}UEC/CreateYourImage}}/zh-hant | • {{#if: UbuntuHelp:UEC/CreateYourImage|中文(繁體)| [[::UEC/CreateYourImage/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:UEC/CreateYourImage|:UEC/CreateYourImage|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :UEC/CreateYourImage/zh | | {{#ifexist: UEC/CreateYourImage/zh | | {{#ifeq: {{#titleparts:UEC/CreateYourImage|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:UEC/CreateYourImage|1|-1|}} | zh | | }}
Creating your own image
There are a few different ways one can create his own image.
Eucalyptus procedure
The Eucalyptus project is proposing an alternate guide to create images
Using vmbuilder
If you would want to author your own image, you can use the vmbuilder utility utility to create an image that will run in Eucalyptus. First, create a partition description file called 'part'. The contents describe the size, types, and mount points of your VM disk partitions:
$ cat > part <<EOF root 400 /mnt/ephemeral 2000 /dev/sda2 swap 1 /dev/sda3 EOF
Next, create a simple script called 'firstboot' that will be executed the first time your image boots inside Eucalyptus to install an ssh daemon. In a file called 'firstboot' create the shell script:
$ cat >firstboot <<EOF #!/bin/sh apt-get -y install openssh-server EOF
Then, create the image with vmbuilder passing the name of the script file as an argument so that it can be installed. Note that even though we are asking vmbuilder to create a 'xen' image (this simply just means that the output format of the image is a disk partition), the resulting image will boot in Eucalyptus using KVM.
sudo vmbuilder xen ubuntu --part ./part --firstboot ./firstboot
Next, you will need to bundle, upload and register a kernel, ramdisk and finally your image. Using the EC2 API tools, perform the following steps:
mkdir kernel euca-bundle-image --image /boot/vmlinuz-$(uname -r) \ --destination ./kernel --kernel true euca-upload-bundle --bucket kernel \ --manifest ./kernel/vmlinuz-$(uname -r).manifest.xml EKI=`euca-register kernel/vmlinuz-$(uname -r).manifest.xml | awk '{print $2}'` echo $EKI mkdir ramdisk sudo sh -c 'grep -q acpiphp /etc/initramfs-tools/modules || printf "#acpiphp needed for ebs\nacpiphp\n" > /etc/initramfs-tools/modules' sudo mkinitramfs -o ./ramdisk/initrd.img-$(uname -r) euca-bundle-image --image ./ramdisk/initrd.img-$(uname -r) \ --destination ./ramdisk --ramdisk true euca-upload-bundle --bucket ramdisk \ --manifest ramdisk/initrd.img-$(uname -r).manifest.xml ERI=`euca-register ramdisk/initrd.img-$(uname -r).manifest.xml | awk '{print $2}'` echo $ERI mkdir image euca-bundle-image --image ubuntu-xen/root.img \ --destination ./image --kernel $EKI --ramdisk $ERI euca-upload-bundle --bucket image --manifest ./image/root.img.manifest.xml EMI=`euca-register image/root.img.manifest.xml | awk '{print $2}'` echo $EMI
Note the shell variables that have been set in the above code snippets. They will be used to test the installation in the steps below. Now, your kernel, ramdisk 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, ramdisk and image and they should be marked as 'available'. Please note: if you are preparing the bundle on a machine that uses encrypted filesystems be aware that you cannot bundle the machine ramdisk for your AMI. This is because your local ramdisk includes routines to decrypt your local encrypted filesystem and these will make the instance crash at boot (as the encrypted filesystem does not exist).