设为首页 收藏本站
查看: 1101|回复: 0

[Cloudstack] CloudStack学习笔记-安装AllInOne

[复制链接]

尚未签到

发表于 2015-10-13 13:36:29 | 显示全部楼层 |阅读模式
本文介绍CentOS 6.3操作系统主机安装 CloudStack 4.1.1 AllInOne的运行环境。
前置条件
Management Server, Database, and Storage System Requirements
Operating system: Preferred: CentOS/RHEL 6.3+ or Ubuntu12.04(.1)
64-bit x86 CPU (more cores results in better performance)
4 GB of memory
250 GB of local disk (more results in better capability; 500 GBrecommended)
At least 1 NIC
Statically allocated IP address
Fully qualified domain name as returned by the hostnamecommand

Host/Hypervisor System Requirements
Must support HVM (Intel-VT or AMD-V enabled).
64-bit x86 CPU (more cores results in better performance)
Hardware virtualization support required
4 GB of memory
36 GB of local disk
At least 1 NIC
When you deploy CloudStack, the hypervisor hostmust not have any VMs already running
All hosts within a cluster must be homogeneous. The CPUs must be ofthe same type, count, and feature flags.

KVM 主机需求http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.1.1/html/Installation_Guide/hypervisor-kvm-install-flow.html#hypervisor-kvm-requirements
XenServer 主机需求http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.1.1/html/Installation_Guide/citrix-xenserver-installation.html#system-requirements-xenserver-hosts
vSphere 主机需求http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.1.1/html/Installation_Guide/vmware-install.html#vmware-requirements

禁用IPv6
# service ip6tables stop
# chkconfig ip6tables off

(一)安装配置管理服务器
设置静态网络IP地址
#vim /etc/sysconfig/network-scripts/ifcfg-eth0
除物理MAC,静态IP地址、网关、掩码以外,参考如下设置
DEVICE=eth0
HWADDR=00:1F:16:34:xx:yy
ONBOOT=yes
HOTPLUG=no
BOOTPROTO=static
IPV6INIT=no
NM_CONTROLLED=no #这里不需要NetworkManager托管网络配置,将NetworkManager断开Wired Networks和Wireless Networks
TYPE=Ethernet
IPADDR=192.168.0.103
NETMASK=255.255.255.0
DNS1=202.96.134.33
DNS2=202.96.128.86
DOMAIN=cloudstack.org

Host名称
# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mgmt1.cloudstack.org
NETWORKING_IPV6=no
NOZEROCONF=yes
GATEWAY=192.168.0.1

# vim /etc/hosts
127.0.0.1   localhost
192.168.0.103 mgmt1.cloudstack.org

DNS(广东电信)
# vim /etc/resolv.conf
nameserver 127.0.0.1
# Generated by NetworkManager
search cloudstack.org
nameserver 202.96.134.33
nameserver 202.96.128.86

重启网络
# service networkrestart
开机启用网络
# chkconfig networkon
开机启用NetworkManager
# chkconfig --add NetworkManager
# chkconfig NetworkManager on

验证网络
# ping 192.168.0.1
# ping www.baidu.com
# hostname --fqdn

安装并启动NTP服务器
#yum install ntp
# service ntpd start
将其加入boot时启动
# chkconfig ntpd on


安装CloudStack管理节点
#yum install cloudstack-management

安装MySQL数据库
#yum install mysql-server
修改/etc/my.cnf,在 [mysqld] 段 datadir 下增加以下内容:
注意:若单个management节点max_connections配置为350
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = 'ROW'
重启MySQL
#service mysqld restart

建立安全链接,除了"Disallow root login remotely?"选项以外,全部选择“y”
#mysql_secure_installation

放宽SELinux权限
1)检查是否安装了selinux,如果没有,那么跳过后续步骤
#rpm -qa | grep selinux
2)修改/etc/selinux/config,将SELINUX=enforcing修改为SELINUX=permissive
3)及时生效
#setenforce permissive

