eucalyptus 安装使用 笔记

 

 

 1Installing Eucalyptus EE on RHEL/CentOS 5.4

       Prerequisites

       1)If you start with a standard CentOS installation, you will satisfy all prerequisites with the following steps:

       [root@clc]# yum install -y ntp

       [root@clc]# ntpdate pool.ntp.org

       2)Node has a fully installed and configured installation of Xen that allows controlling the hypervisor via HTTP from localhost.

            ([root@node1]# yum install xen kernel-xen libvirt)

       [root@node]# yum install -y xen

       [root@node]# sed --in-place 's/#(xend-http-server no)/(xend-http-server yes)/' /etc/xen/xend-config.sxp

       [root@node]# sed --in-place 's/#(xend-address localhost)/(xend-address localhost)/' /etc/xen/xend-config.sxp

       [root@node]# /etc/init.d/xend restart

1.1 get packages

http://www.eucalyptussoftware.com/downloads/products/eee/2.0/

 tar zxvf eucalyptus-centos-x86_64-2.0.1eee.tar.gz

 tar zxvf eucalyptus-deps-centos-x86_64-2.0.1eee.tar.gz

   

1.2 installing OS dependencies

yum install -y java-1.6.0-openjdk-devel ant ant-nodeps libvirt-devel curl-devel httpd httpd-devel apr-devel openssl-devel dhcp libxml2 libxml2-devel gnutls gnutls-devel xen-devel libgcrypt-devel zlib-devel mysql openldap-clients perl-Convert-ASN1 chkfontpath scsi-target-utils fuse-libs libgcc.i386 bridge-utils

      

1.3 installing eucalyptus dependencies

install sun jdk:

Go!to: http://java.sun.com/javase/downloads/index.jsp and select Java Platform JDK.

In the dropadown menu!under "Platform:" select either Linux (for i386) or Linux x64(for x86_64).

[root@clc]# chmod 0700 jdk*.bin

[root@clc]# ./jdk*.bin

 

move all file in jdk1.6.0_20 to opt/packages/jdk

[root@clc]#mkdir -p /opt/packages/jdk

[root@clc]# mv jdk1.6.0_20/* /opt/packages/jdk/

 

 

[root@clc]#cd eucalyptus-deps*

[root@clc]#yum install -y *.rpm --nogpgcheck

 

[root@node1]#cd eucalyptus-deps*

[root@node1]#yum install -y *.rpm --nogpgcheck      

 

install VMware failed:

[root@localhost vmware-vix-disklib-distrib]# ./vmware-install.pl

You cannot install VMware VIX DiskLib API on a system running a xen

kernel.Execution aborted.

                    

1.4 Installing Eucalyptus Component Packages

1)install at front-end

cd eucalyptus-centos-*.leee

[root@clc]# rpm -Uvh eucalyptus-2.0.1eee-1.*.x86_64.rpm eucalyptus-common-java-2.0.1eee-1.*.x86_64.rpm eucalyptus-cloud-2.0.1eee-1.*.x86_64.rpm  eucalyptus-walrus-2.0.1eee-1.*.x86_64.rpm  eucalyptus-sc-2.0.1eee-1.*.x86_64.rpm eucalyptus-cc-2.0.1eee-1.*.x86_64.rpm eucalyptus-gl-2.0.1eee-1.*.x86_64.rpm

 

2)install at node

cd eucalyptus-centos-*.leee

[root@node1]# rpm -Uvh eucalyptus-2.0.1eee-1.*.x86_64.rpm eucalyptus-nc-2.0.1eee-1.*.x86_64.rpm eucalyptus-gl-2.0.1eee-1.*.x86_64.rpm

 

1.5 Installing and Configuring Hypervisors(Xen)

1)configuring grub and reboot

 vi /etc/grub.conf

default=0

timeout=5

splashimage=(hd0,0)/grub/splash.xpm.gz

hiddenmenu

