Centos上eucalyptus源代码安装(二)
http://running.iteye.com/blog/1109357 Centos上eucalyptus源代码安装(三)-镜像管理
http://running.iteye.com/blog/1109394 Centos上eucalyptus源代码安装(四)-使用Eucalyptus
http://running.iteye.com/blog/1109413 第一步,安装XEN 参见:
http://running.iteye.com/blog/1107320 第二步:准备工作 1.先安装工具安装包
- 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 perl-Convert-ASN1 perl-Crypt-OpenSSL-RSA perl-Crypt-OpenSSL-Random chkfontpath scsi-target-utils fuse-libs swig gcc
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 perl-Convert-ASN1 perl-Crypt-OpenSSL-RSA perl-Crypt-OpenSSL-Random chkfontpath scsi-target-utils fuse-libs swig gcc
2.安装vblade
- -rw-r--r-- 1 root root 11073425 05-26 09:26 groovy-1.6.5-1.noarch.rpm
- -rw-r--r-- 1 root root 140847 05-26 09:26 lzo2-2.02-3.el5.rf.x86_64.rpm
- -rw-r--r-- 1 root root 3483929 05-26 09:26 msttcorefonts-2.0-1.noarch.rpm
- -rw-r--r-- 1 root root 40741 05-26 09:26 perl-Crypt-OpenSSL-Random-0.04-1.el5.rf.x86_64.rpm
- -rw-r--r-- 1 root root 64647 05-26 09:26 perl-Crypt-OpenSSL-RSA-0.25-1.el5.rf.x86_64.rpm
- -rw-r--r-- 1 root root 23068 05-26 09:26 perl-Crypt-X509-0.32-1.el5.rf.noarch.rpm
- -rw-r--r-- 1 root root 5333387 05-26 09:26 python25-2.5.1-bashton1.x86_64.rpm
- -rw-r--r-- 1 root root 606923 05-26 09:26 python25-libs-2.5.1-bashton1.x86_64.rpm
- -rw-r--r-- 1 root root 13951 05-26 09:26 vblade-14-1mdv2008.1.x86_64.rpm
- -rw-r--r-- 1 root root 69007 05-26 09:26 vtun-3.0.2-1.el5.rf.x86_64.rpm
-rw-r--r-- 1 root root 11073425 05-26 09:26 groovy-1.6.5-1.noarch.rpm
-rw-r--r-- 1 root root 140847 05-26 09:26 lzo2-2.02-3.el5.rf.x86_64.rpm
-rw-r--r-- 1 root root 3483929 05-26 09:26 msttcorefonts-2.0-1.noarch.rpm
-rw-r--r-- 1 root root 40741 05-26 09:26 perl-Crypt-OpenSSL-Random-0.04-1.el5.rf.x86_64.rpm
-rw-r--r-- 1 root root 64647 05-26 09:26 perl-Crypt-OpenSSL-RSA-0.25-1.el5.rf.x86_64.rpm
-rw-r--r-- 1 root root 23068 05-26 09:26 perl-Crypt-X509-0.32-1.el5.rf.noarch.rpm
-rw-r--r-- 1 root root 5333387 05-26 09:26 python25-2.5.1-bashton1.x86_64.rpm
-rw-r--r-- 1 root root 606923 05-26 09:26 python25-libs-2.5.1-bashton1.x86_64.rpm
-rw-r--r-- 1 root root 13951 05-26 09:26 vblade-14-1mdv2008.1.x86_64.rpm
-rw-r--r-- 1 root root 69007 05-26 09:26 vtun-3.0.2-1.el5.rf.x86_64.rpm
安装以上rpm包
- find -name "*.rpm" | xargs rpm -ivh;
find -name "*.rpm" | xargs rpm -ivh;
第三步、安装eucalyptus源码 1.下载 eucalyptus-2.0.3-src.tar.gz和eucalyptus-2.0.3-src-deps.tar.gz
我们这样使用的版本是2.0.3,
为了方便,先定义版本的环境变量:
export VERSION=2.0.3
- mkdir ./eucalyptus-$VERSION
- mv eucalyptus-2.0.3-src.tar.gz ./eucalyptus-$VERSION
- mv eucalyptus-2.0.3-src-deps.tar.gz ./eucalyptus-$VERSION
mkdir ./eucalyptus-$VERSION
mv eucalyptus-2.0.3-src.tar.gz ./eucalyptus-$VERSION
mv eucalyptus-2.0.3-src-deps.tar.gz ./eucalyptus-$VERSION
2.设定环境变量
- cd ./eucalyptus-$VERSION
- export EUCALYPTUS_SRC=`pwd`
- export EUCALYPTUS=/data1/eucalyptus
cd ./eucalyptus-$VERSION
export EUCALYPTUS_SRC=`pwd`
export EUCALYPTUS=/data1/eucalyptus
3.安装依赖包
- tar zvxf eucalyptus-$VERSION-src-deps.tar.gz
- mkdir -p $EUCALYPTUS/packages/
tar zvxf eucalyptus-$VERSION-src-deps.tar.gz
mkdir -p $EUCALYPTUS/packages/
1) 安装axis2
- cd $EUCALYPTUS/packages
- tar zxvf $EUCALYPTUS_SRC/eucalyptus-src-deps/axis2-1.4.tgz
cd $EUCALYPTUS/packages
tar zxvf $EUCALYPTUS_SRC/eucalyptus-src-deps/axis2-1.4.tgz
2)安装Axis2/C 导入环境变量
- export APACHE_INCLUDES=/usr/include/httpd/
- export APR_INCLUDES=/usr/include/apr-1/
- export AXIS2C_HOME=$EUCALYPTUS/packages/axis2c-1.6.0 #待安装的目标路径
export APACHE_INCLUDES=/usr/include/httpd/
export APR_INCLUDES=/usr/include/apr-1/
export AXIS2C_HOME=$EUCALYPTUS/packages/axis2c-1.6.0 #待安装的目标路径
安装
- cd $EUCALYPTUS_SRC/eucalyptus-src-deps/
- tar zvxf axis2c-src-1.6.0.tar.gz
- cd axis2c-src-1.6.0
- CFLAGS="-w" ./configure --prefix=${AXIS2C_HOME} --with-apache2=$APACHE_INCLUDES --with-apr=$APR_INCLUDES --enable-multi-thread=no
- make ; make install
cd $EUCALYPTUS_SRC/eucalyptus-src-deps/
tar zvxf axis2c-src-1.6.0.tar.gz
cd axis2c-src-1.6.0
CFLAGS="-w" ./configure --prefix=${AXIS2C_HOME} --with-apache2=$APACHE_INCLUDES --with-apr=$APR_INCLUDES --enable-multi-thread=no
make ; make install
3)安装Rampart/C
- export AXIS2C_HOME=$EUCALYPTUS/packages/axis2c-1.6.0
- export LD_LIBRARY_PATH=${AXIS2C_HOME}/lib:$LD_LIBRARY_PATH
-
- cd $EUCALYPTUS_SRC/eucalyptus-src-deps/
- tar zvxf rampartc-src-1.3.0-0euca2.tar.gz
- cd rampartc-src-1.3.0
- ./configure --prefix=${AXIS2C_HOME} --enable-static=no --with-axis2=${AXIS2C_HOME}/include/axis2-1.6.0
- make ; make install
export AXIS2C_HOME=$EUCALYPTUS/packages/axis2c-1.6.0
export LD_LIBRARY_PATH=${AXIS2C_HOME}/lib:$LD_LIBRARY_PATH
cd $EUCALYPTUS_SRC/eucalyptus-src-deps/
tar zvxf rampartc-src-1.3.0-0euca2.tar.gz
cd rampartc-src-1.3.0
./configure --prefix=${AXIS2C_HOME} --enable-static=no --with-axis2=${AXIS2C_HOME}/include/axis2-1.6.0
make ; make install
安装完毕后修改文件axis2.xml
vi $AXIS2C_HOME/axis2.xml
修改'inflow'类型下的 (
):
修改为
修改 'outflow' 类型下的:
to
4.安装编译eucalyptus
1).查看JAVA_HOME,如果没有,需要设置。
- export JAVA_HOME="/usr/lib/jvm/java-openjdk"
- export JAVA="$JAVA_HOME/jre/bin/java"
export JAVA_HOME="/usr/lib/jvm/java-openjdk"
export JAVA="$JAVA_HOME/jre/bin/java"
2).安装
- cd $EUCALYPTUS_SRC/eucalyptus-$VERSION-src-offline
- ./configure --with-axis2=$EUCALYPTUS/packages/axis2-1.4 --with-axis2c=$EUCALYPTUS/packages/axis2c-1.6.0 --enable-debug --prefix=$EUCALYPTUS
- make ; make install
cd $EUCALYPTUS_SRC/eucalyptus-$VERSION-src-offline
./configure --with-axis2=$EUCALYPTUS/packages/axis2-1.4 --with-axis2c=$EUCALYPTUS/packages/axis2c-1.6.0 --enable-debug --prefix=$EUCALYPTUS
make ; make install
到这里eucalyptus就算安装完成了
5.部署Eucalyptus
如果有多个节点(机器),可以同步$EUCALYPTUS到每一个node节点的机器上
- rsync -a $EUCALYPTUS/ root@{node-host-1}:$EUCALYPTUS/
- rsync -a $EUCALYPTUS/ root@{node-host-2}:$EUCALYPTUS/
rsync -a $EUCALYPTUS/ root@{node-host-1}:$EUCALYPTUS/
rsync -a $EUCALYPTUS/ root@{node-host-2}:$EUCALYPTUS/
注意:必须安装官网在安装说明的那些包
6.配置Hosts
a.新建用户
在每台机器上,添加用户eucalyptus,
useradd eucalyptus
b.配置hypervisor
请参考:
1)xen配置文件[b]
[b]vi /etc/xen/xend-config.sxp (注意有的机器文件夹是xend,而不是xen)
修改为如下:
- (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 '')
(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 '')
3)重启xen[b]
service xend restart;
[b]4)修改libvirt
查看当前运行的VMs
- #virsh list
- Id 名称 状态
- ----------------------------------
- 0 Domain-0 running
#virsh list
Id 名称 状态
----------------------------------
0 Domain-0 running
修改libvirt配置文件
- 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"
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"
c.配置network
详细介绍,见eucalyptus的网络模式
d.配置Eucalyptus components
在所有节点上运行如下命令:
- $EUCALYPTUS/usr/sbin/euca_conf -d $EUCALYPTUS --hypervisor xen --instances /usr/local/eucalyptus --user eucalyptus --setup
$EUCALYPTUS/usr/sbin/euca_conf -d $EUCALYPTUS --hypervisor xen --instances /usr/local/eucalyptus --user eucalyptus --setup
功能说明:
-d specifies the root of Eucalyptus installation ($EUCALYPTUS)
--hypervisor specifies the hypervisor ('xen' or 'kvm')切记在这里必须选择自己使用的虚拟化技术
--instances specifies where, on compute nodes, instance files will be stored
--user specifies the user that you created for running Eucalyptus
--setup invokes the first-time setup tasks
e. Distribution-specific post configuration steps(centos安装在这不需要修改,针对一些特殊的linux系统需要修改)
f.配置启动脚本
如果你想要在重启系统让cc、cloud、nc自动启动的话,分别在cc和nc运行相关命令:
- ln -sf $EUCALYPTUS/etc/init.d/eucalyptus-cloud /etc/init.d/eucalyptus-cloud
- ln -sf $EUCALYPTUS/etc/init.d/eucalyptus-cc /etc/init.d/eucalyptus-cc
- ln -sf $EUCALYPTUS/etc/init.d/eucalyptus-nc /etc/init.d/eucalyptus-nc
-
- chkconfig eucalyptus-cloud on
ln -sf $EUCALYPTUS/etc/init.d/eucalyptus-cloud /etc/init.d/eucalyptus-cloud
ln -sf $EUCALYPTUS/etc/init.d/eucalyptus-cc /etc/init.d/eucalyptus-cc
ln -sf $EUCALYPTUS/etc/init.d/eucalyptus-nc /etc/init.d/eucalyptus-nc
chkconfig eucalyptus-cloud on
7. 运行Eucalyptus
a.确认Eucalyptus的所有依赖都安装完毕。
所有的日志位于 $EUCALYPTUS/var/log/eucalyptus
b.仔细检查$EUCALYPTUS/etc/eucalyptus/eucalyptus.conf配置是否正确,
确定正确后执行下面的命令:
- # enable services on the front-end
- $EUCALYPTUS/usr/sbin/euca_conf -d $EUCALYPTUS –setup
- $EUCALYPTUS/usr/sbin/euca_conf -d $EUCALYPTUS --enable cloud --enable walrus --enable sc
# enable services on the front-end
$EUCALYPTUS/usr/sbin/euca_conf -d $EUCALYPTUS –setup
$EUCALYPTUS/usr/sbin/euca_conf -d $EUCALYPTUS --enable cloud --enable walrus --enable sc
c.在cc上启动eucalyptus
- # start enabled front-end services
- $EUCALYPTUS/etc/init.d/eucalyptus-cloud start
- # start the cluster controller
- $EUCALYPTUS/etc/init.d/eucalyptus-cc start
# start enabled front-end services
$EUCALYPTUS/etc/init.d/eucalyptus-cloud start
# start the cluster controller
$EUCALYPTUS/etc/init.d/eucalyptus-cc start
d.分别在ncs上启动:
- $EUCALYPTUS/etc/init.d/eucalyptus-nc start
$EUCALYPTUS/etc/init.d/eucalyptus-nc start
备注:如果要是修改了$EUCALYPTUS/etc/eucalyptus/eucalyptus.conf文件,必须重启clc和cc,而且cc必须用cleanrestart来重启。