{"id":169331,"date":"2013-02-18T11:17:05","date_gmt":"2013-02-18T07:17:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=169331"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=169331","title":{"rendered":"<span class=\"post_title\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 \u0441 \u0447\u0438\u0441\u0442\u044b\u043c CentOS 5.9 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 Amazon<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 Amazon \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 (\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 <a href=\"https:\/\/aws.amazon.com\/amis\">AMI<\/a>). Amazon \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0437\u044b, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u043d\u0435\u0441\u0451\u0442. \u041d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u0435\u043d \u043e\u0431\u0440\u0430\u0437 \u0447\u0438\u0441\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0442 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432. \u0422\u043e\u0433\u0434\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434 \u2014 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0439 AMI.<\/p>\n<p>  \u0412 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u043f\u0438\u0441\u0430\u043d <a href=\"http:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/creating-loopback-s3-linux.html\">\u0441\u043f\u043e\u0441\u043e\u0431<\/a> \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u00abinstance store-backed AMI\u00bb. \u041c\u0438\u043d\u0443\u0441 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0435\u0449\u0451 \u0438 \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u00abEBS-backed AMI\u00bb<\/p>\n<p>  \u041e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 EBS-backed AMI \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 Amazon \u0431\u0435\u0437 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432, \u043f\u043e\u0439\u0434\u0451\u0442 \u0440\u0435\u0447\u044c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041f\u043b\u0430\u043d \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439:  <\/p>\n<ul>\n<li>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435<\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0447\u0438\u0441\u0442\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438<\/li>\n<li>\u0421\u0434\u0435\u043b\u0430\u0442\u044c snapshot (\u0441\u043b\u0435\u043f\u043e\u043a) \u0434\u0438\u0441\u043a\u0430<\/li>\n<li>\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c AMI<\/li>\n<\/ul>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u043b\u044e\u0431\u043e\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0448\u0435\u0439\u043f\u0430, \u0445\u043e\u0442\u044c t1.micro. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 CLI:  <\/p>\n<pre><code class=\"bash\">aws ec2 run-instances --image-id ami-1624987f --max-count 1 --min-count 1 --key-name mel --instance-type t1.micro <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c ebs-volume, \u043a\u0443\u0434\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u043e\u0437\u0434\u043d\u0435\u0435 \u043d\u0430\u0448\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443:  <\/p>\n<pre><code class=\"bash\">aws ec2 create-volume --availability-zone us-east-1a --size 10 <\/code><\/pre>\n<p>\u042d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u043b\u044f \u043d\u0430\u0441 \u0434\u0438\u0441\u043a \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 10 Gb. \u0412\u0430\u0436\u043d\u043e: \u0434\u0438\u0441\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0437\u043e\u043d\u0435, \u0447\u0442\u043e \u0438 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e us-east-1a).<br \/>  \u0414\u0430\u043b\u0435\u0435 \u0434\u0438\u0441\u043a \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u043a \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0443:  <\/p>\n<pre><code class=\"bash\">aws ec2 attach-volume --instance-id i-2bc0925b --volume-id vol-08ab3079 --device \/dev\/xvdf <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043b\u043e\u0433\u0438\u043d\u0438\u043c\u0441\u044f \u043d\u0430 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043f\u043e ssh, \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u0435\u043c \u0434\u0438\u0441\u043a \u0438 \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e:  <\/p>\n<pre><code class=\"bash\">mkfs.ext3 \/dev\/xvdf mkdir \/mnt\/centos-image mount \/dev\/xvdf \/mnt\/centos-image cd !$ <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0447\u0438\u0441\u0442\u043e\u0433\u043e Centos 5.9<\/h4>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432, \u043f\u0440\u0438\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c proc \u0438 sysfs, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432:  <\/p>\n<pre><code class=\"bash\">mkdir centos-image\/{boot,tmp,dev,sys,proc,etc,var} mount -t proc none \/mnt\/centos-image\/proc\/ mount -t sysfs none \/mnt\/centos-image\/sys\/ for i in console null zero ; do \/sbin\/MAKEDEV -d \/mnt\/centos-image\/dev -x $i ; done <\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 yum \u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">yum-centos.conf<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">[main] cachedir=\/var\/cache\/yum debuglevel=2 logfile=\/var\/log\/yum.log exclude=*-debuginfo gpgcheck=0 obsoletes=1 reposdir=\/dev\/null  [base] name=CentOS-5.9 - Base mirrorlist=http:\/\/mirrorlist.centos.org\/?release=5.9&arch=x86_64&repo=os #baseurl=http:\/\/mirror.centos.org\/centos\/5.9\/os\/x86_64\/ gpgcheck=1 gpgkey=http:\/\/mirror.centos.org\/centos\/RPM-GPG-KEY-CentOS-5  [updates] name=CentOS-5.9 - Updates mirrorlist=http:\/\/mirrorlist.centos.org\/?release=5.9&arch=x86_64&repo=updates #baseurl=http:\/\/mirror.centos.org\/centos\/5.9\/updates\/x86_64\/ gpgcheck=1 gpgkey=http:\/\/mirror.centos.org\/centos\/RPM-GPG-KEY-CentOS-5  [extras] name=CentOS-5.9 - Extras mirrorlist=http:\/\/mirrorlist.centos.org\/?release=5.9&arch=x86_64&repo=extras #baseurl=http:\/\/mirror.centos.org\/centos\/5.9\/extras\/x86_64\/ gpgcheck=1 gpgkey=http:\/\/mirror.centos.org\/centos\/RPM-GPG-KEY-5  [centosplus] name=CentOS-5.9 - Plus mirrorlist=http:\/\/mirrorlist.centos.org\/?release=5.9&arch=x86_64&repo=centosplus #baseurl=http:\/\/mirror.centos.org\/centos\/5.9\/centosplus\/x86_64\/ gpgcheck=1 enabled=0 gpgkey=http:\/\/mirror.centos.org\/centos\/RPM-GPG-KEY-5  [contrib] name=CentOS-5.9 - Contrib mirrorlist=http:\/\/mirrorlist.centos.org\/?release=5.9&arch=x86_64&repo=contrib #baseurl=http:\/\/mirror.centos.org\/centos\/5.9\/contrib\/x86_64\/ gpgcheck=1 enabled=0 gpgkey=http:\/\/mirror.centos.org\/centos\/RPM-GPG-KEY-5 <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<pre><code class=\"bash\">yum -c ~\/yum-centos.conf --installroot=\/mnt\/centos-image\/ -y groupinstall Base <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438, \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:  <\/p>\n<pre><code class=\"bash\">yum -c ~\/yum-centos.conf --installroot=\/mnt\/centos-image\/ install $packet_name <\/code><\/pre>\n<p>  \u041e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c fstab:  <\/p>\n<pre><code class=\"bash\">vi \/mnt\/centos-image  \/dev\/xvda1  \/      ext3    defaults        0 0 none       \/dev\/pts  devpts  gid=5,mode=620  0 0 none       \/dev\/shm  tmpfs   defaults        0 0 none       \/proc     proc    defaults        0 0 none       \/sys      sysfs   defaults        0 0 <\/code><\/pre>\n<p>  \u0412 CentOS 5.9 \u0435\u0449\u0451 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u044f\u0434\u0440\u043e \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 xen:  <\/p>\n<pre><code class=\"bash\">yum -c ~\/yum-centos.conf --installroot=\/mnt\/centos-image\/ -y install kernel-xen <\/code><\/pre>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c Grub:  <\/p>\n<pre><code class=\"bash\">chroot \/mnt\/centos-image\/ grub-install \/dev\/xvdf <\/code><\/pre>\n<p>  \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u043e\u0432\u044b\u0439 initrd:  <\/p>\n<pre><code class=\"bash\">chroot \/mnt\/centos-image\/ cd boot\/ mkinitrd --omit-scsi-modules --with=xennet --with=xenblk --fstab=\/etc\/fstab --preload=xenblk initrd-2.6.18-348.1.1.el5xen.img 2.6.18-348.1.1.el5xen <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u043d\u043e\u0432\u044b\u0439 fstab, \u0438\u043d\u0430\u0447\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f.<br \/>  \u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b menu.lst \u0434\u043b\u044f grub:  <\/p>\n<pre><code class=\"bash\">default=0 timeout=5 hiddenmenu title CentOS_5.9_(x86_64)         root (hd0)         kernel \/boot\/vmlinuz-2.6.18-348.1.1.el5xen ro root=\/dev\/xvda1         initrd \/boot\/initrd-2.6.18-348.1.1.el5xen.img <\/code><\/pre>\n<p>  \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u0435\u0442\u044c \u0438 sshd:  <\/p>\n<pre><code class=\"bash\">vi etc\/sysconfig\/network-scripts\/ifcfg-eth0 ONBOOT=yes DEVICE=eth0 BOOTPROTO=dhcp TYPE=Ethernet USERCTL=yes PEERDNS=yes IPV6INIT=no  vi etc\/sysconfig\/network NETWORKING=yes  chroot \/mnt\/centos5img\/ chkconfig --level 2345 network on  vi \/mnt\/centos5img\/etc\/ssh\/sshd_config ... UseDNS no PermitRootLogin without-password <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0443\u044e \u0441\u0435\u0442\u044c \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c. \u041d\u043e, \u0441\u0430\u043c \u043a\u043b\u044e\u0447 \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u043f\u0440\u043e\u043a\u0438\u043d\u0443\u0442\u044c \u043d\u0430 \u0438\u043d\u0441\u0442\u0430\u043d\u0441. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0431\u0438\u0440\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0435:  <\/p>\n<pre><code class=\"bash\">vi \/mnt\/centos5img\/etc\/init.d\/ec2-get-ssh <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">ec2-get-ssh<\/b><\/p>\n<div class=\"spoiler_text\">#!\/bin\/bash<br \/>  # chkconfig: 2345 95 20<br \/>  # processname: ec2-get-ssh<br \/>  # description: Capture AWS public key credentials for EC2 user<\/p>\n<p>  # Source function library<br \/>  . \/etc\/rc.d\/init.d\/functions<\/p>\n<p>  # Source networking configuration<br \/>  [ -r \/etc\/sysconfig\/network ] &#038;&#038;. \/etc\/sysconfig\/network<\/p>\n<p>  # Replace the following environment variables for your system<br \/>  export PATH=:\/usr\/local\/bin:\/usr\/local\/sbin:\/usr\/bin:\/usr\/sbin:\/bin:\/sbin<\/p>\n<p>  # Check that networking is configured<br \/>  if [ &quot;${NETWORKING}&quot; = \u00abno\u00bb ]; then<br \/>   echo \u00abNetworking is not configured.\u00bb<br \/>   exit 1<br \/>  fi<\/p>\n<p>  start() {<br \/>   if [! -d \/root\/.ssh ]; then<br \/>   mkdir -p \/root\/.ssh<br \/>   chmod 700 \/root\/.ssh<br \/>   fi<br \/>   # Retrieve public key from metadata server using HTTP<br \/>   curl -f <a href=\"http:\/\/169.254.169.254\/latest\/meta-data\/public-keys\/0\/openssh-key\">169.254.169.254\/latest\/meta-data\/public-keys\/0\/openssh-key<\/a> &gt; \/tmp\/my-public-key<br \/>   if [ $? -eq 0 ]; then<br \/>   echo \u00abEC2: Retrieve public key from metadata server using HTTP.\u00bb <br \/>   cat \/tmp\/my-public-key &gt;&gt; \/root\/.ssh\/authorized_keys<br \/>   chmod 600 \/root\/.ssh\/authorized_keys<br \/>   rm \/tmp\/my-public-key<br \/>   fi<br \/>  }<\/p>\n<p>  stop() {<br \/>   echo \u00abNothing to do here\u00bb<br \/>  }<\/p>\n<p>  restart() {<br \/>   stop<br \/>   start<br \/>  }<\/p>\n<p>  # See how we were called.<br \/>  case &quot;$1&quot; in<br \/>   start)<br \/>   start<br \/>   ;;<br \/>   stop)<br \/>   stop<br \/>   ;;<br \/>   restart)<br \/>   restart<br \/>   ;;<br \/>   *)<br \/>   echo $\u00abUsage: $0 {start|stop|restart}\u00bb<br \/>   exit 1<br \/>  esac<\/p>\n<p>  exit $?<\/p><\/div>\n<\/div>\n<p>  \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443:  <\/p>\n<pre><code class=\"bash\">chmod +x \/mnt\/centos-image\/etc\/init.d\/ec2-get-ssh \/usr\/sbin\/chroot \/mnt\/centos-image\/ \/sbin\/chkconfig --level 34 ec2-get-ssh on <\/code><\/pre>\n<p>  \u0415\u0449\u0451 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c Selinux, \u043b\u0438\u0431\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0433\u043e. \u0418\u043d\u0430\u0447\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043a\u043b\u044e\u0447 \u043d\u0430 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u0435.<br \/>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u0442\u044c. \u041c\u044b \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u043c \u0447\u0438\u0441\u0442\u044b\u0439 CentOS, \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c ebs-\u0434\u0438\u0441\u043a \u0441 \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c ami.  <\/p>\n<pre><code class=\"bash\">umount \/mnt\/centos-image\/proc\/ umount \/mnt\/centos-image\/sys\/ umount \/mnt\/centos-image\/ <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f AMI<\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u0437 ebs-\u0434\u0438\u0441\u043a\u0430 ami, \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043d\u0430\u043f\u0448\u043e\u0442 \u0434\u0438\u0441\u043a\u0430:  <\/p>\n<pre><code class=\"bash\">aws ec2 create-snapshot --volume-id vol-0b4bd07a --description centos-snap <\/code><\/pre>\n<p>  \u0410 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c ami \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 AWS Management Console. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 EC2 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b \u00abSnapshots\u00bb, \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e centos-snap), \u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u043f\u0440\u0430\u0432\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u00abCreate Image from Snapshot\u00bb<br \/>  \u0417\u0430\u0442\u0435\u043c, \u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435, \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/4d8\/f21\/e12\/4d8f21e124f9f22e23c172ad269254ef.png\"\/><\/p>\n<p>  \u041a\u0430\u043a\u043e\u0439 Kernel ID \u0432\u044b\u0431\u0440\u0430\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"bash\">aws ec2 describe-images --owner amazon --region us-east-1 --output text | grep &quot;\\\/pv-grub-hd0.*-x86_64&quot; | awk '{print $7}' | grep aki aki-88aa75e1 aki-b4aa75dd <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b.<br \/>  \u0422\u0430\u043a\u0438\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0437, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0441 \u043b\u044e\u0431\u044b\u043c Linux-\u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u043e\u043c. \u041f\u043e \u043a\u0430\u0440\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0442\u043e\u0447\u043d\u043e Debian- (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f debootstrap \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0447\u0438\u0441\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b) \u0438 Rhel-\u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0430.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/company\/epam_systems\/blog\/169331\/\"> http:\/\/habrahabr.ru\/company\/epam_systems\/blog\/169331\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 Amazon \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0430\u043d\u0441\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 (\u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 <a href=\"https:\/\/aws.amazon.com\/amis\">AMI<\/a>). Amazon \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e, \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0437\u044b, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438, \u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u043d\u0435\u0441\u0451\u0442. \u041d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u0435\u043d \u043e\u0431\u0440\u0430\u0437 \u0447\u0438\u0441\u0442\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0442 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432. \u0422\u043e\u0433\u0434\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0445\u043e\u0434 \u2014 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u0439 AMI.<\/p>\n<p>  \u0412 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u043f\u0438\u0441\u0430\u043d <a href=\"http:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/creating-loopback-s3-linux.html\">\u0441\u043f\u043e\u0441\u043e\u0431<\/a> \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u00abinstance store-backed AMI\u00bb. \u041c\u0438\u043d\u0443\u0441 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0435\u0449\u0451 \u0438 \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u00abEBS-backed AMI\u00bb<\/p>\n<p>  \u041e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 EBS-backed AMI \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 Amazon \u0431\u0435\u0437 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432, \u043f\u043e\u0439\u0434\u0451\u0442 \u0440\u0435\u0447\u044c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-169331","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/169331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=169331"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/169331\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}