自学安装cloudstack4.2.doc_第1页
自学安装cloudstack4.2.doc_第2页
自学安装cloudstack4.2.doc_第3页
自学安装cloudstack4.2.doc_第4页
自学安装cloudstack4.2.doc_第5页
已阅读5页,还剩55页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

之前参考网上的文档安装了几次cloudstack都没成功,大概是因为安装的版本不完全一样,或是步骤没有完全作对。这次我按照官方安装指南的步骤再做一遍,虽然会省略一些步骤,不过应该没太大问题。整个安装过程,顺利的话1小时以上,合理安排时间安装cloudstack 版本4.2 软件包 apache-cloudstack-4.2.0-src.tar.bz2虚拟机使用系统centos6.3 x86_64,vmware workstation 9两台虚拟机 cloudm 为管理服务器 clouda 为代理 这两台虚拟机都由vmware workstation自动安装确保有足够硬盘空间放虚拟机参考手册 Apache_CloudStack-4.2.0-Installation_Guide-en-US.pdfApache_CloudStack-4.2.0-Admin_Guide-en-US.pdf第二十二章Cloudstack软件包和手册都可以上cloudstack官网下载先使用nat,能够连网好用yum下载,等所需软件下载完之后换成自定义网络,使管理服务器和代理连通。有些文档里面要求一开始就改hostname和ip,我感觉没必要,后面再改也行。1 安装management server前的准备1.确认对硬件的要求2. 准备编译环境3. 编译产生rpms (事后:没必要)4.配置本地yum源 (事后:没必要)二安装Management Server1.安装cloudstack-management2. 安装数据库,使用的是mysql3.准备nfs存储4.准备 System VM 模板5.总结3 安装 KVM Hypervisor Host1. 系统要求2. 准备系统3.安装agent4. 安装libvirt5.配置selinux和防火墙6.配置网桥一安装management server前的准备以下都是在cloudm上安装.1. 确认对硬件的要求4.3.1. Management Server, Database, and Storage System RequirementsOperating system:Preferred: CentOS/RHEL 6.3+ or Ubuntu 12.04(.1)64-bit x86 CPU (more cores results in better performance)4 GB of memory250 GB of local disk (more results in better capability; 500 GB recommended)At least 1 NICStatically allocated IP addressFully qualified domain name as returned by the hostname command3. 准备编译环境3.6. Building RPMs from Source所需软件1. Maven (version 3)2. Java (OpenJDK 1.6 or Java 7/OpenJDK 1.7)3. Apache Web Services Common Utilities (ws-commons-util)4. MySQL5. MySQLdb (provides Python database API)6. Tomcat 6 (not 6.0.35)7. Genisoimage8. rpmbuild or dpkg-dev用yum自动安装所需软件rootlocalhost Desktop# yum groupinstall Development ToolsLoaded plugins: fastestmirror, refresh-packagekit, securityDetermining fastest mirrors * base: * extras: * updates: Setting up Group ProcessChecking for new repos for mirrorsPackage 1:make-3.81-20.el6.x86_64 already installed and latest versionPackage patch-2.6-6.el6.x86_64 already installed and latest versionPackage 1:pkgconfig-0.23-9.1.el6.x86_64 already installed and latest versionPackage elfutils-0.152-1.el6.x86_64 already installed and latest versionResolving Dependencies- Running transaction check- Package autoconf.noarch 0:2.63-5.1.el6 will be installed.Transaction Summary=Install 43 Package(s)Upgrade 17 Package(s)Total download size: 85 MIs this ok y/N: y.warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEYRetrieving key from file:/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6Importing GPG key 0xC105B9DE: Userid : CentOS-6 Key (CentOS 6 Official Signing Key) Package: centos-release-6-3.el6.centos.9.x86_64 (anaconda-CentOS-201207061011.x86_64/6.3) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6Is this ok y/N: y.rootlocalhost Desktop# yum install java-1.6.0-openjdk-devel.x86_64 genisoimage mysql mysql-server ws-commons-util MySQL-python tomcat6 createrepoTransaction Summary=Install 12 Package(s)Upgrade 3 Package(s)Total download size: 70 MIs this ok y/N: yIs this ok y/N: y 为什么要问两次?.安装完成!官方要求的下一步Next, youll need to install build-time dependencies for CloudStack with Maven. Were using Maven 3, so youll want tograb a Maven 3 tarball and uncompress it in your home directory (or whatever location you prefer):$ tar zxvf apache-maven-3.0.4-bin.tar.gz$ export PATH=/usr/local/apache-maven-3.0.4/bin:$PATHMaven also needs to know where Java is, and expects the JAVA_HOME environment variable to be set:$ export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/Verify that Maven is installed correctly:$ mvn -version需要Maven 3这个软件,前面下载的那么多软件里面没有这个软件吗?rootlocalhost Desktop# yum list installed |grep mavenrootlocalhost Desktop# 还真没有,而且yum仓库没有提供这个软件rootlocalhost Desktop# yum install apache-mavenLoaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds from cached hostfile * base: * extras: * updates: Setting up Install ProcessNo package apache-maven available.Error: Nothing to do下载一个,尽量使用和参考手册一样的版本/docs/3.0.5/release-notes.htmlapache-maven-3.0.5-bin.tar.gz可以直接下载到虚拟机,也可以传进去rootlocalhost Desktop# cd /download/rootlocalhost download# lsapache-maven-3.0.5-bin.tar.gzrootlocalhost download# tar zxvf apache-maven-3.0.5-bin.tar.gz rootlocalhost download# export PATH=/usr/local/apache-maven-3.0.4/bin:$PATH什么意思?/m/question/4af8ef9030031e60/home.php?mod=space&uid=830496&do=blog&id=676304$PATH:决定了shell将到哪些目录中寻找命令或程序,PATH的值是一系列目录,当您运行一个程序时,Linux在这些目录下进行搜寻编译链接。添加PATH环境变量,可用:export PATH=路径:$PATH查看命令:echo $PATH, 可判断是否添加PATH成功。rootlocalhost download# exportdeclare -x PATH=/usr/local/apache-maven-3.0.4/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin.rootlocalhost download# export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/rootlocalhost download# mv apache-maven-3.0.5 /usr/local/rootlocalhost download# mvn bash: mvn: command not foundrootlocalhost download# mvn -versionbash: mvn: command not foundrootlocalhost download# ls /usr/local |grep apacheapache-maven-3.0.5找不到命令,因为前面配置的路径是apache-maven-3.0.4,要改成3.0.5rootlocalhost download# export PATH=/usr/local/apache-maven-3.0.5/bin:$PATHrootlocalhost download# exportdeclare -x PATH=/usr/local/apache-maven-3.0.5/bin:/usr/local/apache-maven-3.0.4/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin前面的 export PATH=/usr/local/apache-maven-3.0.4/bin:$PATH命令还多了一个/号?JAVA_HOME的配置有没有问题?再输入一次命令,看起来是正常的rootlocalhost download# mvn -versionApache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 05:51:28-0800)Maven home: /usr/local/apache-maven-3.0.5Java version: 1.6.0_28, vendor: Sun Microsystems Inc.Java home: /usr/lib/jvm/java-1.6.0-openjdk-.x86_64/jreDefault locale: en_US, platform encoding: UTF-8OS name: linux, version: 2.6.32-279.el6.x86_64, arch: amd64, family: unixYou probably want to ensure that your environment variables will survive a logout/reboot. Be sure to update /.bashrcwith the PATH and JAVA_HOME variables.官方手册还提醒你,以上配置的环境变量可能在登出或是重启后失效,最好改一下文件rootlocalhost download# cd rootlocalhost # vi .bashrc # .bashrc# User specific aliases and functionsalias rm=rm -ialias cp=cp -ialias mv=mv -iexport PATH=/usr/local/apache-maven-3.0.5/bin:$PATHexport JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/# Source global definitionsif -f /etc/bashrc ; then . /etc/bashrcfi这样写没问题?3. 编译产生rpms(事后:完全没必要编译.直接用官方提供的仓库就行了!之前没发现,按下面的设置可以直接yum install cloudstack-management4.4.2. RPM package repositoryThere is a RPM package repository for CloudStack so you can easily install on RHEL based platforms.If youre using an RPM-based system, youll want to add the Yum repository so that you can install CloudStack with Yum.Yum repository information is found under /etc/yum.repos.d. Youll see several .repo files in this directory, each onedenoting a specific repository.To add the CloudStack repository, create /etc/yum.repos.d/cloudstack.repo and insert the following information.cloudstackname=cloudstackbaseurl=http:/cloudstack.apt-get.eu/rhel/4.2/enabled=1gpgcheck=0Now you should be able to install CloudStack using Yum.)好像最新版本的都只提供源码包,需要自己编译3.6.1. Generating RPMSNow that we have the prerequisites and source, you will cd to the packaging/centos63/ directory.$ cd packaging/centos63没见过这个路径,看文档看漏了,回去前面,发现还要提取一下3.4. Extracting sourceExtracting the CloudStack release is relatively simple and can be done with a single command as follows:$ tar -jxvf apache-cloudstack-4.1.0.src.tar.bz2You can now move into the directory:$ cd ./apache-cloudstack-4.1.0-src图中有个问题,4.2.0的安装指南用的是4.1.0的包,不过差别不大吧tar -jxvf apache-cloudstack-4.2.0-src.tar.bz2rootlocalhost download# lsapache-cloudstack-4.2.0-src apache-maven-3.0.5-bin.tar.gzapache-cloudstack-4.2.0-src.tar.bz2man tar -j, -bzip2 filter the archive through bzip2貌似很少用到-jrootlocalhost download# cd apache-cloudstack-4.2.0-srcrootlocalhost apache-cloudstack-4.2.0-src# lsagent core NOTICE servicesagent-simulator debian packaging setupapi deps patches testawsapi developer plugins toolsawsapi-setup docs pom.xml uibuild engine python usageCHANGES framework README.md utilsclient INSTALL.md README.tools.md version-info.incloud-cli LICENSE scripts vmware-baseconfigure-info.in m2-settings.xml server找到packaging了,继续开头的那一步3.6.1. Generating RPMSNow that we have the prerequisites and source, you will cd to the packaging/centos63/ directory.$ cd packaging/centos63Generating RPMs is done using the package.sh script:$ ./package.shThat will run for a bit and then place the finished packages in dist/rpmbuild/RPMS/x86_64/.You should see the following RPMs in that directory: cloudstack-agent-4.2.0.el6.x86_64.rpm cloudstack-awsapi-4.2.0.el6.x86_64.rpm cloudstack-cli-4.2.0.el6.x86_64.rpm cloudstack-common-4.2.0.el6.x86_64.rpm cloudstack-docs-4.2.0.el6.x86_64.rpm cloudstack-management-4.2.0.el6.x86_64.rpm cloudstack-usage-4.2.0.el6.x86_64.rpm完成时应该看到以上rpm包这实际上把要用到的所有rpm包都包括了吧?感觉完全没必要,下面安装起来估计很费时间rootlocalhost apache-cloudstack-4.2.0-src# cd packaging/rootlocalhost packaging# lscentos63 debianrootlocalhost packaging# cd centos63/rootlocalhost centos63# lscloud-agent.rc cloud-management.sysconfig cloud-usage.rccloud-ipallocator.rc cloud.spec package.shcloud-management.rc cloudstack-agent.te pertiesrootlocalhost centos63# ./package.sh运行后过了一段时间都没反应然后出现了这个rootlocalhost centos63# ./package.sherror: Failed build dependencies:tomcat6 is needed by cloudstack-4.2.0-1.el6.x86_64ws-commons-util is needed by cloudstack-4.2.0-1.el6.x86_64MySQL-python is needed by cloudstack-4.2.0-1.el6.x86_64为什么会报错?前面运行这条命令时没有安装吗?rootlocalhost Desktop# yum install java-1.6.0-openjdk-devel.x86_64 genisoimage mysql mysql-server ws-commons-util MySQL-python tomcat6 createrepo再安装一次rootlocalhost centos63# yum install tomcat6 ws-commons-util MySQL-pythonLoaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds from cached hostfile * base: * extras: * updates: Setting up Install ProcessResolving Dependencies还真没装,不知道怎么回事再次rootlocalhost centos63# ./package.shExecuting(%prep): /bin/sh -e /var/tmp/rpm-tmp.noVFsk+ umask 022+ cd /download/apache-cloudstack-4.2.0-src/packaging/centos63/././dist/rpmbuild/BUILD+ LANG=C+ export LANG+ unset DISPLAY.一大堆downloading,需要等很长一段时间,好像下载了不少东西rootlocalhost centos63# cat package.sh 没看懂,shell没学好等了50分钟.还没好,而且下载到一半还卡住了!Downloading: /maven2/net/java/dev/jna/jna/3.0.9/jna-3.0.9.jar33/70 KB 然后INFO Total time: 41:03.792sINFO Finished at: Sat Jan 11 07:56:38 PST 2014INFO Final Memory: 36M/164MINFO -ERROR Failed to execute goal on project cloud-plugin-hypervisor-kvm: Could not resolve dependencies for project org.apache.cloudstack:cloud-plugin-hypervisor-kvm:jar:4.2.0: Could not transfer artifact org.libvirt:libvirt:jar:0.4.9 from/to libvirt-org (/maven2): GET request of: org/libvirt/libvirt/0.4.9/libvirt-0.4.9.jar from libvirt-org failed: Premature end of Content-Length delimited message body (expected: 70699; received: 42064 - Help 1ERROR ERROR To see the full stack trace of the errors, re-run Maven with the -e switch.ERROR Re-run Maven using the -X switch to enable full debug logging.ERROR ERROR For more information about the errors and possible solutions, please read the following articles:ERROR Help 1 /confluence/display/MAVEN/DependencyResolutionExceptionERROR ERROR After correcting the problems, you can resume the build with the commandERROR mvn -rf :cloud-plugin-hypervisor-kvmerror: Bad exit status from /var/tmp/rpm-tmp.qJ0Yn9 (%build)RPM build errors: Bad exit status from /var/tmp/rpm-tmp.qJ0Yn9 (%build)让我等了1个小时就看到这个玩意儿!还看不懂可以参考以下/s/blog_7ea3d46f0101gtdg.html的文章特别说明由于CloudStack目前是基于Maven构建,因此除了源代码和Maven的构建文件外,所有的依赖包都需要到网络下载,因此请注意以下三点: 保证源代码构建服务器的网络连通性,尤其是WiFi情况下,经常出现构建失败,可多尝试几次./package.sh碰碰运气 如果构建由于缺失依赖包导致失败,可检查Maven主仓储库是否维护了该依赖包,如果没有可以在第三方仓储库进行查找,并修改Maven的相关配置 如果构建由于缺失依赖包导致失败,而且连第三方仓储库也没有维护,那么必须到浩瀚的互联网进行Download到本地,并且手工安装到Maven主仓储库,这里以jasypt为例说明安装命令:$ mvn install:install-file -DgroupId=org.jasypt -DartifactId=jasypt -Dversion=1.8 -Dpackaging=jar -Dfile=/home/lishuyi/Download/jasypt-1.8.jar(maven官网的faq里面有详细语法)看博主shanelisy的解释还是不太懂还是看报的什么错吧。耐心看一下报错,让我访问/confluence/display/MAVEN/DependencyResolutionException,解决错误,然后再运行mvn -rf :cloud-plugin-hypervisor-kvm(事后:这个想法是错的,不用运行mvn -rf :cloud-plugin-hypervisor-kvm,直接把需要的jar放到maven仓库,然后再次运行package.sh就行了)DependencyResolutionException Skip to end of metadata Added by Benjamin Bentmann, last edited by Benjamin Bentmann on Jan 22, 2011 (view change) show commentGo to start of metadataThis error generally occurs when Maven could not download dependencies. 这个错误产生于maven无法下载依赖包。Possible causes for this error are:可能是以下原因1 The POM misses the declaration of the which hosts the artifact.不懂2 The repository you have configured requires authentication and Maven failed to provide the correct credentials to the server. In this case, make sure your $user.home/.m2/settings.xml contains a declaration whose matches the of the remote repository to use. See the Maven Settings Reference for more details.需要认证3 The remote repository in question uses SSL and the JVM running Maven does not trust the certificate of the server.远程软件仓库不信任服务器的证书4 There is a general network problem that prevents Maven from accessing any remote repository, e.g. a missing proxy configuration.网络问题5 You have configured Maven to perform strict checksum validation and the files to download got corrupted.设置了maven严格检查确认,但文件下载时出错了6 Maven failed to save the files to your local repository, see LocalRepositoryNotAccessibleException for more details.无法保存到本地Ben GidleyIn Maven 3 if you just had a failed download and have fixed it (e.g. by uploading the jar to a repository) it will cache the failure. To force a refresh add -U to the command line.ben gidley提供了一个有价值的建议,可能maven3会cache错误,最好用-U选项强制refresh一下。这个-U用在哪里?package.sh -U这样?还是mvn -U?看了以上英文,感觉就是有个软件包无法正常下载,中文页面找到的/mod_mbox/cloudstack-users-cn/201307.mbox/thread?1关于cloudstack无法编译问题 又找了一下发现比较详细的说明/safiad/item/bc95cb0f979b8dd51ff04686Safiad的空间MVN 构建项目时的一个问题-Could not resolve de pendencies for project错误的现场是下面这个样子:INFO recharge-dal . SUCCESS 0.940sINFO recharge-service . FAILURE 0.060sINFO recharge-front-web . SKIPPEDINFO -INFO BUILD FAILUREINFO -INFO Total time: 2.110sINFO Finished at: Tue Dec 04 14:57:23 CST 2012INFO Final Memory: 8M/14MINFO -ERRORFailed to execute goal on project recharge-service: Could not resolve dependencies for project com.xxxxxx:recharge-service:jar:1.0.0-SNAPSHOT: Failure to find com.xxxxxx:recharge-dal:jar:1.0.0-SNAPSHOT in http:/192.168.xxx.xxx:8081/nexus/content/groups/public/ was cached in the local repository, resolutionwill not be reattempted until the update interval of maven-net has elapsed or updates are forced- Help 1ERRORERROR To see the full stack trace of the errors, re-run Maven with the -e switch.ERROR Re-run Maven using the -X switch to enable full debug logging.ERRORERROR For more information about the errors and possible solutions, please read the following articles:ERROR Help 1 /confluence/display/MAVEN/DependencyResolutionExceptionERRORERROR After correcting the problems, you can resume the build with the commandERROR mvn -rf :recharge-service因为这个项目是三个独立项目依靠依赖关系结合在一起的recharge-front-web- recharge-service -recharge-dal。这样的话就需要在web里包含其他两jar包。从错误的意思上来说“找不到依赖的包com.xxxxxx:recharge-service:jar:1.0.0-SNAPSHOT和com.xxxxxx:recharge-dal:jar:1.0.0-SNAPSHOT之前也不知道怎么解决,然后问了前辈,在她的指点下找到了解决的方法,最终一切顺利。具体的思路是这样的:因为错误提示是找不到

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论