title CentOS (2.6.18-194.17.4.el5xen)

        root (hd0,0)

        kernel /xen.gz-2.6.18-194.17.4.el5

        module /vmlinuz-2.6.18-194.17.4.el5xen ro root=LABEL=/1 rhgb quiet

        module /initrd-2.6.18-194.17.4.el5xen.img

title CentOS (2.6.18-164.el5)

        root (hd0,0)

        kernel /vmlinuz-2.6.18-164.el5 ro root=LABEL=/1 rhgb quiet

        initrd /initrd-2.6.18-164.el5.img

       notedefault=00代表内核为xentitle

 

2)配置xen

make sure that your xend-config.sxp file is setup correctly. Go to:

/etc/xen/xend-config.sxp

 

These are the recommended settings:(粗体是需要修改的,其他未默认)

 

(xend-http-server yes)

(xend-unix-server yes)

(xend-unix-path /var/lib/xend/xend-socket)

(xend-address localhost)

(network-script network-bridge)

(vif-script vif-bridge)

(dom0-min-mem 196)

(dom0-cpus 0)

(vncpasswd '')

 

2)Configuring ibvirt

vi /etc/libvirt/libvirtd.conf

 

unix_sock_group = “libvirt”

unix_sock_ro_perms = “0777”

unix_sock_rw_perms = “0770”

 

[root@node1]# /etc/init.d/libvirtd start

 

 

1.6 start

1)Startup your Eucalyptus services. On the front end, enter

[root@clc]# /etc/init.d/eucalyptus-cloud start

[root@clc]# /etc/init.d/eucalyptus-cc start

 

 

2)On!the!node machine, start!the node controller:

[root@node1]# /etc/init.d/eucalyptus-nc start

 

 

节点启动失败信息:

[root@localhost ~]# /etc/init.d/eucalyptus-nc start                                           

You should have at least 32 loop devices                                                        

Starting Eucalyptus services:                                                                         

Node Controller cannot be started: errors in //var/log/eucalyptus/euca_test_nc.log

 

节点启动错误日志:

dom0-min-mem=256

libvir: Xen Daemon error : internal error failed to connect to xend

libvir: Xen Daemon error : unable to connect to 'localhost:8000': Connection refused

libvirt error: unable to connect to 'localhost:8000': Connection refused (code=38)

error: failed to connect to hypervisor

 

