环境
centos 7.9
mariadb 5.5
ip:
管理节点 : 192.168.10.11 node11.ycedu.com
虚拟机主控节点
192.168.10.11 node11.ycedu.com
192.168.10.10 node10.ycedu.com
192.168.10.7 node7.ycedu.com
NFS:
192.168.10.7 node7.ycedu.com
虚拟机类型: KVM
数据库及NTP安装
1. 设置所有的机器为qdfn全程,我们以node11为例(以下均以node11作为例子)
分别在每台机器上执行,比如 hostnamectl set-hostname node11.yc.edu.com,
hostnamectl set-hostname {yourhostname}
2.修改所有机器的的hosts文件
echo "192.168.10.11 node11 node11.ycedu.com" >>/etc/hosts
3. 在node11机器上安装maraidb数据库,安装完毕密码默认为空.
yum intall mariadb-server -y
启用数据库
systemctl start mariadb
systemctl enable mariadb
4. 在每台机器上安装时间同步服务,并且启动.
yum install ntp -y
systemctl start ntpd
systemctl enable ntpd
NFS服务器的安装和发布
NFS服务器安装的目的是为了给cloudstack提供primary和secondary的存储,虚拟机模板是存储在secondary上门。
以下的安装都在192.168.10.7上进行。rpcbind包会随着nfs-utils的安装而安装,如果centos版本比较低,那么单独安装rpcbind包。
yum intall nfs-utils
yum enable rcbind
yum enable nfs
[root@node11 ~]# mkdir -p /home/nfs/cloudstack/secondary
[root@node11 ~]# mkdir -p /home/nfs/cloudstack/primary
[root@node11 ~]# exportfs -a
[root@node11 ~]# echo "/home/nfs/cloudstack/primary *(rw,async,no_root_squash,no_subtree_check)" >> /etc/exports
[root@node11 ~]# echo "/home/nfs/cloudstack/secondary *(rw,async,no_root_squash,no_subtree_check)" >> /etc/exports
[root@node11 ~]# exportfs -a
[root@node11 ~]# systemctl enable rpcbind
Created symlink from /etc/systemd/system/multi-user.target.wants/rpcbind.service to /usr/lib/systemd/system/rpcbind.service.
[root@node11 ~]# systemctl enable nfs
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
[root@node11 ~]# systemctl start nfs
测试NFS是否安装好并且可以挂载,在其他内网的机器上,安装nfs-utils包,但不需要启动服务rcbind及nfs
[root@node11 ~]# mkdir /mnt/cloud/primary -p
[root@node11 ~]# mount 192.168.10.7:/home/nfs/cloudstack/primary /mnt/cloud/primary
[root@node11 ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 12G 0 12G 0% /dev
tmpfs tmpfs 12G 0 12G 0% /dev/shm
tmpfs tmpfs 12G 490M 12G 5% /run
tmpfs tmpfs 12G 0 12G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 50G 2.8G 48G 6% /
/dev/mapper/centos-home xfs 234G 61G 174G 26% /home
/dev/sda1 xfs 1014M 204M 811M 21% /boot
tmpfs tmpfs 2.4G 0 2.4G 0% /run/user/0
192.168.10.7:/home/nfs/cloudstack/primary nfs4 3.6T 112G 3.5T 4% /mnt/cloud/primary
可以看到已经把primary挂载到本地了。NFS系统可用。如果要讲NFS系统永久挂载到本地,需要在/etc/fstab中添加一行,系统重启的时候会自动挂载。
echo "192.168.10.7:/home/nfs/cloudstack/promariy /mnt/cloud/primary nfs defaults 0 0 " >>/etc/fstab
cloudstack安装
下载三个应用程序,使用wget下载。
wget http://download.cloudstack.org/centos/7/4.11/cloudstack-agent-4.11.2.0-1.el7.centos.x86_64.rpm
wget http://download.cloudstack.org/centos/7/4.11/cloudstack-common-4.11.2.0-1.el7.centos.x86_64.rpm
wget http://download.cloudstack.org/centos/7/4.11/cloudstack-management-4.11.2.0-1.el7.centos.x86_64.rpm
common都需要在每台机器上安装
agent是安装客户虚拟机的主机上安装
management是在服务器上安装.
安装common包时,可能会出现libgcc的包版本冲突问题
[root@meedu ~]# yum localinstall cloudstack-common-4.11.2.0-1.el7.centos.x86_64.rpm -y
已加载插件:fastestmirror, langpacks
正在检查 cloudstack-common-4.11.2.0-1.el7.centos.x86_64.rpm: cloudstack-common-4.11.2.0-1.el7.centos.x86_64
cloudstack-common-4.11.2.0-1.el7.centos.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 cloudstack-common.x86_64.0.4.11.2.0-1.el7.centos 将被 安装
--> 正在处理依赖关系 libc.so.6,它被软件包 cloudstack-common-4.11.2.0-1.el7.centos.x86_64 需要
Loading mirror speeds from cached hostfile
* base: mirrors.ustc.edu.cn
* epel: mirrors.bfsu.edu.cn
* extras: mirrors.ustc.edu.cn
* nux-dextop: mirror.li.nux.ro
* updates: mirrors.ustc.edu.cn
--> 正在处理依赖关系 libc.so.6(GLIBC_2.0),它被软件包 cloudstack-common-4.11.2.0-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 libc.so.6(GLIBC_2.1),它被软件包 cloudstack-common-4.11.2.0-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 libc.so.6(GLIBC_2.2),它被软件包 cloudstack-common-4.11.2.0-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 libc.so.6(GLIBC_2.2.3),它被软件包 cloudstack-common-4.11.2.0-1.el7.centos.x86_64 需要
--> 正在处理依赖关系 libc.so.6(GLIBC_2.3),它被软件包 cloudstack-common-4.11.2.0-1.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 glibc.i686.0.2.17-317.el7 将被 安装
--> 正在处理依赖关系 libfreebl3.so(NSSRAWHASH_3.12.3),它被软件包 glibc-2.17-317.el7.i686 需要
--> 正在处理依赖关系 libfreebl3.so,它被软件包 glibc-2.17-317.el7.i686 需要
--> 正在检查事务
---> 软件包 nss-softokn-freebl.i686.0.3.53.1-6.el7_9 将被 安装
--> 解决依赖关系完成
错误: Multilib version problems found. This often means that the root
cause is something else and multilib version checking is just
pointing out that there is a problem. Eg.:
1. You have an upgrade for glibc which is missing some
dependency that another package requires. Yum is trying to
solve this by installing an older version of glibc of the
different architecture. If you exclude the bad architecture
yum will tell you what the root cause is (which package
requires what). You can try redoing the upgrade with
--exclude glibc.otherarch ... this should give you an error
message showing the root cause of the problem.
2. You have multiple architectures of glibc installed, but
yum can only see an upgrade for one of those architectures.
If you don't want/need both architectures anymore then you
can remove the one with the missing update and everything
will work.
3. You have duplicate versions of glibc installed already.
You can use "yum check" to get yum show these errors.
...you can also use --setopt=protected_multilib=false to remove
this checking, however this is almost never the correct thing to
do as something else is very likely to go wrong (often causing
much more problems).
保护多库版本:glibc-2.17-317.el7.i686 != glibc-2.17-292.el7.x86_64
错误:保护多库版本:nss-softokn-freebl-3.53.1-6.el7_9.i686 != nss-softokn-freebl-3.44.0-8.el7_7.x86_64
解决方法
package-cleanup --cleandupes
安装epel-release库为了安装以下包需要其他数据库相关的包,否则会依赖关系找不到。
yum install epel-release -y
yum localinstall cloudstack-common-4.11.2.0-1.el7.centos.x86_64.rpm -y
yum localinstall cloudstack-agent-4.11.2.0-1.el7.centos.x86_64.rpm -y
yum localinstall cloudstack-management-4.11.2.0-1.el7.centos.x86_64.rpm -y
在node11上初始化数据库,因为默认的root没有密码,因此我们保留空
cloudstack-setup-databases cloud:cloud@localhost --deploy-as=root:
安装KVM模板
首先我们要把主存贮和备用存储挂载过来。
[root@node11 logs]# mount 192.168.10.7:/home/nfs/cloudstack/primary /mnt/cloud/primary
[root@node11 logs]# mkdir -p /mnt/cloud/secondary
[root@node11 logs]# mount 192.168.10.7:/home/nfs/cloudstack/secondary /mnt/cloud/secondary/
为了永久生效,我们在/etc/fstab增加如下二行,这样系统启动的时候就会自动挂载了。
#
# /etc/fstab
# Created by anaconda on Wed Dec 23 07:01:39 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=7d2f31ec-f5f4-4f50-9b41-ee643f5b2fc9 /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
#以下为新增
192.168.10.7:/home/nfs/cloudstack/primary /mnt/cloud/primary nfs defaults 0 0
192.168.10.7:/home/nfs/cloudstack/secondary /mnt/cloud/secondary nfs defaults 0 0
安装kvm模板
首先到地址下并解压
wget http://cloudstack.apt-get.eu/systemvm/4.11/systemvmtemplate-4.11.1-kvm.qcow2.bz2
bunzip2 systemvmtemplate-4.11.1-kvm.qcow2.bz2
安装模板
[root@node11 ~]# bunzip2 systemvmtemplate-4.11.1-kvm.qcow2.bz2
[root@node11 ~]# /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/cloud/secondary -f systemvmtemplate-4.11.1-kvm.qcow2 -h kvm -F
File /usr/share/cloudstack-common/scripts/storage/secondary/ee691c2e-10c5-479d-bfc6-0a5caa5bcc5a.qcow2 does not appear to be compressed
Moving to /mnt/cloud/secondary/template/tmpl/1/3///ee691c2e-10c5-479d-bfc6-0a5caa5bcc5a.qcow2...could take a while
Successfully installed system VM template systemvmtemplate-4.11.1-kvm.qcow2 to /mnt/cloud/secondary/template/tmpl/1/3/
因为我们要服务器上作为虚拟机服务器,因此我们要在/etc/sudoers文件增加一行
echo "Defaults:cloud !requiretty" >>/etc/sudoers
启动服务器
systemctl start cloudstack-management
systemctl enabble cloudstack-management
安装计算节点
KVM的配置相对简单,仅需配置一项,编辑QEMW VNC配置文件/etc/libvirt/qemu.conf并取消如下一行的注释;同时注释#security_driver = "selinux"。
vnc_listen = "0.0.0.0" #这个需要打开
#security_driver = "selinux" #这个默认就是关闭的,不需要管
libvirt配置
在/etc/libvirt/libvird.conf 最后添加如下内容:
listen_tls = 0
listen_tcp = 1
tcp_port = "16509"
auth_tcp = "none"
mdns_adv = 0
修改 /etc/sysconfig/libvirtd
LIBVIRTD_ARGS="--listen"
采用手工启动加入host的方法,因为系统默认用的网桥是cloudbr0-1,本系统全部用的是br0,否则一直报错
cloudstack-setup-agent -m 192.168.10.11 -z 1 -p 1 -c 1 -g 5fafc76c-6efc-38e9-9999-15f8e9f0433a -a -s --pubNic=br0 --prvNic=br0 --guestNic=br0 --hypervisor=kvm
系统启动,可以进去配置了。