CentOS下配置Cloudstack虚拟化

本问基于CentOS6.6测试,再CentOS7下依然可用,兼容性未知.
使用Cloudstack,你至少需要两台服务器,一台作为管理,另一台作为资源机,可以有无限的资源机.

配置过程超级恶心,最后完成了一个脚本提供给大家使用:

CloudStack Manager(2014-11-22)

echo "127.0.0.1 vsm.ksc.org localhost" > /etc/hosts

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

sed -i 's/ONBOOT=no/ONBOOT=yes/' /etc/sysconfig/network-scripts/ifcfg-eth0

setenforce 0

yum install ntp -y

service ntpd start

chkconfig ntpd on

yum install openssl-devel mysql-server mysql-devel -y

service mysqld start

chkconfig mysqld on

/usr/bin/mysqladmin -u root password 'KeSu1603'

service mysqld restart

touch /etc/yum.repos.d/cloudstack.repo

echo "[cloudstack]" >> /etc/yum.repos.d/cloudstack.repo

echo "name=cloudstack" >> /etc/yum.repos.d/cloudstack.repo

echo "baseurl=http://cloudstack.apt-get.eu/rhel/4.4/" >> /etc/yum.repos.d/cloudstack.repo

echo "enabled=1" >> /etc/yum.repos.d/cloudstack.repo

echo "gpgcheck=0" >> /etc/yum.repos.d/cloudstack.repo

yum -y install cloudstack-management

cloudstack-setup-databases cloud:KeSu1603@localhost --deploy-as=root:KeSu1603

mkdir /tmp/002

mount -t nfs 192.168.8.173:/home/002 /tmp/002

wget http://172.16.66.106/systemvm64template-4.4.1-7-kvm.qcow2.bz2

/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /tmp/002 -f systemvm64template-4.4.1-7-kvm.qcow2.bz2 -h kvm -F

cloudstack-setup-management

service cloudstack-management start

chkconfig cloudstack-management on


如果发生故障,可以使用以下的命令进行重装:


service cloudstack-management stop

mysql -pKeSu1603 -e 'drop database cloud'

mysql -pKeSu1603 -e 'drop database cloud_usage'

mysql -pKeSu1603 -e 'drop database cloudbridge'

cloudstack-setup-databases cloud:KeSu1603@localhost --deploy-as=root:KeSu1603

service cloudstack-management start


CloudStack Agent(2014-11-22)

echo "127.0.0.1 vs3.ksc.org localhost" > /etc/hosts

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

sed -i 's/ONBOOT=no/ONBOOT=yes/' /etc/sysconfig/network-scripts/ifcfg-eth0

setenforce 0

yum install ntp -y

service ntpd start

chkconfig ntpd on

touch /etc/yum.repos.d/cloudstack.repo

echo "[cloudstack]" >> /etc/yum.repos.d/cloudstack.repo

echo "name=cloudstack" >> /etc/yum.repos.d/cloudstack.repo

echo "baseurl=http://cloudstack.apt-get.eu/rhel/4.4/" >> /etc/yum.repos.d/cloudstack.repo

echo "enabled=1" >> /etc/yum.repos.d/cloudstack.repo

echo "gpgcheck=0" >> /etc/yum.repos.d/cloudstack.repo

service iptables stop

yum -y install cloudstack-agent

echo 'vnc_listen=0.0.0.0' >> /etc/libvirt/qemu.conf

echo 'listen_tls = 0' >> /etc/libvirt/libvirtd.conf

echo 'listen_tcp = 1' >> /etc/libvirt/libvirtd.conf

echo 'tcp_port = "16509"' >> /etc/libvirt/libvirtd.conf

echo 'auth_tcp = "none"' >> /etc/libvirt/libvirtd.conf

echo 'mdns_adv = 0' >> /etc/libvirt/libvirtd.conf

echo 'LIBVIRTD_ARGS="--listen"' >> /etc/sysconfig/libvirtd

service libvirtd restart

chkconfig libvirtd on

cloudstack-setup-agent

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注