本次安装参考:http://cloudstack-installation.readthedocs.io/zh_CN/latest/qig.html#overview
环境:
CentOS7.2
CloudStack4.9
服务器两台,一台作为manager节点与nfs节点,一台作为计算节点。并将相关软件包下载好
Begin:
[root@localhost ~]# service firewalld stop #为方便实验,关闭防火墙及selinux
Redirecting to /bin/systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
[root@localhost ~]# hostnamectlset-hostname cloud-manager #修改主机名
[root@localhost ~]# yum -y install ntp #安装并配置NTP服务器
[root@localhost ~]# chkconfig ntpd on
[root@localhost ~]# service ntpd start
编辑软件安装源
vi /etc/yum.repos.d/cloudstack.repo
[cloudstack]
name=cloudstack
baseurl=http://cloudstack.apt-get.eu/centos/7/4.9/
enabled=1
gpgcheck=0
安装配置NFS
[root@localhost ~]# yum -y install nfs-utils
[root@localhost ~]# vi /etc/exports #该文件写入
/export/secondary *(rw,async,no_root_squash,no_subtree_check)
/export/primary *(rw,async,no_root_squash,no_subtree_check)
[root@localhost ~]# mkdir -p /export/primary
[root@localhost ~]# mkdir /export/secondary
[root@localhost primary]# service rpcbind start
Redirecting to /bin/systemctl start rpcbind.service
[root@localhost primary]# service nfs start
Redirecting to /bin/systemctl start nfs.service
安装配置mysql
[root@localhost yum.repos.d]# rpm -qa|grep mariadb
mariadb-libs-5.5.52-1.el7.x86_64
mariadb-devel-5.5.52-1.el7.x86_64
[root@localhost yum.repos.d]# yum remove mariadb-libs
[root@localhost mysql]# wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
[root@localhost mysql]# ls
mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
[root@localhost mysql]# tar -xvf mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
mysql-community-libs-compat-5.7.16-1.el7.x86_64.rpm
mysql-community-devel-5.7.16-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.16-1.el7.x86_64.rpm
mysql-community-libs-5.7.16-1.el7.x86_64.rpm
mysql-community-common-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.16-1.el7.x86_64.rpm
mysql-community-test-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.16-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.16-1.el7.x86_64.rpm
mysql-community-server-5.7.16-1.el7.x86_64.rpm
mysql-community-client-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-5.7.16-1.el7.x86_64.rpm
[root@localhost mysql]# rpm -ivh mysql-community-common-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-5.7.16-1.e################################# [100%]
[root@localhost mysql]# rpm -ivh mysql-community-libs-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-5.7.16-1.el7################################# [100%]
[root@localhost mysql]# rpm -ivh mysql-community-client-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-5.7.16-1.e################################# [100%]
[root@localhost mysql]# rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-5.7.16-1.e################################# [100%]
[root@localhost mysql]# mysqld --initialize --user=mysql #初始化mysql
[root@localhost mysql]# cat /var/log/mysqld.log
2017-02-07T03:10:49.589784Z 1 [Note] A temporary password is generated for root@localhost: .X1Mdf152tel #密码为.X1Mdf152tel
[root@localhost mysql]# systemctl start mysqld.service
测试登录
[root@localhost mysql]# mysql -uroot -hlocalhost -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.16
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> set password for 'root'@'localhost'=password('0p-0p-0p-');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
mysql>quit
Bye
在/etc/my.cnf增加一行
sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
lower_case_table_names=1
安装cloudstack
[root@localhost cloudstackrpm]# ls
cloudstack-agent-4.9.2.0-1.el7.centos.x86_64.rpm
cloudstack-common-4.9.2.0-1.el7.centos.x86_64.rpm
cloudstack-management-4.9.2.0-1.el7.centos.x86_64.rpm
cloudstack-usage-4.9.2.0-1.el7.centos.x86_64.rpm
rpm -ivh cloudstack-common-4.9.2.0-1.el7.centos.x86_64.rpm
rpm -ivh cloudstack-management-4.9.2.0-1.el7.centos.x86_64.rpm
安装过程中缺少的依赖都给他装上,安装完毕后提示
Please download vhd-util from http://download.cloud.com.s3.amazonaws.com/tools/vhd-util and put it in
/usr/share/cloudstack-common/scripts/vm/hypervisor/xenserver/
[root@localhost cloudstackrpm]# cd /usr/share/cloudstack-common/scripts/vm/hypervisor/xenserver/
[root@localhost xenserver]# wget http://download.cloud.com.s3.amazonaws.com/tools/vhd-util
--2017-02-06 23:20:43-- http://download.cloud.com.s3.amazonaws.com/tools/vhd-util
Resolving download.cloud.com.s3.amazonaws.com (download.cloud.com.s3.amazonaws.com)... 52.216.192.32
Connecting to download.cloud.com.s3.amazonaws.com (download.cloud.com.s3.amazonaws.com)|52.216.192.32|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 318977 (312K) [binary/octet-stream]
Saving to: ‘vhd-util’
100%[=====================================================================================================================================================>] 318,977 8.25KB/s in 33s
2017-02-06 23:21:17 (9.51 KB/s) - ‘vhd-util’ saved [318977/318977]
初始化CloudStack数据库
[root@localhost xenserver]# cloudstack-setup-databases cloud:0p-0p-0p-@localhost --deploy-as=root:0p-0p-0p-
下载系统虚拟机模板并安装,挂载二级存储
# mkdir /mnt/secondary
# mount -t nfs 127.0.0.1:/export/secondary /mnt/secondary
[root@localhost secondary]# cd /usr/share/cloudstack-common/scripts/storage/secondary/
[root@localhost secondary]# ./cloud-install-sys-tmplt -m /mnt/secondary/ -f systemvm64template-4.6.0-kvm.qcow2.bz2 -h kvm -F
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
Uncompressing to ./f271566b-bf88-4503-b454-eb756a0fe2c3.qcow2.tmp (type bz2)...could take a long time
Moving to /mnt/secondary/template/tmpl/1/3///f271566b-bf88-4503-b454-eb756a0fe2c3.qcow2...could take a while
Successfully installed system VM template systemvm64template-4.6.0-kvm.qcow2.bz2 to /mnt/secondary/template/tmpl/1/3/
部署
[root@localhost secondary]# cloudstack-setup-management --tomcat7 #指定为tomcat7
计算节点安装com和agent包并执行:
cloudstack-setup-agent
设置主机ManagerIP地址
ERR:Cloud无法删除区域
FIX:Select * from physical_network
ERR:Mysql无法初始化
FIX:删除var/lib/mysql
ERR:Cloud日志报错com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Expression #1 of SELECT list is not in GR
FIX:my.cnf添加 大小写处理,转义字符
ERR:无法连接二级存储
FIX:将所在区域安装存储虚拟机
ERR:无法分发系统,资源不足。
FIX:添加vlan资源,添加IP地址资源