关于EC2上的ami的kernel

EC2上,我使用的rightscale的AMI为centos5的V1版本,该版本的kernel版本为2.6.16。

可以使用下面的方法升级到2.6.18.

因为,amazon允许在启动的时候选择kernel版本,amazon提供的最新内核的版本为2.6.18(其实,rightscale就是使用amazon提供的2.6.18的内核),所以,可以选择使用2.6.18的kernel启动以后再将INSTANCE重新打包成AMI。下面有官方文档。

注:使用了2.6.18kernel后,启动后,查看output中的输出,有下面的错误

解决的办法:

Untar the file and you will get two folders boot and lib. Copy the files under boot to /boot of your ami. and similarly mv the contents of lib/modules to /lib/modules of the instance. When launching your ami, mention the kernel id too -- the one of the link is aki-9b00e5f2 。

使用aki-9b00e5f2(32位)启动ami,然后,上传module到相应的目录,然后重新打包成AMI。

module下载地址在下面的官方文档中有说明。

http://developer.amazonwebservices.com/connect/entry!default.jspa?categoryID=112&externalID=1345&fromSearchPage=true

如果你想找某个版本的kernel,你可以在amazon的ami里搜索

Feature Guide: Amazon EC2 User Selectable Kernels

This guide introduces the User Selectable Kernels for Amazon EC2.

AWS Products Used:Amazon EC2Language(s):OtherDate Published:2008-03-27
Introduction

Amazon EC2 now allows developers to use kernels other than the default Amazon EC2 kernels with their instances.

An Amazon Kernel Image (AKI) is similar to an Amazon Machine Image (AMI). The latter is prefixed with “ami-“while the former is prefixed with “aki-“. In addition, Amazon EC2 supports Amazon RAM disk Images (ARI) which might be required by kernels and are prefixed with “ari-“.

As of this release, anyone can use alternative kernels or RAM disks with their AMIs, but the ability to create and publish kernels and ramdisks is restricted to Amazon EC2 and selected vendors.

Prerequisites

Before you begin, make sure you are using the right versions of our WSDL, API Tools, and API:

WSDL and API version: 2008-02-01 or later API Tools: 1.3-19403 2008-02-01

Note: You can check version information using the ec2ver command.

Finding Available Kernel Images (AKIs) and RAM disks(ARIs)

We'll use the getting started image, and launch it with an alternative public kernel. Finding the AMI ID for this image is described in the Amazon Elastic Compute Cloud Getting Started Guide. At the time of writing, it is ami-2bb65342.

Finding an appropriate kernel is very similar.

ec2-describe-images -o self -o amazon IMAGE ami-25b6534c ec2-public-images/fedora-core4-apache-mysql.manifest.xml amazon available public i386 machine IMAGE ami-23b6534a ec2-public-images/fedora-core4-apache.manifest.xml amazon available public i386 machine IMAGE ami-20b65349 ec2-public-images/fedora-core4-base.manifest.xml amazon available public i386 machine IMAGE ami-22b6534b ec2-public-images/fedora-core4-mysql.manifest.xml amazon available public i386 machine IMAGE ami-36ff1a5f ec2-public-images/fedora-core6-base-x86_64.manifest.xml amazon available public x86_64 machine IMAGE ami-2bb65342 ec2-public-images/getting-started.manifest.xml amazon available public i386 machine IMAGE aki-9b00e5f2 ec2-public-images/vmlinuz-2.6.18-xenU-ec2-v1.0.i386.aki.manifest.xml amazon available private i386 kernel IMAGE aki-9800e5f1 ec2-public-images/vmlinuz-2.6.18-xenU-ec2-v1.0.x86_64.aki.manifest.xml amazon available private x86_64 kernel

This command lists your AMIs and Amazon's public AMIs, AKIs and ARIs. The output might not exactly match that shown above. Look for the lines containing image IDs starting with “aki-” or “ari-” (or use command line tools like grep to filter them out). These are kernels and RAM disks, respectively. You will need the kernel ID for the next step.

Important: The architecture of your AMI, RAM disk, and kernel must match. Even then, there is no guarantee a given combination will function correctly or boot successfully if they weren’t designed to be used together. Review the AKI’s release notes to see if it requires a RAM disk.

New Kernel

As of this release, Amazon EC2 has introduced two new kernels: aki-9b00e5f2 (32 bit) and aki-9800e5f1 (64 bit). They are the 2.6.18 Xen kernels (vmlinuz-2.6.18-xenU-ec2-v1.0).

** EC2 2.6.18 Release Notes **

