Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1677987
  • 博文数量: 391
  • 博客积分: 8464
  • 博客等级: 中将
  • 技术积分: 4589
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-13 15:12
个人简介

狮子的雄心,骆驼的耐力,孩子的执著!

文章分类

全部博文(391)

文章存档

2023年(4)

2018年(9)

2017年(13)

2016年(18)

2014年(7)

2013年(29)

2012年(61)

2011年(49)

2010年(84)

2009年(95)

2008年(22)

分类: 云计算

2012-09-08 13:17:51

Cloud.com(  前身是VMOps)  提供了开源版本(GPL v3  许可证)  的CloudStack  基础设施管理产品:CloudStack Community Edition(CloudStack  社区版)  。CloudStack  同时支持VMware ESX  、Xen  、KVM  以及Hyper-V  。它提供了大量云计算界面管理工具,如VM  自助式供应,动态工作负荷管理,多租期等等。它同时还支持 Windows Linux  的来宾访问方式。更多信息请访问

安装:

安装服务端

CentOS5.5 192.168.1.201

一、     构建基本环境

.安装JDK,Tomcat,Mysql , 需要设置JAVA_HOME  、TOMCAT_HOME

JDK :jdk1.6.0_33

Tomcat: 6.0.20

Mysql : 5.5.20

MySQL-client-5.5.20-1.linux2.6.x86_64.rpm  MySQL-server-5.5.20-1.linux2.6.x86_64.rpm
MySQL-devel-5.5.20-1.linux2.6.x86_64.rpm   MySQL-shared-5.5.20-1.linux2.6.x86_64.rpm

、     下载源码

选择最新版本

三、Centos环境下MySQL-python安装过程

1. 下载 MySQL-python-1.2.3.tar.gz
    地址 

2. 安装 MySQl-python
    tar xvf MySQL-python-1.2.3.tar.gz
    cd MySQL-python-1.2.3
    vi site.cfg
    把 mysql_config = /usr/local/mysql/bin/mysql_config 这一行前的#去掉,并且把mysql_config的路径设置正确。
    python setup.py build
    运行上面的命令报错如下:

 [root@localhost MySQL-python-1.2.3]# python setup.py  install
Traceback (most recent call last):
  File "setup.py", line 5, in ?
    from setuptools import setup, Extension
ImportError: No module named setuptools

解决方法:

wget
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py build
python setup.py install

继续安装:

python setup.py build
python setup.py install

运行测试:

 [root@localhost MySQL-python-1.2.3]# python
Python 2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/usr/lib64/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-x86_64.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/lib64/python2.4/site-packages/MySQL_python-1.2.3-py2.4-linux-x86_64.egg/_mysql.pyc, but /opt/python/MySQL-python-1.2.3 is being added to sys.path
>>>

报出一大堆警告信息,解决办法:删除MySQL-python源目录,再测试一下:

 [root@localhost python]# python
Python 2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
>>>

Mysql模块终于正常了!

本段落出自 “运维笔记” 博客,请务必保留此出处http://lihuipeng.blog.51cto.com/3064864/887967

四、管理端 编译安装CloudStack

以最新版本

为例

# cd /root/

# tar –zxvf cloudstack-oss-3.0.5.tar.gz

# cd cd /root/cloudstack-oss-3.0.5

# ./waf configure --prefix=/usr/local/cloudstack

# ./waf build

# ./waf install

4.1安装数据库

# cd /opt/cloudstack/bin/

# ./cloud-setup-databases cloud:citrix@localhost --deploy-as=root

