两台支持虚拟化的物理机:一台管理节点(包括管理程序、数据库和NFS),一台计算节点。
(本实验是在两台支持嵌套虚拟化的虚拟机上进行的)
操作系统:CentOS7.5
软件版本:CloudStack-4.11.2.0.el7
#yum -y install ntp
#systemctl start ntpd
#systemctl enable ntpd
#vi /etc/selinux/config
修改成
SELINUX=disabled或SELINUX=permissive
#setenforce 0
如: 192.168.31.20 node3120
192.168.31.21 node3121
安装
#yum -y install mariadb*
启动
#systemctl start mariadb
开机自启动
#systemctl enable mariadb
配置密码(启动服务才可以进行配置)
#mysql_secure_installation
默认密码为空,这里进入后配置密码为123456
#systemctl stop firewalld
#systemctl disable firewalld
#vi /etc/yum.repos.d/cloudstack.repo
[cloudstack]
name=cloudstack
baseurl=http://download.cloudstack.org/centos/7/4.11/
enabled=1
gpgcheck=0
#yum -y install cloudstack-common cloudstack-management
#yum -y install mysql-connector-python
安装不了执行以下命令重试:
#yum -y install epel-release
#yum clean all && yum makecache
#yum -y install mysql-connector-python
最后就能安装成功了
#yum -y install cloudstack-common cloudstack-management
#cloudstack-setup-databases cloud:cloud@localhost --deploy-as=root:123456
#cloudstack-setup-management
访问:http://192.168.31.20:8080/client/
账号密码默认:admin password
修改nfs服务参数
#vi /etc/sysconfig/nfs (直接加在结尾)
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
RQUOTAD_PORT=875
MOUNTD_PORT=892
STATD_PORT=662
STATD_OUTGOING_PORT=2020
RPCNFSDARGS="-N 4"
# vi /etc/exports
/data/primary *(rw,async,no_root_squash,no_subtree_check)
/data/secondary *(rw,async,no_root_squash,no_subtree_check)
#vi /etc/nfsmount.conf
Nfsvers=3
#systemctl enable rpcbind
#systemctl enable nfs-server
#systemctl start rpcbind
#systemctl start nfs-server
测试挂载
#mount -t nfs 192.168.100.4:/data/cloudstack/primary /mnt
查看挂载是否成功
#df -h
卸载
#umount /mnt
#wget http://download.cloudstack.org/systemvm/4.11/systemvmtemplate-4.11.2-kvm.qcow2.bz2
安装模板到二级存储
#/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /data/secondary -f systemvmtemplate-4.11.2-kvm.qcow2.bz2 -h kvm -F
#vi /etc/yum.repos.d/cloudstack.repo
[cloudstack]
name=cloudstack
baseurl=http://download.cloudstack.org/centos/7/4.11/
enabled=1
gpgcheck=0
#yum -y install cloudstack-agent cloudstack-common
#systemctl start cloudstack-agent
#systemctl enable cloudstack-agent
#vi /etc/resolv.conf
nameserver 8.8.8.8
查看网卡:这里是ens35
CentOS7利用nmcli创建网桥cloudbr0
#nmcli con add type bridge con-name cloudbr0 ifname cloudbr0 ip4 192.168.31.21/24 ipv4.gateway 192.168.31.1 ipv6.method ignore save yes
#nmcli con add type bridge-slave ifname ens35 master cloudbr0 save yes
删除默认ens35配置
#cd /etc/sysconfig/network-scripts/
#rm
安装个网桥工具
yum install bridge-utils
进入/etc/sysconfig/network-scripts目录
sudo vi ifcfg-cloudbr0
ifcfg-cloudbr0的配置文件的内容如下:
NAME=cloudbr0
DEVICE=cloudbr0
TYPE=Bridge
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
USERCTL=no
IPV6INIT=no
IPADDR=192.168.59.129
NETMASK=255.255.255.0
GATEWAY=192.168.59.2
然后修改eth0的配置文件ifcfg-eth0内容为:
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
USERCTL=no
IPV6INIT=no
BRIDGE=cloudbr0
#systemctl restart network
具体操作见:http://blog.sina.com.cn/s/blog_538c78d60102w1w6.html