This kernel version was chosen based on its use as the stock Linux kernel forming part of the Xen 3.1.0 software release.

Additional patches

includes vmsplice root exploit patch.

Configuration detail

default linux clock frequency is set to 1000HZ (CONFIG_HZ=1000), up from 100HZ. Xen modules(xennet and xenblk) are statically compiled. Xennet driver improved to address various packet handling issues. Further configuration details are available in ec2-modules packages listed below.

Modules
http://ec2-downloads.s3.amazonaws.com/ec2-modules-2.6.18-xenU-ec2-v1.0-i686.tgz 
http://ec2-downloads.s3.amazonaws.com/ec2-modules-2.6.18-xenU-ec2-v1.0-x86_64.tgz

kernel2.6.18 Source

http://ec2-downloads.s3.amazonaws.com/xen-3.1.0-src-ec2-v1.0.tgz.

Patch details
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=712a30e63c8066ed84385b12edbfb804f49cbc44

Running an Instance with a Different Kernel

Now that you have an AKI ID, you can launch an instance of the getting started AMI using this kernel. The following example assumes you created a keypair called gsg-keypair and that you authorized access on port 22 from the machine you are on for your default security group.

ec2-run-instances ami-2bb65342 -k gsg-keypair –-kernel aki-9b00e5f2 RESERVATION r-fb6e9e92 924417782495 default INSTANCE i-10a64379 ami-2bb65342 pending 0 m1.small 2007-07-11T16:40:44+0000 us-east-1c aki-0924c160

After launching the instance, ssh into the instance and confirm it is running a 2.6.18 kernel using the uname command.

ssh -i id_rsa-gsg-keypair root@ec2-72-44-33-55.z-2.compute-1.amazonaws.com The authenticity of host 'ec2-72-44-33-55.z-2.compute-1.amazonaws.com (216.182.225.42)' can't be established. RSA key fingerprint is 9d:0a:a9:51:32:38:11:83:a8:a7:1c:9c:1c:e6:58:b0. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'ec2-72-44-33-55.z-2.compute-1.amazonaws.com' (RSA) to the list of known hosts. Last login: Wed Jun 21 08:02:08 2006 root@my-instance # uname -v 2.6.18-xenU root@my-instance #

The AKI and ARI that the the instance is running are also exposed in the instance meta-data. Notice the latest version is 2008-02-01 or greater.

$ curl http://169.254.169.254/ 1.0 2007-01-19 2007-03-01 2007-08-29 2008-02-01

The relevant new meta-data fields are kernel-id, ramdisk-id and ancestor-ami-ids:

$ curl http://169.254.169.254/2008-02-01/meta-data/ ami-id ami-launch-index ami-manifest-path hostname instance-id instance-type local-hostname local-ipv4 public-hostname public-ipv4 public-keys/ reservation-id security-groups ancestor-ami-ids kernel-id ramdisk-id $ curl http://169.254.169.254/2008-02-01/meta-data/kernel-id/ aki-9b00e5f2 Bundling AMIs with a different AKI or ARI

In addition to specifying an AKI at launch time, you can create new AMIs that launch with a specified AKI by default. You can either rebundle an existing instance that was bundled with the desired AKI (as described above) or you can provide optional arguments to the ec2-bundle-vol command.

Note: You cannot change the default AKI of a registered AMI. You must rebundle and reregister it.

To bundle an AMI from a running instance that launched with an AKI, call the ec2-bundle-vol command as you normally would. The tool detects the AKI by inspecting the instance metadata (described above). The resulting AMI launches with the same AKI as the running instance.

To override the AKI that is currently bundled with an AMI, you can specify an AKI as a parameter to ec2-bundle-vol. To override the AKI, provide the –kernel parameter to ec2-bundle-vol.

Note: If you override the kernel in the bundling process, verify the AMI works with the requested AKI. It might be safer to relaunch your AMI with the desired kernel and bundle without an override.

The process of uploading the bundled image and registering the image is the same. After getting an AMI ID, instances launched using that AMI ID aree created with the kernel specified during the bundling process.

时间: 2024-08-15 02:47:40

关于EC2上的ami的kernel的相关文章

vpn-我在国外的一台机器亚马逊AWS EC2上搭建了 一个VPN服务,用国内的网络去访问,显示超时。

问题描述 我在国外的一台机器亚马逊AWS EC2上搭建了 一个VPN服务,用国内的网络去访问,显示超时. 日志如图所示 解决方案 这种服务,早就被墙了,没有做混淆的服务,基本连一天都用不了 解决方案二: 请教大神,也就是说企图用这种方式进行翻墙是不可行的啦? 解决方案三: http://www.fj.xinhuanet.com/2015-01/28/c_1114164074.htm