建立CloudStack的MySQL数据库帐户cloud及口令密码,以及初始化元数据:
#cloudstack-setup-databasescloud:<dbpassword>@localhost \--deploy-as=root:<password>\-e <encryption_type> \-m <management_server_key>\-k <database_key> \-i <management_server_ip>
以上命令根据实际情况替换,encryption_type默认&#20540;为file,management_server_key默认&#20540;为password,database_key默认&#20540;为password,详细参考http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.1.1/html/Installation_Guide/management-server-install-flow.html#about-password-encryption,如下参考:
#cloudstack-setup-databases cloud:cloud@mgmt1.cloudstack.org \--deploy-as=root:root \-m cloud \-k cloud \-i mgmt1.cloudstack.org
若KVM hypervisor在同一台主机运行,那么修改/etc/sudoers增加以下内容:
Defaults:cloud !requiretty

初始化CloudStack管理服务器
#cloudstack-setup-management
注意:只有XenServer需要下载vhd-util

(二)在其他节点独立安装数据库
若不是采取CloudStack的AllInOne方式,则需要在新主机上安装MySQL
修改/etc/my.cnf,在 [mysqld] 段 datadir 下增加以下内容:
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = 'ROW'
bind-address = 0.0.0.0
重启MySQL
#service mysqld restart

将MySQL加入boot时启动
# chkconfig mysqld on

建立安全链接,除了&quot;Disallow root login remotely?&quot;选项以外,全部选择“y”
#mysql_secure_installation

修改防火墙,允许MySQL的3306端口运行
#vim /etc/sysconfig/iptables
在:INPUT ACCEPT [0:0]下面增加以下内容:
-A INPUT -p tcp --dport 3306 -j ACCEPT
重启iptables
#service iptables restart

重新建立CloudStack的MySQL数据库帐户,以及初始化元数据,参考如上所述:
#cloudstack-setup-databasescloud:<dbpassword>@localhost \--deploy-as=root:<password>\-e <encryption_type> \-m <management_server_key>\-k <database_key> \-i <management_server_ip>
(三)使用Management Server作为 NFS Server
生产环境建议独立安装网络文件系统,详细参考http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.1.1/html/Installation_Guide/management-server-install-flow.html#nfs-shares-on-separate-server
本文CloudStack的AllInOne方式,网络文件系统安装在同一主机
#yum install nfs-utils
#mkdir -p /export/primary
#mkdir -p /export/secondary
#vi /etc/exports
填写以下内容:
/export *(rw,async,insecure,no_root_squash)
NFS Server导出export目录
#exportfs -arv
#vi /etc/sysconfig/nfs
取消以下行的注释
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
RQUOTAD_PORT=875
STATD_PORT=662
STATD_OUTGOING_PORT=2020
修改iptables
#vi /etc/sysconfig/iptables
在:INPUT ACCEPT[0:0]之前加入以下行:(这里<NETWORK>替换当前主机IP或域名)
-A INPUT -s <NETWORK> -m state--state NEW -p udp --dport 111 -j ACCEPT
-A INPUT -s <NETWORK> -m state--state NEW -p tcp --dport 111 -j ACCEPT
-A INPUT -s <NETWORK> -m state--state NEW -p tcp --dport 2049 -j ACCEPT
-A INPUT -s <NETWORK> -m state--state NEW -p tcp --dport 32803 -j ACCEPT
-A INPUT -s <NETWORK> -m state--state NEW -p udp --dport 32769 -j ACCEPT
-A INPUT -s <NETWORK> -m state--state NEW -p tcp --dport 892 -j ACCEPT
-A INPUT -s <NETWORK> -m state--state NEW -p udp --dport 892 -j ACCEPT
-A INPUT -s <NETWORK> -m state--state NEW -p tcp --dport 875 -j ACCEPT
-A INPUT -s <NETWORK> -m state--state NEW -p udp --dport 875 -j ACCEPT
-A INPUT -s <NETWORK> -m state--state NEW -p tcp --dport 662 -j ACCEPT
-A INPUT -s <NETWORK> -m state--state NEW -p udp --dport 662 -j ACCEPT

