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
)
- Mysql user name:cloud [ OK ]
- Mysql user password:citrix [ OK ]
- Mysql server ip:localhost [ OK ]
- Mysql server port:3306 [ OK ]
- Mysql root user name:root [ OK ]
- Mysql root user password: [ OK ]
- Checking Cloud database files ... [ OK ]
- Checking local machine hostname ... [ OK ]
- Checking SELinux setup ... [ OK ]
- Detected local IP address as 192.168.16.5, will use as cluster management server node IP[ OK ]
- Preparing /opt/cloudstack/etc/cloud/management/db.properties [ OK ]
- Applying /opt/cloudstack/share/cloud/setup/create-database.sql [ OK ]
- Applying /opt/cloudstack/share/cloud/setup/create-schema.sql [ OK ]
- Applying /opt/cloudstack/share/cloud/setup/create-database-premium.sql [ OK ]
- Applying /opt/cloudstack/share/cloud/setup/create-schema-premium.sql [ OK ]
- Applying /opt/cloudstack/share/cloud/setup/server-setup.sql [ OK ]
- Applying /opt/cloudstack/share/cloud/setup/templates.sql [ OK ]
- Applying /opt/cloudstack/share/cloud/setup/create-index-fk.sql [ OK ]
- Processing encryption ... [ OK ]
- Finalizing setup ... [ OK ]
- CloudStack has successfully initialized database, you can check your database configuration in /opt/cloudstack/etc/cloud/management/db.properties
4.3 配置服务端
- [root@cloudstack python2.4]# /opt/cloudstack/bin/cloud-setup-management
- Traceback (most recent call last):
- File "/opt/cloudstack/bin/cloud-setup-management", line 2, in ?
- from cloudutils.syscfg import sysConfigFactory
- ImportError: No module named cloudutils.syscfg
出现上面的错误是因为cloudstack中的自定义python库函数,没有导入系统python的lib库目录中,执行如下操作中的某一个皆可:
- [root@cloudstack lib]# cp -rpf /usr/local/src/cloudstack-oss-3.0.5/python/lib/* /usr/lib64/python2.4/ #拷贝源码目录内的库函数
或者
- cp -rpf /usr/local/cloudstack/lib/python2.4/site-packages/* /usr/lib64/python2.4/
- #拷贝目标安装目录内的python库函数
重新配置cloudstack 服务端环境:
- [root@demo site-packages]# /opt/cloudstack/bin/cloud-setup-management
- Starting to configure CloudStack Management Server:
- DEBUG:root:execute:hostname -f
- Configure sudoers ... [OK]
- Configure Firewall ... DEBUG:root:execute:iptables-save|grep INPUT|grep -w 8080
- DEBUG:root:execute:iptables-save|grep INPUT|grep -w 7080
- DEBUG:root:execute:iptables-save|grep INPUT|grep -w 8250
- DEBUG:root:execute:iptables-save|grep INPUT|grep -w 9090
- DEBUG:root:execute:iptables-save > /etc/sysconfig/iptables
- DEBUG:root:execute:service iptables status
- DEBUG:root:execute:service iptables status
- DEBUG:root:execute:service iptables start
- [OK]
- Configure CloudStack Management Server ...DEBUG:root:execute:rm -f /etc/cloud/management/server.xml
- DEBUG:root:execute:rm -f /etc/cloud/management/tomcat6.conf
- DEBUG:root:execute:ln -s /etc/cloud/management/server-nonssl.xml /etc/cloud/management/server.xml
- DEBUG:root:execute:ln -s /etc/cloud/management/tomcat6-nonssl.conf /etc/cloud/management/tomcat6.conf
- DEBUG:root:execute:hostname --fqdn
- DEBUG:root:execute:mkdir /var/log/cloud-management/
- DEBUG:root:Failed to execute:mkdir: cannot create directory `/var/log/cloud-management/': File exists
- DEBUG:root:execute:service tomcat6 status
- DEBUG:root:execute:service tomcat6 stop
- DEBUG:root:execute:chkconfig --del tomcat6
- DEBUG:root:execute:service cloud-management status
- DEBUG:root:Failed to execute:cloud-management is stopped
- The pid file locates at /var/run/cloud-management.pid and lock file at /var/lock/subsys/cloud-management.
- Starting cloud-management will take care of them or you can manually clean up.
- DEBUG:root:execute:chkconfig --level 2345 cloud-management on
- DEBUG:root:execute:service cloud-management status
- DEBUG:root:Failed to execute:cloud-management is stopped
- The pid file locates at /var/run/cloud-management.pid and lock file at /var/lock/subsys/cloud-management.
- Starting cloud-management will take care of them or you can manually clean up.
- DEBUG:root:execute:service cloud-management start
- [OK]
- CloudStack Management Server setup is Done!
4. 3 启动服务端
# cd /root/cloudstack-oss-3.0.5
# ./waf run
如果启动过程中,日志出现如下错误
- SEVERE: StandardWrapper.Throwable
- java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
- .....
- .....
- 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
- # 确定已在BIOS中打开CPU的VT支持,如果你的CPU是intel的话
-
- # yum install kvm
-
- # yum install virt-manager libvirt libvirt-python python-virtinst
-
- # modprobe kvm
-
- # modprobe kvm-intel
5.2 编译安装
同安装服务端
安装完成后
# cd /usr/local/cloudstack/etc/cloud/agent
编辑agent.properties ,根据实际情况进行修改
# cd /usr/local/cloudstack/libexec
# ./agent-runner
配置成功后可以使用指定的系统模板来创建虚拟机,cloudstack 将完成创建虚拟路由、分配IP 、创建虚拟机的功能,完成后可以在界面上直接进入终端
阅读(2160) | 评论(0) | 转发(1) |