和 OpenStack, OpenNebula 类似,CloudStack 是另一款开源云计算平台。CloudStack 的前身是 Cloud.com 家的一款商业云计算产品(也有开源版本),2011年 Cloud.com 被 Citrix 收购,2012年的时候 Citrix 将收购的云平台 CloudStack 全部捐给了 Apache 基金会,自己则以 Citrix CloudPlatform (powered by Apache CloudStack) 的形式为客户提供商业化的云计算解决方案。
1、主机规划
1 2 3 4 |
nfs 192.168.15.10 CloudStack 192.168.15.15 node1 192.168.15.13 node2 192.168.1.14 |
2、修改主机名
1 2 3 4 |
[root@node5 ~]# vim /etc/hosts \\新增以下内容 192.168.15.15 cloudstack cloudstack.centos6.com [root@node5 ~]# vim /etc/sysconfig/network \\修改主机名 HOSTNAME=cloudstack.centos6.com |
3、关闭iptables、selinux
1 2 3 4 5 |
[root@node5 ~]# vim /etc/sysconfig/selinux SELINUX=disabled [root@node5 ~]# /etc/init.d/iptables stop [root@node5 ~]# chkconfig iptables off [root@node5 ~]# reboot |
4、添加cloudstack软件包的官方源
1 2 3 4 |
[root@node5 ~]# cd /etc/yum.repos.d/ [root@node5 yum.repos.d]# cp epel-6.repo epel-6.repo.20151214 [root@node5 yum.repos.d]# vim epel-6.repo baseurl=http://cloudstack.apt-get.eu/rhel/4.4/ |
5、安装Management Server
1 2 |
[root@cloudstack yum.repos.d]# yum -y install cloudstack-management 笔者虚拟机在这ping不通cloudstack.apt-get.eu域名. 拿自己物理机ping cloudstack.apt-get.eu域名, 将得出的ip地址写入到linux的hosts文件里. |
6、安装mysql并配置数据库
①. 安装mysql-server
1 |
[root@cloudstack yum.repos.d]# yum -y install mysql-server |
②. 修改mysql配置并加入以下几行
1 2 3 4 5 6 7 |
[root@cloudstack ~]# vim /etc/my.cnf [mysqld] innodb_rollback_on_timeout=1 innodb_lock_wait_timeout=600 max_connections=350 log-bin=mysql-bin binlog-format = 'ROW' |
③. 重启mysql, 并加入开机自启动
1 2 |
[root@cloudstack ~]# /etc/init.d/mysqld start [root@cloudstack ~]# chkconfig mysqld on |
④. 执行mysql的安全配置, 并设置密码等过程, 如需要简单可直接全选Y
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
[root@cloudstack ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] y New password: 123qwe Re-enter new password: 123qwe Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] n ... skipping. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! |
⑤. 安装CloudStack数据库
1 |
[root@cloudstack ~]# cloudstack-setup-databases cloud:cloud@localhost --deploy-as=root:123qwe |
7.、初始化CloudStack管理节点
1 2 3 4 5 6 |
[root@cloudstack ~]# cloudstack-setup-management Starting to configure CloudStack Management Server: Configure sudoers ... [OK] Configure Firewall ... [OK] Configure CloudStack Management Server ...[OK] CloudStack Management Server setup is Done! |
8、启动CloudStack-management
1 |
[root@cloudstack ~]# /etc/init.d/cloudstack-management start |
1、安装服务端所需软件
1 |
[root@nfs-server ~]# yum -y install nfs-utils protmap |
2、配置共享目录
1 2 |
[root@nfs-server ~]# vim /etc/exports /nfs *(rw,fsid=1,async,no_root_squash,no_subtree_check) |
3、启动nfs服务
1 2 |
[root@nfs-server ~]# /etc/init.d/nfslock start [root@nfs-server ~]# /etc/init.d/nfs start |
4、配置Cloudstack nfs客户端
1 2 3 |
[root@cloudstack ~]# yum -y install nfs-utils protmap [root@cloudstack ~]# mkdir /nfs [root@cloudstack ~]# mount -t nfs 192.168.15.10:/nfs /nfs/ |
说明: 系统虚拟机模板按要求要存放在辅助存储上的,我们可以先手动挂载nfs辅助存储, 然后把290M KVM虚拟化模板先下载到辅助存储目录下,然后在导入, 导入系统虚拟机模板步是必须要配置的内容。本例采用KVM虚拟化,下载导入KVM虚拟机模板。
1 2 3 4 5 6 7 8 |
[root@cloudstack ~]# cd /nfs/ [root@cloudstack nfs]# wget http://cloudstack.apt-get.eu/systemvm/4.4/systemvm64template-4.4.0-6-kvm.qcow2.bz2 [root@cloudstack nfs]# /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /nfs -f systemvm64template-4.4.0-6-kvm.qcow2.bz2 -h kvm -F Uncompressing to /usr/share/cloudstack-common/scripts/storage/secondary/36245427-d76a-4b2a-b2e9-8552ccdd5f93.qcow2.tmp (type bz2)...could take a long time Moving to /nfs/template/tmpl/1/3///36245427-d76a-4b2a-b2e9-8552ccdd5f93.qcow2...could take a while Successfully installed system VM template systemvm64template-4.4.0-6-kvm.qcow2.bz2 to /nfs/template/tmpl/1/3/ ps:错误提示 Insufficient free disk space for local temporary folder /usr/share/cloudstack-common/scripts/storage/secondary: avail=4749888k req=5120000k \\出现这种错误说明根分区(/)不够用 |