CloudStack的3.0版本和4.4版本的命令和目錄有很大的區別。node
下面的命令,標註部分爲3.0和4.4的區別,其餘的不變。mysql
主機名: 【cloud-server.perofu.com】linux
ip: 【172.22.2.76】web
hostname cloud-server.perofu.comsql vi /etc/sysconfig/network數據庫 HOSTNAME=cloud-server.perofu.com vi /etc/hosts安全 127.0.0.1 cloud-server.perofu.com服務器 172.22.2.76 cloud-server.perofu.com網絡 172.22.2.87 cloud-agent-1.perofu.com 172.22.2.100 cloud-agent-2.perofu.com |
vi /etc/sysconfig/selinux SELINUX=disabled setenforce 0 yum install ntpdate -y echo '#ntpd' >> /var/spool/cron/root echo "10 5 * * * /usr/sbin/ntpdate ntp.api.bz &> /dev/null" >> /var/spool/cron/root echo '' >> /var/spool/cron/root service ntpd stop chkconfig ntpd off /usr/sbin/ntpdate ntp.api.bz &> /dev/null |
這裏將mysql單獨拿出來安裝,用的是光盤的yum源,能夠節省資源,固然你們可使用Cloudstack的安裝腳本進行安裝,同樣的效果。
yum install openssl-devel mysql-server mysql-devel -y cp -a /usr/share/doc/mysql-server-5.1.66/my-medium.cnf /etc/my.cnf 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 /etc/init.d/mysqld start chkconfig mysqld on /usr/bin/mysql_secure_installation #配置mysql安全,可直接全選Y |
V4.4
vi /etc/yum.repos.d/cloudstack.repo [cloudstack] name=cloudstack baseurl=http://cloudstack.apt-get.eu/rhel/4.4/ enabled=1 gpgcheck=0 yum -y install cloudstack-management httpd |
V3.0
tar -axf CloudStack-oss-3.0.2-1-rhel6.2.tar.gz -C /usr/local/src/ cd /usr/local/src/CloudStack-oss-3.0.2-1-rhel6.2/ ./install.sh M |
「M」------> 安裝 Management Server 軟件。
「D」------> 安裝 MySQL。
V4.4
cloudstack-setup-databases cloud:dbpassword@localhost --deploy-as=root:password |
[root@cloud-server ~]# cloudstack-setup-databases cloud:123456@localhost --deploy-as=root:123456 |
V3.0
cloud-setup-databases cloud:dbpassword@localhost --deploy-as=root:password |
注:即表示以 root 用戶身份來生成數據庫,該數據庫屬於新建的 cloud 用戶(密碼 dbpassword 能夠留空)。
[root@cloud-server ~]# cloud-setup-databases cloud:123456@localhost --deploy-as=root:123456 Mysql user name:cloud [ OK ] Mysql user password:123456 [ OK ] Mysql server ip:localhost [ OK ] Mysql server port:3306 [ OK ] Mysql root user name:root [ OK ] Mysql root user password:123456 [ OK ] Checking Cloud database files ... [ OK ] Checking local machine hostname ... [ OK ] Checking SELinux setup ... WARNING: We detected that your SELinux is not configured in permissive. to make sure cloudstack won't block by SELinux after system reboot, we strongly suggest you setting it in permissive in /etc/selinux/config, then reboot the machine. [ OK ] Detected local IP address as 172.22.2.76, will use as cluster management server node IP[ OK ] Preparing /etc/cloud/management/db.properties [ OK ] Applying /usr/share/cloud/setup/create-database.sql [ OK ] Applying /usr/share/cloud/setup/create-schema.sql [ OK ] Applying /usr/share/cloud/setup/create-database-premium.sql [ OK ] Applying /usr/share/cloud/setup/create-schema-premium.sql [ OK ] Applying /usr/share/cloud/setup/server-setup.sql [ OK ] Applying /usr/share/cloud/setup/templates.sql [ OK ] Applying /usr/share/cloud/setup/create-index-fk.sql [ OK ] Processing encryption ... [ OK ] Finalizing setup ... [ OK ]
CloudStack has successfully initialized database, you can check your database configuration in /etc/cloud/management/db.properties |
/etc/cloud/management/db.properties存放CloudStack數據庫的相關信息。
對操做系統 iptables、sudoers 的設置(CloudStack 自己有安全性方面的要求,不是無限暴露給網絡,同時又須要一些管理權限來運行自身服務,所以要作這兩項的設置)。
V4.4
/etc/init.d/httpd start chkconfig httpd on cloudstack-setup-management /etc/init.d/cloudstack-management start chkconfig cloudstack-management on |
V3.0
cloud-setup-management /etc/init.d/cloud-management start chkconfig cloud-management on |
[root@cloud-server ~]# cloud-setup-management Starting to configure CloudStack Management Server: Configure sudoers ... [OK] Configure Firewall ... [OK] Configure CloudStack Management Server ...[OK] CloudStack Management Server setup is Done! |
manager的日誌文件:/var/log/cloud/management/management-server.log
前面講過,CloudStack 須要兩類存儲(primary storage 和 secondary storage)來支持它的 cluster 和 host,本節中由 NFS 來提供這兩個存儲,所以前述步驟中要啓動 NFS 服務。同時爲了方便起見,NFS Server 也由 cloud-server.perofu.com 充當。
yum install nfs-utils -y mkdir -p /data/{primary,secondary} #建立兩個目錄,分別做爲一級和二級存儲 chmod 777 /data/* vi /etc/exports /data/primary *(rw,fsid=1,async,no_root_squash,no_subtree_check) /data/secondary *(rw,fsid=2,async,no_root_squash,no_subtree_check) exportfs -a #導出/data 目錄 cp /etc/sysconfig/nfs /etc/sysconfig/nfs.bak > /etc/sysconfig/nfs vi /etc/sysconfig/nfs #用於iptables LOCKD_TCPPORT=32803 LOCKD_UDPPORT=32769 MOUNTD_PORT=892 RQUOTAD_PORT=875 STATD_PORT=662 STATD_OUTGOING_PORT=2020 vi /etc/sysconfig/iptables #加入到全部INPUT以前,也能夠關閉iptables -A INPUT -m state --state NEW -p udp --dport 111 -j ACCEPT -A INPUT -m state --state NEW -p tcp --dport 111 -j ACCEPT -A INPUT -m state --state NEW -p tcp --dport 2049 -j ACCEPT -A INPUT -m state --state NEW -p tcp --dport 32803 -j ACCEPT -A INPUT -m state --state NEW -p udp --dport 32769 -j ACCEPT -A INPUT -m state --state NEW -p tcp --dport 892 -j ACCEPT -A INPUT -m state --state NEW -p udp --dport 892 -j ACCEPT -A INPUT -m state --state NEW -p tcp --dport 875 -j ACCEPT -A INPUT -m state --state NEW -p udp --dport 875 -j ACCEPT -A INPUT -m state --state NEW -p tcp --dport 662 -j ACCEPT -A INPUT -m state --state NEW -p udp --dport 662 -j ACCEPT service iptables restart service iptables save vi /etc/idmapd.conf #管理服務器(cloud-server.perofu.com)和 hypervisor都要 Domain = perofu.com service rpcbind restart service nfs restart mkdir /tmp/primarymount mount -t nfs 172.22.2.76:/data/primary /tmp/primarymount #測試可否掛載,iptables umount /tmp/primarymount/ service rpcbind restart service nfs restart chkconfig nfs on chkconfig rpcbind on |
[root@cloud-server ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup-lv_root 19G 1.7G 16G 10% / tmpfs 116M 0 116M 0% /dev/shm /dev/sda1 485M 32M 428M 7% /boot /dev/sr0 4.1G 4.1G 0 100% /mnt 172.22.2.76:/data/primary 19G 1.7G 16G 10% /tmp/primarymount |
系統虛擬機模板按要求要存放在輔助存儲上的,咱們能夠先手動掛載nfs輔助存儲, 而後把290M KVM虛擬化模板先下載到輔助存儲目錄下,而後在導入, 導入系統虛擬機模板步是必需要配置的內容。本例採用KVM虛擬化,下載導入KVM虛擬機模板。
1)、在management上掛載輔助存儲;
2)、下載kvm模板,並上傳到輔助存儲;
3)、導入。
systemvm64template-4.4.0-6-kvm.qcow2.bz2模板文件有點大,最好是經過別的下載工具進行下載,如百度網盤的離線下載,再上傳使用。
在management上操做。
V4.4
/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /tmp/secondarymount -f systemvm64template-4.4.0-6-kvm.qcow2.bz2 -h kvm -F |
V3.0
mkdir /tmp/secondarymount mount -t nfs 172.22.2.76:/data/secondary /tmp/secondarymount cd /tmp/secondarymount wget http://cloudstack.apt-get.eu/systemvm/4.4/systemvm64template-4.4.0-6-kvm.qcow2.bz2 /usr/lib64/cloud/agent/scripts/storage/secondary/cloud-install-sys-tmplt -m /tmp/secondarymount -f systemvm64template-4.4.0-6-kvm.qcow2.bz2 -h kvm -F |
系統虛擬機默認用戶名密碼:root/6m1ll10n
[root@cloud-server ~]# mkdir /tmp/secondarymount [root@cloud-server ~]# mount -t nfs 172.22.2.76:/data/secondary /tmp/secondarymount [root@cloud-server ~]# cd /tmp/secondarymount [root@cloud-server secondarymount]# rz rz waiting to receive. Starting zmodem transfer. Press Ctrl+C to cancel. 100% 296844 KB 6184 KB/s 00:00:48 0 Errorss2...
[root@cloud-server secondarymount]# pwd /tmp/secondarymount [root@cloud-server secondarymount]# [root@cloud-server secondarymount]# ll total 296848 -rw-r--r--. 1 root root 303968528 Sep 29 03:17 systemvm64template-4.4.0-6-kvm.qcow2.bz2 [root@cloud-server secondarymount]# /usr/lib64/cloud/agent/scripts/storage/secondary/cloud-install-sys-tmplt -m /tmp/secondarymount -f systemvm64template-4.4.0-6-kvm.qcow2.bz2 -h kvm -F Uncompressing to /usr/lib64/cloud/agent/scripts/storage/secondary/6e1d6d0d-8768-48b9-87af-44a182427c8c.qcow2.tmp (type bz2)...could take a long time Moving to /tmp/secondarymount/template/tmpl/1/3///6e1d6d0d-8768-48b9-87af-44a182427c8c.qcow2...could take a while Successfully installed system VM template systemvm64template-4.4.0-6-kvm.qcow2.bz2 to /tmp/secondarymount/template/tmpl/1/3/ [root@cloud-server secondarymount]# |
http://172.22.2.76:8080/client/
默認用戶名和密碼爲admin, password
V4.4
V3.0
service cloudstack-management stop |
mysql>drop database cloud; mysql>drop database cloud_usage; mysql>drop database cloudbridge; mysql>\q |
詳見初始化CloudStack數據庫部分。
詳見導入虛擬機模板部分。
service cloudstack-management start |
這時,你再登錄就會發現一個全新的CloudStack啦。
到此,CloudStack Management就安裝完成了,下節進入CloudStack Agent與KVM的安裝。