安装
1、 同步系统时间
yum install -y ntp
ntpdate pool.ntp.org
2、 安装依赖软件包
yum install -y java-1.6.0-openjdk ant ant-nodeps dhcp bridge-utils perl-Convert-ASN1.noarch scsi-target-utils httpd
3、 安装和配置 XEN 虚拟机
yum install -y xen
sed --in-place 's/#(xend-http-server no)/(xend-http-server yes)/' /etc/xen/xend-config.sxp
sed --in-place 's/#(xend-address localhost)/(xend-address localhost)/' /etc/xen/xend-config.sxp
/etc/init.d/xend restart
4 、关闭防火墙
system-config-securitylevel-tui
service iptables stop
4、 配置 YUM 源
[euca]
name=Eucalyptus
baseurl=http://www.eucalyptussoftware.com/downloads/repo/eucalyptus/2.0.2/yum/centos/
enabled=1
gpgcheck=0
6 、前端安 装 eucalyptus 软件包
yum install -y eucalyptus-cloud.x86_64 eucalyptus-cc.x86_64 eucalyptus-walrus.x86_64 eucalyptus-sc.x86_64
7 、节点安装 eucalyptus 软件包
yum install -y eucalyptus-nc.x86_64
配置
1、 前端配置分配给VM 实例的 IP 地址段
vi /etc/eucalyptus/eucalyptus.conf
VNET_MODE="MANAGED-NOVLAN"
VNET_SUBNET="192.168.10.0"
VNET_NETMASK="255.255.255.0"
VNET_DNS="202.96.134.133"
VNET_ADDRSPERNET="32"
VNET_PUBLICIPS="192.168.10.10-192.168.10.20"
2、 前端节点开启DHCP 服务
vi /etc/dhcpd.conf
range dynamic-bootp 192.168.165.246 192.168.165.250;
2、节点配置 br0 桥接网卡
A )vi /etc/sysconfig/network-scripts /ifcfg-eth0
DEVICE=eth0
HWADDR=00:24:1D:32:CF:D4
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.165.224
NETMASK=255.255.255.0
GATEWAY=192.168.165.1
TYPE=Ethernet
BRIDGE=br0
B) vi /etc/sysconfig/network-scripts /ifcfg-br0
DEVICE=br0
ONBOOT=yes
IPADDR=192.168.165.224
BOOTPROTO=static
NETMASK=255.255.255.0
GATEWAY=192.168.165.1
TYPE=Bridge
C)重启网络服务 br0 桥接网卡将替代 eth0 使用 IPADDR 工作
service network restart
D)修改节点配置文件
vi /etc/eucalyptus/eucalyptus.conf
VNET_BRIDGE="br0"
验证
1 、 vi /etc/libvirt/libvirtd.conf
unix_sock_group = "libvirt" => unix_sock_group = "libvirt"
unix_sock_ro_perms = "0777" => unix_sock_ro_perms = "0777"
unix_sock_rw_perms = "0770" => unix_sock_rw_perms = "0770"
auth_unix_ro = "none" => auth_unix_ro = "none"
auth_unix_rw = "none" => auth_unix_rw = "none"
2 、 vi /etc/libvirt/qemu.conf
set the field user to be: user = "eucalyptus"
3 、 su eucalyptus -c "virsh list"
启动
1 、在 frontend 上启动 CLC 以及 CC
service eucalyptus-cloud start
service eucalyptus-cc start
2 、在 node 上启动 NC
service eucalyptus-nc start
注册
a) 注册 frontend 节点
euca_conf --register-walrus 192.168.165.225 walrus 所在节点 ip
euca_conf --register-cluster cluster 192.168.165.225 IP 地址前的是自定义的 CLC 的名字
euca_conf --register-sc cluster 192.168.165.225 注册 storage control
b) 注册 node 节点
euca_conf --register-nodes 192.168.165.224 后端节点 ip
euca_conf --register-nodes 192.168.165.223 后端节点 ip
c) 验证注册是否成功
euca_conf --list-walruses
euca_conf --list-clusters
euca_conf --list-scs
euca_conf --list-nodes
访问控制端地址
https://192.168.165.225:8443
安装客户端工具
1、下载并设置证书
mkdir ~/.euca
chmod 700 ~/.euca
cd ~/.euca
euca_conf --get-credentials mycreds.zip
unzip mycreds.zip
3、 启动eucarc
s ource ~/.euca/eucarc
echo “ source ~/.euca/eucarc ” >> ~/.bashrc
3、配置 YUM 源
[euca2ools]
name=Euca2ools
baseurl=http://www.eucalyptussoftware.com/downloads/repo/euca2ools/1.2/yum/centos/
enabled=1
gpgcheck=0
4、安装 euca2tools 工具
yum install -y euca2ools*
5、验证是否安装成功
euca-describe-availability-zones verbose
上传镜像文件
1) 解压镜像文件
tar zxvf euca-ubuntu-9.04-x86_64.tar.gz
2) 绑定 kernel
euca-bundle-image -i euca-ubuntu-9.04-x86_64/kvm-kernel/vmlinuz-2.6.28-11-generic --kernel true
euca-upload-bundle -b ubuntu-kernel-bucket -m /tmp/vmlinuz-2.6.28-11-generic.manifest.xml
euca-register ubuntu-kernel-bucket/vmlinuz-2.6.28-11-generic.manifest.xml
3) 绑定 ramdisk
euca-bundle-image -i euca-ubuntu-9.04-x86_64/kvm-kernel/initrd.img-2.6.28-11-generic --ramdisk true
euca-upload-bundle -b ubuntu-ramdisk-bucket -m /tmp/initrd.img-2.6.28-11-generic.manifest.xml
euca-register ubuntu-ramdisk-bucket/initrd.img-2.6.28-11-generic.manifest.xml
4) 绑定系统镜像
euca-bundle-image -i euca-ubuntu-9.04-x86_64/ubuntu.9-04.x86-64.img --kernel $EKI --ramdisk $ERI
euca-upload-bundle -b ubuntu-image-bucket -m /tmp/ubuntu.9-04.x86-64.img.manifest.xml
euca-register ubuntu-image-bucket/ubuntu.9-04.x86-64.img.manifest.xml
创建并运行实例
1、 创建登陆实例的SSH 密钥
touch ~/.euca/mykey.priv
chmod 0600 ~/.euca/mykey.priv
euca-add-keypair mykey > ~/.euca/mykey.priv
2、 授权允许22 端口访问实例
euca-add-group – d “ mygroup description ” mygroup
euca-authorize default – P tcp -p 22 - s 0.0.0.0/0
euca-describe-groups
3、创建实例
euca-run-instances emi-99D61388 -k centos -t c1.medium
4、登陆实例
ssh -i ~/.euca/mykey.priv [email protected]
5、 常用命令
euca-describe-instance s 列出实例的状态
euca-describe-keypairs 列出可用的密钥
euca-run-instances 创建并允许实例
euca-terminate-instances 停止并删除实例
euca-reboot-instances 重新启动实例