(这里假定Mysql中已经建立用户cloud同时设置密码为citrix,并且 root 账号没有密码,否则使用

./cloud-setup-databases cloud:citrix@localhost --deploy-as=root:password

  1. Mysql user name:cloud [ OK ]
  2. Mysql user password:citrix [ OK ]
  3. Mysql server ip:localhost [ OK ]
  4. Mysql server port:3306 [ OK ]
  5. Mysql root user name:root [ OK ]
  6. Mysql root user password: [ OK ]
  7. Checking Cloud database files ... [ OK ]
  8. Checking local machine hostname ... [ OK ]
  9. Checking SELinux setup ... [ OK ]
  10. Detected local IP address as 192.168.16.5, will use as cluster management server node IP[ OK ]
  11. Preparing /opt/cloudstack/etc/cloud/management/db.properties [ OK ]
  12. Applying /opt/cloudstack/share/cloud/setup/create-database.sql [ OK ]
  13. Applying /opt/cloudstack/share/cloud/setup/create-schema.sql [ OK ]
  14. Applying /opt/cloudstack/share/cloud/setup/create-database-premium.sql [ OK ]
  15. Applying /opt/cloudstack/share/cloud/setup/create-schema-premium.sql [ OK ]
  16. Applying /opt/cloudstack/share/cloud/setup/server-setup.sql [ OK ]
  17. Applying /opt/cloudstack/share/cloud/setup/templates.sql [ OK ]
  18. Applying /opt/cloudstack/share/cloud/setup/create-index-fk.sql [ OK ]
  19. Processing encryption ... [ OK ]
  20. Finalizing setup ... [ OK ]

  21. CloudStack has successfully initialized database, you can check your database configuration in /opt/cloudstack/etc/cloud/management/db.properties
4.3 配置服务端

  1. [root@cloudstack python2.4]# /opt/cloudstack/bin/cloud-setup-management
  2. Traceback (most recent call last):
  3. File "/opt/cloudstack/bin/cloud-setup-management", line 2, in ?
  4. from cloudutils.syscfg import sysConfigFactory
  5. ImportError: No module named cloudutils.syscfg
出现上面的错误是因为cloudstack中的自定义python库函数,没有导入系统python的lib库目录中,执行如下操作中的某一个皆可:

  1. [root@cloudstack lib]# cp -rpf /usr/local/src/cloudstack-oss-3.0.5/python/lib/* /usr/lib64/python2.4/   #拷贝源码目录内的库函数
或者

  1. cp -rpf /usr/local/cloudstack/lib/python2.4/site-packages/* /usr/lib64/python2.4/
  2. #拷贝目标安装目录内的python库函数
重新配置cloudstack 服务端环境:

  1. [root@demo site-packages]# /opt/cloudstack/bin/cloud-setup-management
  2. Starting to configure CloudStack Management Server:
  3. DEBUG:root:execute:hostname -f
  4. Configure sudoers ... [OK]
  5. Configure Firewall ... DEBUG:root:execute:iptables-save|grep INPUT|grep -w 8080
  6. DEBUG:root:execute:iptables-save|grep INPUT|grep -w 7080
  7. DEBUG:root:execute:iptables-save|grep INPUT|grep -w 8250
  8. DEBUG:root:execute:iptables-save|grep INPUT|grep -w 9090
  9. DEBUG:root:execute:iptables-save > /etc/sysconfig/iptables
  10. DEBUG:root:execute:service iptables status
  11. DEBUG:root:execute:service iptables status
  12. DEBUG:root:execute:service iptables start
  13. [OK]
  14. Configure CloudStack Management Server ...DEBUG:root:execute:rm -f /etc/cloud/management/server.xml
  15. DEBUG:root:execute:rm -f /etc/cloud/management/tomcat6.conf
  16. DEBUG:root:execute:ln -s /etc/cloud/management/server-nonssl.xml /etc/cloud/management/server.xml
  17. DEBUG:root:execute:ln -s /etc/cloud/management/tomcat6-nonssl.conf /etc/cloud/management/tomcat6.conf
  18. DEBUG:root:execute:hostname --fqdn
  19. DEBUG:root:execute:mkdir /var/log/cloud-management/
  20. DEBUG:root:Failed to execute:mkdir: cannot create directory `/var/log/cloud-management/': File exists
  21. DEBUG:root:execute:service tomcat6 status
  22. DEBUG:root:execute:service tomcat6 stop
  23. DEBUG:root:execute:chkconfig --del tomcat6
  24. DEBUG:root:execute:service cloud-management status
  25. DEBUG:root:Failed to execute:cloud-management is stopped
  26. The pid file locates at /var/run/cloud-management.pid and lock file at /var/lock/subsys/cloud-management.
  27. Starting cloud-management will take care of them or you can manually clean up.
  28. DEBUG:root:execute:chkconfig --level 2345 cloud-management on
  29. DEBUG:root:execute:service cloud-management status
  30. DEBUG:root:Failed to execute:cloud-management is stopped
  31. The pid file locates at /var/run/cloud-management.pid and lock file at /var/lock/subsys/cloud-management.
  32. Starting cloud-management will take care of them or you can manually clean up.
  33. DEBUG:root:execute:service cloud-management start
  34. [OK]
  35. CloudStack Management Server setup is Done!
4. 3     启动服务端

# cd /root/cloudstack-oss-3.0.5

# ./waf run

如果启动过程中,日志出现如下错误

  1. SEVERE: StandardWrapper.Throwable
  2. java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
  3. .....
  4. .....
  5. EVERE: Allocate exception for servlet apiServlet
    com.cloud.utils.exception.CloudRuntimeException: ApiServer not initialized
编辑项目classpath配置文件: /usr/local/cloudstack/etc/cloud/management/classpath.conf
修改相关jar包的路径,或者依据文件中的jar包名称,拷贝tomcat6/lib/以及cloudstack-oss-3.0.5/deps/awsapi-lib/目录中相关的jar包文件到配置文件指定的路径中。

4.4 访问   可以看到界面,

默认用户名: admin  ,密码: password

登陆后出现安装向导页面

可以选择跳过向导安装,直接进入控制台页面


五、安装客户端:

CentOS 192.168.1.209

5.1      安装KVM

查看CPU  是否支持vm

# grep    vmx /proc/cpuinfo

如果支持,可以在输出中找到  vmx

如:

flags              : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx rdtscp lm constant_tsc ida nonstop_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 sse4_2 popcnt lahf_lm

Shell代码  收藏代码
  1. # 确定已在BIOS中打开CPU的VT支持,如果你的CPU是intel的话  
  2.   
  3. # yum install kvm  
  4.   
  5. # yum install virt-manager libvirt libvirt-python python-virtinst  
  6.   
  7. # modprobe kvm  
  8.   
  9. # modprobe kvm-intel  
 

 

5.2     编译安装

同安装服务端

安装完成后

# cd /usr/local/cloudstack/etc/cloud/agent

编辑agent.properties ,根据实际情况进行修改

# cd /usr/local/cloudstack/libexec

# ./agent-runner

配置成功后可以使用指定的系统模板来创建虚拟机,cloudstack 将完成创建虚拟路由、分配IP 、创建虚拟机的功能,完成后可以在界面上直接进入终端

阅读(2096) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~