查看节点相关信息:(已解决 需要修改grub,并重启,参照1.5 installing and configuring Hypervisors

[root@localhost ~]# su eucalyptus -c "virsh list"

 Id Name                 State                           

----------------------------------                              

 

[root@localhost ~]# brctl show                                       

bridge name     bridge id               STP enabled     interfaces

virbr0          8000.000000000000       yes                         

[root@localhost ~]# /etc/xen/scripts/network-bridge start  

 

Link veth0 is missing.                                                                           

This may be because you have reached the limit of the number of interfaces

that the loopback driver supports.  If the loopback driver is a module, you

may raise this limit by passing it as a parameter (nloopbacks=<N>); if the

driver is compiled statically into the kernel, then you may set the parameter

using loopback.nloopbacks=<N> on the domain 0 kernel command line.

 

启动front-endnode时,可能出现如下错误:

You should have at least 32 loop devices

Starting Eucalyptus services: (13)Permission denied: make_sock: could not bind to address [::]:8775

(13)Permission denied: make_sock: could not bind to address 0.0.0.0:8775

no listening sockets available, shutting down

Unable to open logs

解决方法:通过vnc登录到centos的图形界面设置如下,

System > Administration > Security Level and Firewall

Both Firewall and SElinux set to Disabled.

 

(运行 system-config-securitylevel 命令也可实现)

 

 

 

 

 

 

 

 

 

 

 

 

1Registering Eucalyptus EE components

[root@localhost ~]# euca_conf --register-walrus 192.168.18.201

[root@localhost ~]# euca_conf --register-cluster cloudServer 192.168.18.201

[root@localhost ~]# euca_conf --register-sc cloudServer 192.168.18.201

[root@localhost ~]# euca_conf --register-nodes 192.168.18.202

 

 

 

2deregistering nodes

 

euca_conf --deregister-nodes 192.168.18.202

 

 

 

 

 

 

 

 

企业版不用单独安装Euca2ools

 

1、下载证书并安装客户机

 

[root@localhost credentials]# mkdir ~/.euca

[root@localhost credentials]# unzip euca2-guopeng-x509.zip -d ~/.euca/

[root@localhost credentials]# cd ~/.euca/

[root@localhost .euca]# chmod 755 eucarc

[root@localhost .euca]# ./eucarc

 

2、设置环境变量

 

[root@localhost .euca]# euca-describe-images

EC2_ACCESS_KEY environment variable must be set.

Connection failed

[root@localhost .euca]# source ~/.euca/eucarc

(note source = .)

 

 

 

 

 

 

 

 

1prepare images

eg. download from http://open.eucalyptus.com/wiki/EucalyptusUserImageCreatorGuide_v2.0

 

2bundle  kernel

euca-bundle-image [-d] [-c] –i

-i              Name of the image file to bundle.

-d  Destination directory for bundled image (default directory is /tmp).

-c         Path to user’s PEM encoded certificate.

-k         Path to user’s PEM encoded private key.

 

[root@localhost images]# cd euca-ubuntu-9.04-x86_64

[root@localhost euca-ubuntu-9.04-x86_64]# euca-bundle-image -i kvm-kernel/vmlinuz-2.6.28-11-generic --kernel true

Checking image

Tarring image

Encrypting image

Splitting image...

Part: vmlinuz-2.6.28-11-generic.part.0

Generating manifest /tmp/vmlinuz-2.6.28-11-generic.manifest.xml

/tmp/vmlinuz-2.6.28-11-generic.manifest.xml

 

3uploading kernel

euca-upload-bundle –b bucket –m manifest_path

-b         Name of the bucket to upload to. (The bucket i created if it does not yet exist, but in all cases a bucket name must be specified).

-m         Path to manifest file for the bundled image.

 

[root@localhost euca-ubuntu-9.04-x86_64]# euca-upload-bundle -b ubuntu-kernel-bucket -m /tmp/vmlinuz-2.6.28-11-generic.manifest.xml

Checking bucket: ubuntu-kernel-bucket

Creating bucket: ubuntu-kernel-bucket

Uploading manifest file

Uploading part: vmlinuz-2.6.28-11-generic.part.0

Uploaded image as ubuntu-kernel-bucket/vmlinuz-2.6.28-11-generic.manifest.xml

 

4registering kernel

euca-register image_location

image location   Path to the uploaded image (bucket/manifest)

 

[root@localhost euca-ubuntu-9.04-x86_64]# euca-register ubuntu-kernel-bucket/vmlinuz-2.6.28-11-generic.manifest.xml

IMAGE   eki-AEBB17DB

 

5uploading and registering ramdisk Non-essential

 

[root@localhost euca-ubuntu-9.04-x86_64]# euca-bundle-image -i kvm-kernel/initrd.img-2.6.28-11-generic --ramdisk true

[root@localhost euca-ubuntu-9.04-x86_64]# euca-upload-bundle -b ubuntu-ramdisk-bucket -m /tmp/initrd.img-2.6.28-11-generic.manifest.xml

[root@localhost euca-ubuntu-9.04-x86_64]# euca-register ubuntu-ramdisk-bucket/initrd.img-2.6.28-11-generic.manifest.xml

IMAGE   eri-17771939

 

5uploading and registering image

 

[root@localhost euca-ubuntu-9.04-x86_64]# euca-bundle-image -i ubuntu.9-04.x86-64.img --kernel eki-AEBB17DB --ramdisk eri-17771939                            (可以不指明ramdisk

Checking image

Tarring image

Encrypting image

Splitting image...

Part: ubuntu.9-04.x86-64.img.part.0

Part: ubuntu.9-04.x86-64.img.part.1

Part: ubuntu.9-04.x86-64.img.part.2

Part: ubuntu.9-04.x86-64.img.part.3

Part: ubuntu.9-04.x86-64.img.part.4

Part: ubuntu.9-04.x86-64.img.part.5

Part: ubuntu.9-04.x86-64.img.part.6

Part: ubuntu.9-04.x86-64.img.part.7

Part: ubuntu.9-04.x86-64.img.part.8

Part: ubuntu.9-04.x86-64.img.part.9

Part: ubuntu.9-04.x86-64.img.part.10

Part: ubuntu.9-04.x86-64.img.part.11

Part: ubuntu.9-04.x86-64.img.part.12

Part: ubuntu.9-04.x86-64.img.part.13

Generating manifest /tmp/ubuntu.9-04.x86-64.img.manifest.xml

/tmp/ubuntu.9-04.x86-64.img.manifest.xml

 

[root@localhost euca-ubuntu-9.04-x86_64]# euca-upload-bundle -b ubuntu-image-bucket -m /tmp/ubuntu.9-04.x86-64.img.manifest.xml

Checking bucket: ubuntu-image-bucket

Creating bucket: ubuntu-image-bucket

Uploading manifest file

Uploading part: ubuntu.9-04.x86-64.img.part.0

Uploading part: ubuntu.9-04.x86-64.img.part.1

Uploading part: ubuntu.9-04.x86-64.img.part.2

Uploading part: ubuntu.9-04.x86-64.img.part.3

Uploading part: ubuntu.9-04.x86-64.img.part.4

Uploading part: ubuntu.9-04.x86-64.img.part.5

Uploading part: ubuntu.9-04.x86-64.img.part.6

Uploading part: ubuntu.9-04.x86-64.img.part.7

Uploading part: ubuntu.9-04.x86-64.img.part.8

Uploading part: ubuntu.9-04.x86-64.img.part.9

Uploading part: ubuntu.9-04.x86-64.img.part.10

Uploading part: ubuntu.9-04.x86-64.img.part.11

Uploading part: ubuntu.9-04.x86-64.img.part.12

Uploading part: ubuntu.9-04.x86-64.img.part.13

Uploaded image as ubuntu-image-bucket/ubuntu.9-04.x86-64.img.manifest.xml

 

 

[root@localhost euca-ubuntu-9.04-x86_64]# euca-register ubuntu-image-bucket/ubuntu.9-04.x86-64.img.manifest.xml

IMAGE   emi-39DB160A

 

 

6delete image and bundle

1delete image

[root@localhost xen-kernel]# euca-deregister emi-39DB160A

EC2_ACCESS_KEY environment variable must be set.

Connection failed

[root@localhost xen-kernel]# source ~/.euca/eucarc

[root@localhost xen-kernel]# euca-deregister emi-39DB160A

IMAGE   emi-39DB160A

[root@localhost xen-kernel]# euca-delete-bundle -b ubuntu-image-bucket -p ubuntu.9-04.x86-64.img --clear

 

 

2delete ramdisk bundle

 

[root@localhost xen-kernel]# euca-deregister eki-17771939

IMAGE   eki-17771939

[root@localhost xen-kernel]# euca-delete-bundle -b ubuntu-ramdisk-bucket

 

3delete kernel bundle

 

[root@localhost xen-kernel]# euca-deregister eki-AEBB17DB

IMAGE   eki-AEBB17DB

[root@localhost xen-kernel]# euca-delete-bundle -b ubuntu-kernel-bucket

 

[root@localhost euca-ubuntu-9.04-x86_64]# euca-describe-images

(需要运行此命令后,web界面的imagesbundles才消失)

 

 

 

 

 

1、add key before run a VM instance

 

[root@localhost euca-ubuntu-9.04-x86_64]# euca-add-keypair mykey > mykey.private

[root@localhost ~]# chmod 0600 mykey.private

 

2、 run instance

 

euca-run-instances [-k] [-n] image id

image id     Identifier of the image to run.

 

-k         Name of keypair to associate with instance.

-n         Number of instances to run.

 

[root@localhost euca-ubuntu-9.04-x86_64]# euca-run-instances -k mykey emi-39C21609

RESERVATION     r-42BA079F      guopeng guopeng-default

INSTANCE        i-30B50604      emi-39C21609    0.0.0.0 0.0.0.0 pending mykey202010-10-29T03:11:02.237Z eki-942116FE    None

[root@localhost euca-ubuntu-9.04-x86_64]# euca-describe-instances

RESERVATION     r-42BA079F      guopeng default

INSTANCE        i-30B50604      emi-39C21609    0.0.0.0 0.0.0.0 pending        mykey         0       m1.small        2010-10-29T03:11:02.237Z        cloudServer     eki-942116FE

 

euca-run-instances -k mykey202 emi-39C21609

 

   Run instance error log(nc.log):

Fri Oct 29 16:21:19 2010][006207][EUCADEBUG ] doDescribeResource() invoked