在Amazon EC2上运行Spark

在Amazon EC2上运行Spark Spark的ec2目录下有一个spark-ec2脚本,可以帮助你在Amazon EC2上启动.管理.关闭Spark集群.该脚本能在EC2集群上自动设置好Spark和HDFS.本文将会详细描述如何利用spark-ec2脚本来启动和关闭集群,以及如何在集群提交作业.当然,首先你必须在Amazon Web Services site上注册一个EC2的账户.   spark-ec2可以管理多个命名集群.你可以用它来启动一个新集群(需要提供集群大小和集群名称),关闭

现在在EC2 上我开ftp, 在本地cmd 命令行下ftp连接 服务器端,连接成功 ls无法执行?怎么回事?

问题描述 现在在EC2上我开ftp,在本地cmd命令行下ftp连接服务器端,连接成功ls无法执行?怎么回事? 解决方案 解决方案二:用户没有读权限,可以试试get或put命令或者被>符号骗了,其实没有登录成功解决方案三:防火墙问题,ftp分控制连接和数据连接,21端口的控制连接OK,数据连接被FW阻断了,查看下 EC2的安全组连接或是本地网络问题.

《Spark 官方文档》在Amazon EC2上运行Spark

在Amazon EC2上运行Spark Spark的ec2目录下有一个spark-ec2脚本,可以帮助你在Amazon EC2上启动.管理.关闭Spark集群.该脚本能在EC2集群上自动设置好Spark和HDFS.本文将会详细描述如何利用spark-ec2脚本来启动和关闭集群,以及如何在集群提交作业.当然,首先你必须在Amazon Web Services site上注册一个EC2的账户.   spark-ec2可以管理多个命名集群.你可以用它来启动一个新集群(需要提供集群大小和集群名称),关闭

大家有没有遇到这样的问题啊 我的java应用在EC2上运行 java获取系统时间插入数据库的时候,总是显示时间是null的?

问题描述 大家有没有遇到这样的问题啊我的java应用在EC2上运行java获取系统时间插入数据库的时候,总是显示时间是null的?

《Spark Cookbook 中文版》一1.4 在Amazon EC2上部署Spark

1.4 在Amazon EC2上部署Spark Amazon弹性计算云(Amazon EC2)是一个能够提供可变大小的云计算实例的网络服务,Amazon EC2提供以下特性. 通过互联网按需提供IT资源. 提供足够多的实例. 像支付水电费账单一样,按你使用实例的时间付费. 没有配置成本,无需安装,没有任何开销. 当你不需要实例时,只需关闭或者终止它们即可离开. 支持所有常用操作系统. EC2提供不同类型的实例,以满足所有计算需求,例如通用实例.微实例.内存优化实例.存储优化实例等,并提供微实例的

EC2上源安装vnstat

OS:amazon-linux-ami/2016.031.导入第三方EPEL源安装vnstat#sudo yum --enablerepo=epel install vnstat2.生成vnstat数据库#sudo vnstat -u -i eth0备注:先得确认你的网卡编号,通过ifconfig -a命令可看到,如果你的网卡不是eth0 ,则要修改成相应的网卡名称,并修改/etc/vnstat.conf的Interface "eth0" 为你的网卡名称.3.启动vnstat#sudo

AWS上如何实现多台EC2共享一个存储

问题描述 如题:AWS上如何实现多台EC2共享一个存储?多台EC2上部署应用程序,每台EC2上的应用程序访问共同的一个存储目录,如果实现这个需求?是否有类似NAS之类的服务? 解决方案 解决方案二:不懂啊!!!!!!!解决方案三:搞定了.申请了一台windowsserver的机器,然后启动smb服务,共享D盘:在同一个子网下,多台Linux服务器可同时mount共享磁盘.解决方案四:也可以开一个EBS,然后挂载到某EC2上,启用FTP服务后,也可以访问.造价应该比新开一个EC2便宜多了解决方案五

Amazon EC2和Google App Engine,谁是最后的赢家

Amazon EC2和Google App Engine,两大服务平台,谁能更胜一筹,我打算从三个角度来对比这两大云计算平台:技术,业务和未来发展趋势,本文是技术方面的对比,ok,准备好咖啡,我们开始吧! 如果按平台类型来分,大家可能已经知道Amazon EC2属于IaaS(基础设施即服务),Google App Engine属于PaaS(平台即服务).不过,如果Amazon EC2给你一个安装了操作系统的平台,你就可以自己安装应用程序,并且使用AMI(Amazon Machine Image)