# cat /etc/sysconfig/iptables
如果IP不对,可通过命令进行修改:sed -i's/127.0.0.1/mgmt1.cloudstack.org/g' /etc/sysconfig/iptables重启iptables
#service iptables restart
#service iptables save
修改hypervisor主机 和 Management服务器idmapd
#vi /etc/idmapd.conf
取消Domain注释,并写入域名
Domain = cloudstack.org
重启Management服务器

登录hypervisor主机,验证上述配置,并将其加入boot时启动
# service rpcbind start
# service nfs start
# chkconfig nfs on
# chkconfig rpcbind on
# reboot   

登录hypervisor主机,在Management服务器上测试挂载/export目录
# mkdir /primarymount
# mount -t nfs mgmt1.cloudstack.org:/export/primary/primarymount
# umount /primarymount
# mkdir /secondarymount
# mount -t nfs mgmt1.cloudstack.org:/export/secondary/secondarymount
# umount /secondarymount
检查是否挂载发生错误
# tail -f /var/log/messages

验证NFS挂载情况
# reboot
# showmount -e mgmt1.cloudstack.org
Export list for mgmt1.cloudstack.org:
/export *
# mount | grep primary
# mount -l
... ...
mgmt1.cloudstack.org:/export/primary on /mnt/b050decd-2d7f-3428-9dcf-81bd4b2fdeda type nfs (rw,noac,vers=4,addr=192.168.0.103,clientaddr=192.168.0.103)
(当Zone配置完毕,Secondary storage vm s-1-VM 和Console proxy v-2-VM才会挂载到NFS存储)

(四)安装额外的其他管理节点服务器(可选)
开机启动服务
# service rpcbind start
# service nfs start
# chkconfig nfs on
# chkconfig rpcbind on
重新建立CloudStack的MySQL数据库帐户,以及初始化元数据,参考如上所述:
#cloudstack-setup-databasescloud:<dbpassword>@localhost \--deploy-as=root:<password>\-e <encryption_type> \-m <management_server_key>\-k <database_key> \-i <management_server_ip>
初始化配置
# cloudstack-setup-management
若有多台额外的管理服务器,重复执行上述步骤
管理节点服务器间集群负载均衡配置参考以下链接:
http://cloudstack.apache.org/docs/en-US/Apache_CloudStack/4.1.1/html/Installation_Guide/management-server-install-flow.html

(五)准备System VM Template
注意:若前述步骤CloudStack database 加密方式encryption type 选择的是 &quot;web&quot;,那么必须使用-s 参数:
    For XenServer:

    #/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt-m /mnt/secondary -uhttp://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2-h xenserver -s -F

    ForvSphere:

    #/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt-m /mnt/secondary -uhttp://download.cloud.com/templates/burbank/burbank-systemvm-08012012.ova-h vmware -s   -F

    ForKVM:

    #/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt-m /mnt/secondary -uhttp://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2-h kvm -s -F

本机KVM执行命令参考如下:
#/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt-m /secondarymount -uhttp://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2-h kvm -F -o mgmt1.cloudstack.org -r cloud -d cloud
当然也可以下载到本机进行安装,命令由-u改为-f参数指定文件路径

(六)登录CloudStack
检测CloudStack运行状态
#service cloudstack-management status
或者观察启动日志
#tail -100f /var/log/cloudstack/management/catalina.out
成功启动后登录 http://mgmt1.cloudstack.org:8080/client 默认用户名及密码admin/password

(七)卸载CloudStack及MySQL数据库
#yum remove cloudstack-management
#yum remove mysql-server

         版权声明:本文为博主原创文章,未经博主允许不得转载。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-126332-1-1.html 上篇帖子: CloudStack学习笔记-源代码构建 下篇帖子: CloudStack 系统虚拟机
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表