Can I install EC2 Amazon Linux OS locally on virtual machine?

11

Can I download and run any Amazon Linux os on my local machine?

  • If yes:

    • Then from where I can download this?
    • And can I get image ready for VirtualBox?
  • If no:

    • What is the equivalent OS that matches the following version of EC2 Amazon AMI: 3.4.57-48.42.amzn1.x86_64 (I think it’sAmazon Linux AMI 2013.03)

I’m running Ubuntu 14.04 currently and I want to setup either the EC2 Amazon instance or any similar flavor of Linux OS.

I’ve an got an application from client that runs of above given machine, it runs on Ubuntu but with millions of tweaks and every time when new developer needs to start work on this application they need to either switch the system or spend thousand of hours to setup the PHP application.

I like to setup it to virtual machine and for any new developer we can clone and share the image so we can save the time to setup the project.

riksof-zeeshan

Posted 2016-03-03T10:51:21.363

Reputation: 211

1I know this is an old question but… A LAMP application should not be this complicated: “…either switch the system or spend thousand of hours to setup the php application.” There is utterly no way a half competently setup PHP application should require this level of tweaks. LAMP stacks are extremely portable. I would highly recommend using Vagrant and learn how to setup a provisioning script that will allow the automatic creation of the massively tweaked server with a few keystrokes. – JakeGould – 2017-12-14T03:43:03.883

@riksof-zeeshan could you visit this question again and see if my answer is helpful for you? I think I've finished editing it... – Kingdon – 2018-01-21T16:33:19.807

1@Kingdon nahi bhai – riksof-zeeshan – 2018-01-24T06:50:58.150

Answers

10

Yes, you can!

While on May 13, 2016 you can't do it... actually, as of today, December 13 2017, the answer is yes, you can install Amazon Linux 2 on your own machines and in his Amazon AMI image!

https://aws.amazon.com/amazon-linux-2/

It is also available as virtual machine images for VMware, Oracle VM VirtualBox, and Microsoft Hyper-V virtualization solutions for on-premises development and testing.

This is from the announcement:

https://aws.amazon.com/about-aws/whats-new/2017/12/introducing-amazon-linux-2/

Virtual machine images and docker images:

Yahoo! From the FAQ you're supposed to generate a config.iso with user-data and meta-data:

... but it looks like this example of a cloud-init is a little more on point at explaining the different ways that you can set up the auth:

https://cdn.amazonlinux.com/os-images/latest/README.cloud-init

As a MacOS user rather than Linux desktop user, I also needed to know that the cdrtools homebrew package provides mkisofs which is apparently near identical to the genisoimage tool that is mentioned throughout the Amazon Linux cloud-init documentation.

mkisofs -output seed.iso -volid cidata -joliet -rock user-data meta-data

It may also help to know that if the seed.iso file generated above is not connected on first boot, it will be ineffectual. (This took me too many login attempts to figure out on my own, and I didn't see it mentioned anywhere in the documentation that I skimmed.)

If you just want an ec2-user account with password set to password, attaching this init.iso file on first boot will do that.

d3fbbe38530f6c49964e6829e86d1133b4dfe2b7 /Users/kingdonb/Downloads/init.iso

The contents of that file are in this gist, for posterity in case the init.iso link becomes bad.

Hope this helps!

Kingdon

Posted 2016-03-03T10:51:21.363

Reputation: 151

1what is the default username, I deployed OVA and attached seed.iso before powering on... i tried with ec2-user which isn't working – asvignesh – 2018-01-05T16:20:46.260

@asvignesh From what I've heard, there is not a default username and password (you need to modify seed.iso). I added a link to seed.iso with 'password' set for user1 and ec2-user accounts. – Kingdon – 2018-01-05T19:56:50.407

I think this should be the accepted answer – Kingdon – 2018-03-11T15:03:31.680

Except it doesn't answer the question. Amazon Linux 2 is not Amazon Linux, now is it? I think one would have to manually partition, instal something close, then rsync the / of an ec2 instance over the local / and re-install grub and fix a bunch of stuff that would inevitably break. – Billy C. – 2018-03-12T02:39:54.140

It's not? I mean, for starters, RVM does not seem to think it is Amazon Linux for some reason, but I'm pretty sure that's a bug in RVM because: $ head -1 /etc/os-release: NAME="Amazon Linux". Amazon Linux 2 is almost certainly as close as you will get, now that it's been made GA. It's much closer to any older Amazon Linux releases than the next closest contender, which is probably CentOS. – Kingdon – 2018-03-13T17:53:58.117

1

Note: you can update your seed.iso file on subsequent VM starts-- you will need to change the instance-id value in meta-data. "Note: that the instance-id provided (iid-local01 above) is what is used to determine if this is “first boot”. So if you are making updates to user-data you will also have to change that, or start the disk fresh." reference

– Peter Stephens – 2018-04-12T22:53:58.870

2

EDIT late in 2017 AWS released Amazon Linux 2, which can be installed on a local machine.

ORIGINAL ANSWER, for Amazon Linux v1 I believe the answer is no, and that the closest OS would be CentOS, which is not close enough to avoid your "millions of tweaks" problem.

Amazon says "The Amazon Linux AMI is only available for use inside of Amazon EC2." (http://aws.amazon.com/amazon-linux-ami/faqs/). You can only export an AMI which you created by import (https://aws.amazon.com/ec2/vm-import/). And the list of images you can import/export does not include Amazon Linux (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/VMImportPrerequisites.html#vmimport-operating-systems).

CentOS is probably the closest OS (Amazon Linux was based on RedHat/CentOS many years ago), but Amazon Linux has diverged a long way, is updated more often and includes a set of tools and repositories you can't easily include in your system build. I haven't found a way of duplicating Amazon Linux and keeping it up to date.

OPINION: By providing a free, very up-to-date OS complete with all AWS tools, Amazon has made it pretty compelling to use their OS over any others. But it's not open source, it locks you into their platform much more than any other linux, and you'll probably end up paying Amazon for lots of dev environments which you otherwise would not have chosen to use. Good commercial decision for them, but if you choose another more open distribution you have a more portable platform and less errors between dev and production.

andrew lorien

Posted 2016-03-03T10:51:21.363

Reputation: 431

You've hit on the primary reason why everyone except possibly Amazon should avoid Amazon Linux: vendor lock-in. Their lackluster QA doesn't help, either... – Michael Hampton – 2016-05-16T06:27:05.340

1This was all 100% true until just about a month ago, when Amazon Linux 2 was announced. – Kingdon – 2018-01-05T22:38:02.333

1@Kingdon ... yeah, they move fast. I'll edit the answer. – andrew lorien – 2018-01-09T06:42:39.763

1

@andrewlorien It still doesn't really resemble any serious linux distribution. Yes you can download it and install it on your own computers... it's incredible that this needs to go into a Release Note in 2017. Building from scratch is still not possible afaik, as evidenced by the dockerfile that simply un-tar's a txz into the container root: https://github.com/aws/amazon-linux-docker-images/blob/10641478ad16c6f44b691dc41acfc221c7a7594f/Dockerfile – I think the people that use Amazon Linux must be a different set than the people I'm used to dealing with in the open source community.

– Kingdon – 2018-01-09T16:26:47.163