Amazon EC2 实例如何选择其内核?
我有一个使用 Amazon 提供的 Fedora 8 64 位 AMI 的 Amazon EC2 实例,我想将其升级到 Fedora 10。
我尝试通过运行“yum update”来升级内核和所有软件包来执行此操作。 这似乎工作正常,我看到我现在已经安装了 fc10 内核,并且我安装的所有软件包也已更新到 Fedora 10 版本。
但是,我还注意到 fc8 内核仍然安装,当我重新启动映像时,它会返回运行 fc8 内核,而不是 fc10 内核(我从“uname -a”的输出中推断出这一点)。
我是否需要采取一些额外的步骤才能使我的映像在 fc10 内核下启动,或者这是否可能? 亚马逊文档没有发现任何对我有用的东西。
I have an Amazon EC2 instance using the Amazon-supplied Fedora 8 64-bit AMI, which I would like to upgrade to Fedora 10.
I tried doing this by running "yum update" to upgrade the kernel and all packages. This seemed to work fine and I see that I now have the fc10 kernel installed, and all of my installed packages have also been updated to the Fedora 10 versions.
However, I also noticed that the fc8 kernel is still installed, and when I reboot my image it comes back running the fc8 kernel, not the fc10 kernel (I'm inferring this from the output of "uname -a").
Are there some additional steps I need to take to get my image to boot under the fc10 kernel, or is this even possible ? The Amazon documentation didn't turn up anything useful for me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您可以创建自己的 AMI,但需要使用 Amazon 提供的内核。 他们提供的最新版本是 2.6.21。 我有一个用于 CentOS 实例的 fc(Fedora Core)内核列表。 我很确定它们在 Ubuntu 上也能正常工作。
当您使用 ec2-register 注册 AMI 时,您需要将它们烘焙到 AMI 中。 它们可以在启动实例时更改,但我喜欢从正确的 AKI(内核)和 ARI(ramdisk)开始。 添加对临时磁盘的支持也很有帮助。 您需要为较大实例的额外存储付费,您不妨使用它。 我对 ec2-register 的魔咒:
您可以更改区域、快照 ID、描述、名称、架构等。
还要记住内核和内核。 ramdisk 是特定于区域的。 我不记得从哪里得到这份清单,但我很难找到它。 希望它能帮助别人。
2.6.21 内核可供选择:
美国区域:
32 位:
64 位:
欧盟区域:
32 位:
64 位:
亚太地区:
64 位:
32 位
You can create your own AMI but you need to use the Amazon-supplied kernels. The newest they provide is 2.6.21. I have a list of the fc (Fedora Core) kernels that I use for CentOS instances. I'm pretty sure they work fine with Ubuntu as well.
You'll want to bake these into your AMI when you register it using ec2-register. They can be changed at the time you start an instance but I like having the proper AKI (kernel) and ARI (ramdisk) to start with. Adding support for the ephemeral disks is helpful as well. You're paying for the extra storage with larger instances, you might as well use it. My magic incantation for ec2-register:
You can change region, snapshot ID, description, name, arch, etc.
Also remember the kernels & ramdisks are region-specific. I can't remember where I got this list but I had trouble finding it. Hope it helps someone out.
2.6.21 kernels are available as:
US Region:
32-bit:
64-bit:
EU Region:
32-bit:
64-bit:
AP Region:
64-bit:
32 -bit
您无法将您自己的内核映像上传到 EC2/Amazon。 只有授权用户才能上传内核映像。
即使您上传自己的 Linux 操作系统映像并在 EC2 中从该映像启动,也会加载预先确定的内核,该内核与您最初上传的内核不同。 这是亚马逊做出的政策决定。 您最多可以做的就是更改默认内核版本,从您希望实例启动时使用的预定且可用的亚马逊内核列表中进行选择。
然而,您可以构建自己的内核模块或为加载的内核重建模块。 编译您自己的模块或重新编译正在加载的内核提供的模块会有点棘手,因为亚马逊中的内核是使用 Xen 虚拟机管理程序进行修改的内核。 您需要找出实例中加载的特定内核源代码。
干杯
埃内斯托·贝内迪托
You cannot upload your own kernel image to EC2/Amazon. Only authorized users can upload kernel images.
Even when you upload your own Linux OS image and boot from it in EC2, a predetermined kernel is loaded that is not the same as the one you initially uploaded. This is a policy decision made by Amazon. The most you can do is to change the default kernel version selecting from a list of predetermined and available amazon kernels that you want your instance to boot up with.
You can however build your own kernel module(s) or rebuild the ones for the kernel that gets loaded. Compiling your own module or recompiling the modules provided by the kernel being loaded gets a bit tricky as the kernel in amazon is a modified one with Xen hypervisor. You need to find out the specific kernel source code that gets loaded in your instance.
Cheers
Ernesto Benedito
看来你不能。 这家伙尝试过,但还没有成功。
http://developer.amazonwebservices.com/connect/thread.jspa? messageID=72964#72964
Looks like you can't. This guy tried, but has not succeeded yet.
http://developer.amazonwebservices.com/connect/thread.jspa?messageID=72964#72964
从技术上讲,至少直到最近,您还无法选择内核。 您只能选择要打包到映像中的模块。 亚马逊保留对内核的完全控制权。 这可能是必要的,因为 Xen 虚拟化必须以某种特殊的方式与内核交互。
在最近的更新中(几个月前,我上次检查时),亚马逊扩展了他们的一些 API 和工具,允许您从他们提供的几个内核之一中进行选择。 例如,您可以在 2.6.16 和 2.6.18 之间进行选择。
看起来似乎最终可能会支持构建您自己的“内核映像”,但所需的工具并不完整。 我猜测他们(亚马逊)只向特殊合作伙伴提供此功能,因为我看到出现了几个具有特殊关联内核映像的第三方映像。
Technically, at least until recently, you could not select a kernel. You could only select which modules you get to package in the image. Amazon retains full control over the kernel. This is probably necessary because the Xen virtualization has to interact with the kernel in some special way.
In recent updates (several months ago, last time I checked), Amazon has extended some of their API and tools to allow you to select from one of a few kernels they provide. For example, you could choose between 2.6.16 and 2.6.18.
It looked as though there might eventually be support for building your own "kernel image," but the tools necessary for this were not complete. I am guessing they (Amazon) were providing this capability to special partners only, as I saw several third-party images crop up that had special associated kernel images.
根据我使用 OpenSolaris AMI 的经验,这是不可能的。 EC2 环境中还禁用了 pkg 映像更新工具,以精确防止这种情况发生。 原因可能是每个映像都与特定的 ramdisk 和内核(aki 和 ari)相关联。 而且,它们无法更新为新的。 我认为,这也适用于其他 AMI,正如您的案例中所观察到的那样。
In my experience with OpenSolaris AMIs, this is not possible. The pkg image-update tool is also disabled in EC2 environment to precisely prevent this from happening. The reasoning could be that every image is associated with a specific ramdisk and kernel (aki and ari). And, they cannot be updated to new ones. I think, this holds for other AMIs too, as observed in your case.
也许您最好的选择是创建自己的 AMI; 加载 AMI 时获得的内核是创建 AMI 时正在运行的内核。
Probably your best bet is to create your own AMI; the kernel you get when you load an AMI is whatever kernel was running when the AMI was created.