[Fri Oct 29 16:21:19 2010][006207][EUCADEBUG ] doDescribeInstances() invoked

[Fri Oct 29 16:21:19 2010][006207][EUCADEBUG ] doDescribeInstances(): instanceId=i-417506F8 publicIp=0.0.0.0 privateIp=0.0.0.0 mac=d0:0d:41:75:06:F8 vlan=-1 networkIndex=-1 platform=linux

[Fri Oct 29 16:21:20 2010][006207][EUCADEBUG ] system_output(): [//usr/lib/eucalyptus/euca_rootwrap //usr/share/eucalyptus/gen_libvirt_xml --kernel --ephemeral]

[Fri Oct 29 16:21:20 2010][006207][EUCAINFO  ] currently running/booting:  i-417506F8

[Fri Oct 29 16:21:21 2010][006207][EUCAINFO  ] booting VM instance i-417506F8

[Fri Oct 29 16:21:21 2010][006207][EUCADEBUG ] state change for instance i-417506F8: Staging -> Booting (Pending)

[Fri Oct 29 16:21:22 2010][006207][EUCAERROR ] libvirt: cannot read directory /etc/xen: Permission denied (code=38)

[Fri Oct 29 16:21:22 2010][006207][EUCAERROR ] libvirt: Domain not found: xenUnifiedDomainLookupByName (code=42)

[Fri Oct 29 16:21:25 2010][006207][EUCADEBUG ] doDescribeResource() invoked

[Fri Oct 29 16:21:25 2010][006207][EUCADEBUG ] doDescribeInstances() invoked

[Fri Oct 29 16:21:25 2010][006207][EUCADEBUG ] doDescribeInstances(): instanceId=i-417506F8 publicIp=0.0.0.0 privateIp=0.0.0.0 mac=d0:0d:41:75:06:F8 vlan=-1 networkIndex=-1 platform=linux

[Fri Oct 29 16:21:27 2010][006207][EUCAERROR ] libvirt: Domain not found: xenUnifiedDomainLookupByName (code=42)

[Fri Oct 29 16:21:31 2010][006207][EUCADEBUG ] doDescribeResource() invoked

[Fri Oct 29 16:21:31 2010][006207][EUCADEBUG ] doDescribeInstances() invoked

[Fri Oct 29 16:21:31 2010][006207][EUCADEBUG ] doDescribeInstances(): instanceId=i-417506F8 publicIp=0.0.0.0 privateIp=0.0.0.0 mac=d0:0d:41:75:06:F8 vlan=-1 networkIndex=-1 platform=linux

[Fri Oct 29 16:21:32 2010][006207][EUCAERROR ] libvirt: cannot read directory /etc/xen: Permission denied (code=38)

[Fri Oct 29 16:21:32 2010][006207][EUCAERROR ] libvirt: Domain not found: xenUnifiedDomainLookupByName (code=42)

 

  

 

 

 

 

 

 

 

你可能感兴趣的:(centos,image,delete,xen,2010,credentials)