管理节点1:master01.cloud.priv(centos6.9)(172.16.1.1)
cloudstack-management,DNS服务器,NTP服务器,MySQL服务器
计算节点1:node01.cloud.priv(centos6.9)(172.16.2.1)
cloudstack-agent,KVM
计算节点2:node02.cloud.priv(centos6.9)(172.16.2.2)
cloudstack-agent,KVM
存储节点1:storage01.cloud.priv(centos6.9)(172.16.3.1)
NFS
存储节点2:storage02.cloud.priv(centos6.9)(172.16.3.2)
NFS
编辑hosts文件:
vi /etc/hosts
172.16.1.1 master01.cloud.priv
172.16.2.1 node01.cloud.priv
172.16.2.2 node02.cloud.priv
172.16.3.1 storage01.cloud.priv
172.16.3.2 storage01.cloud.priv
编辑 网络配置文件
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=52:54:00:B9:A6:C0
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=none
IPADDR=172.16.1.1
NETMASK=255.255.0.0
GATEWAY=172.16.0.1
DNS1=8.8.8.8
DNS2=8.8.4.4
vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
yum install dnsmasq -y
编辑iptables文件:
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -p udp -m udp --dport 53 -j ACCEPT
启动DNS服务器
chkconfig dnsmasq on
service dnsmasq start
(1)首先确定ntp是否存在,若不存在则通过以下命令安装:
yum install ntp
(2)修改配置文件
vim /etc/ntp.conf
在其中插入:
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 127.127.1.0
restrict 192.168.11.0 mask 255.255.255.0 nomodify notrap
注释掉远程服务器,设置为本机用restrict控管权限 nomodify - 用户端不能更改ntp服务器的时间参数 noquery - 用户端不能使用ntpq,ntpc等命令来查询ntp服务器 notrap - 不提供trap远端登陆
192.168.10.0/24 - 对这个网段的计算机提供时钟同步
(3)开启ntp服务
service ntpd restart
chkconfig ntpd on
vi /etc/yum.repos.d/cloudstack.repo
[cloudstack]
name=cloudstack
baseurl=http://cloudstack.apt-get.eu/centos/6/4.9/
enabled=1
gpgcheck=0
yum install nfs-utils
编辑nfs存储目录配置
vi /etc/exports
/export/secondary *(rw,async,no_root_squash,no_subtree_check)
/export/primary *(rw,async,no_root_squash,no_subtree_check)
创建一、二级存储目录
mkdir -p /export/primary
mkdir /export/secondary
编辑nfs存储端口配置
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 172.16.10.0/24 -m state --state NEW -p udp --dport 111 -j ACCEPT
-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 111 -j ACCEPT
-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT
-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 32803 -j ACCEPT
-A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 32769 -j ACCEPT
-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 892 -j ACCEPT
-A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 892 -j ACCEPT
-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 875 -j ACCEPT
-A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 875 -j ACCEPT
-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 662 -j ACCEPT
-A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 662 -j ACCEPT
启动NFS
service iptables restart
service rpcbind start
service nfs start
chkconfig rpcbind on
chkconfig nfs on
安装MySQL数据库
yum -y install mysql-server
修改MySQL配置文件
vi /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服务
service mysqld start
chkconfig mysqld on
配置MySQL软件包存储库
vi /etc/yum.repos.d/mysql.repo
[mysql-connectors-community]
name=MySQL Community connectors
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/$releasever/$basearch/
enabled=1
gpgcheck=1
从MySQL导入GPG公钥并安装mysql-connector
rpm --import http://repo.mysql.com/RPM-GPG-KEY-mysql
yum install mysql-connector-python
安装CloudStack管理服务器
yum -y install cloudstack-management
初始化CloudStack数据库 password为数据库密码
cloudstack-setup-databases cloud:password@localhost --deploy-as=root
启动CloudStack管理服务器
cloudstack-setup-management
上传系统模板
/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt \
-m /export/secondary \
-u http://cloudstack.apt-get.eu/systemvm/4.6/systemvm64template-4.6.0-kvm.qcow2.bz2 \
-h kvm -F
1.配置网络
编辑hosts文件:
192.168.11.72 node01.cloud.priv
编辑 网络配置文件
DEVICE=eth0
HWADDR=52:54:00:B9:A6:C0
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.11.71
NETMASK=255.255.255.0
GATEWAY=192.168.11.1
DNS1=8.8.8.8
DNS2=8.8.4.4
2.NTP服务器
(1)首先确定ntp是否存在,若不存在则通过以下命令安装:
yum install ntp
(2)修改配置文件
vim /etc/ntp.conf
注释掉远程服务器,设置为局域网服务器
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 192.168.11.71
restrict 192.168.11.71 nomodify notrap noquery
(3)开启ntp服务
1.配置网络
编辑hosts文件:
192.168.11.72 node01.cloud.priv
编辑 网络配置文件
DEVICE=eth0
HWADDR=52:54:00:B9:A6:C0
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.11.71
NETMASK=255.255.255.0
GATEWAY=192.168.11.1
DNS1=8.8.8.8
DNS2=8.8.4.4
2.NTP服务器
(1)首先确定ntp是否存在,若不存在则通过以下命令安装:
yum install ntp
(2)修改配置文件
vim /etc/ntp.conf
注释掉远程服务器,设置为局域网服务器
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 192.168.11.71
restrict 192.168.11.71 nomodify notrap noquery
(3)开启ntp服务
service ntpd restart
chkconfig ntpd on