时间:2021-07-01 10:21:17 帮助过:13人阅读
准备两台服务器, 一台用来安装管理节点(192.168.8.193), 一台用来安装计算节点(192.168.8.194), 管理节点用来统一管理计算节点,提供资源分配和任务,提供 API、GUI、数据库等服务;计算节点(xenServer)则用来跑虚拟机,计算节点最好是物理机, 我们要做的是:
在管理节点上安装cloudstack-management, mysql, NFS服务器
在计算节点上安装xenServer6.2
1. 修改hostname
在hosts中增加192.168.8.193 cloudstack.cloud.priv
# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.8.193 cloudstack.cloud.priv
重启网络
# service network restart
用hostname –fqdn检查返回的是不是cloudstack.cloud.priv, 如果不是reboot系统
# hostname –fqdn
# cloudstack.cloud.priv
2. 修改SELINUX设置
# vi /etc/selinux/config
# setenforce permissive
3. 确认机器能访问互联网
# pingwww.baidu.com
4. 添加cloudstack软件包的官方源
# vi /etc/yum.repos.d/cloudstack.repo
[cloudstack]
name=cloudstack
baseurl=http://cloudstack.apt-get.eu/rhel/4.3/
enabled=1
gpgcheck=0
5. 安装NTP
# yum install ntp
# chkconfig ntpd on
# service ntpd start
6. 安装Management Server
# yum install cloudstack-management
7. 下载vhd-util,并拷贝到/usr/share/cloudstack-common/scripts/vm/hypervisor/xenserver
# wgethttp://download.cloud.com.s3.amazonaws.com/tools/vhd-util
# cp whd-util /usr/share/cloudstack-common/scripts/vm/hypervisor/xenserver
8. 安装mysql
# yum install mysql-server
9. 修改mysql配置并加入以下几行,红色部分为需要加入的行
# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = ‘ROW’
…
10. 重启mysql,并加入开机自启动
# service mysqld start
# chkconfig mysqld on
11. 执行mysql的安全配置,所有的问题都回答”Y”
# mysql_secure_installation
12. 安装cloudstack数据库
# cloudstack-setup-databases cloud:cloud@localhost –deploy-as=root:123456
13. 启动cloudstack
# cloudstack-setup-management
14. 安装NFS服务,并配置主存储和二级存储
# yum install nfs-utils
# mkdir -p /export/primary
# mkdir -p /export/secondary
# vi /etc/exports
/export *(rw,async,no_root_squash,no_subtree_check)
# exportfs -a
# vi /etc/sysconfig/nfs
…
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
RQUOTAD_PORT=875
STATD_PORT=662
STATD_OUTGOING_PORT=2020
# vi /etc/sysconfig/iptables
…
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p udp –dport 111 -j ACCEPT
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p tcp –dport 111 -j ACCEPT
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p tcp –dport 2049 -j ACCEPT
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p tcp –dport 32803 -j ACCEPT
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p udp –dport 32769 -j ACCEPT
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p tcp –dport 892 -j ACCEPT
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p udp –dport 892 -j ACCEPT
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p tcp –dport 875 -j ACCEPT
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p udp –dport 875 -j ACCEPT
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p tcp –dport 662 -j ACCEPT
-A INPUT -s 192.168.8.0/24 -m state –state NEW -p udp –dport 662 -j ACCEPT
…
注意192.168.8.0/24换成你自己的ip网段
# service iptables restart
# service iptables save
# vi /etc/idmapd.conf
Domain = cloud.priv
注意Domain设置成你hostname –fqdn返回的域名
# service rpcbind start
# service nfs start
# chkconfig nfs on
# chkconfig rpcbind on
# reboot
在计算节点上(192.168.8.194)测试下能不能成功挂载主存储和二级存储(不是必须的,仅用测试)
# mkdir -p /mnt/primary
# mkdir -p /mnt/secondary
# mount -t nfs 192.168.8.193:/export/primary /mnt/primary
# mount -t nfs 192.168.8.193:/export/secondary /mnt/secondary
如果能成功挂载,则卸载掉并删除
# umount /mnt/primary
# umount /mnt/secondary
# rm -rf /mnt
15. 导入系统虚拟机模板(xenServer)
我们可以把模板先下载到/opt目录下,然后在导入
# cd /opt
# wgethttp://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-xen.vhd.bz2
# /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /export/secondary -f /opt/systemvm64template-2014-01-14-master-xen.vhd.bz2 -h xenserver -F
16. 安装完成, 访问http://192.168.8.193:8080/client
默认用户名和密码为admin, password
1. 安装xenServer6.2. 安装过程请参考官方安装文档,这里就不列出了
2. 修改hostname(可以在安装的过程就指定好hostname)
在hosts中增加192.168.8.194 xenserver.cloud.priv
# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain
192.168.8.194 xenserver.cloud.priv
重启网络
# service network restart
用hostname –fqdn检查返回的是不是xenserver.cloud.priv, 如果不是reboot系统
# hostname –fqdn
# xenserver.cloud.priv
如果还不生效的话,修改 HOSTNAME=xenserver.cloud.priv
# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
IPV6_AUTOCONF=no
HOSTNAME=xenserver.cloud.priv
NOZEROCONF=yes
3. 安装ntp
# yum install ntp
4. 修改idmapd中的域
# vi /etc/idmapd.conf
Domain = cloud.priv
注意Domain设置成你hostname –fqdn返回的域名