CentOS6.3安裝CloudStack4.0
一、實驗環境:
主機名 IP(Static) 系統 配置 用途
cloudstack 192.168.100.69 CentOS-6.3-x86_64-minimal 2CPU,1G RAM,20G DISK,1網絡卡 管理節點
xenserver 192.168.220.70 XenServer6.1 2CPU,1G RAM,20G DISK,1網絡卡 計算節點
vmwareserver 192.168.220.71 VMware4.1 2CPU,1G RAM,20G DISK,1網絡卡 計算節點
kvmserver 192.168.220.72 CentOS-6.3-x86_64-minimal 2CPU,1G RAM,20G DISK,1網絡卡 計算節點
**********************************************************************************************
**********************************************************************************************
二、管理節點CloudStack Management安裝
1.配置hosts檔案
編輯/etc/hosts檔案,將管理節點和計算節點IP主機名的對應關係加入其中
[[email protected] ~]# vi /etc/hosts
cloudstack 192.168.100.69
xenserver 192.168.100.70
vmwareserver
kvmserver 192.168.100.72
2.關閉selinux
[[email protected] ~]# vi /etc/selinux/config
SELINUX=disabled
[[email protected] ~]# reboot
3.安裝配置NTP服務
[[email protected] ~]# yum -y install ntp
[[email protected] ~]# vi /etc/ntp.conf
找到"# server 127.127.1.0 # local clock",去掉前面的"#";
[[email protected] ~]# service ntpd restart
[[email protected] ~]# chkconfig --level 345 ntpd
4.安裝配置NFS服務
[[email protected] ~]# mkdir -p /export/primary
[[email protected] ~]# mkdir -p /export/secondary
[[email protected] ~]# yum -y install nfs-utils
[[email protected] ~]# vi /etc/exports
加入如下兩行:
/export/primary *(rw,async,no_root_squash)
/export/secondary *(rw,async,no_root_squash)
[[email protected] ~]# vi /etc/sysconfig/nfs
去掉如下幾行的"#"註釋:
RQUOTAD_PORT=875
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
STATD_PORT=662
STATD_OUTGOING_PORT=2020
[[email protected] ~]# service nfs restart
[[email protected] ~]# chkconfig --level 345 nfs on
[[email protected] ~]# service rpcbind restart
[[email protected] ~]# chkconfig --level 345 rpcbind on
[[email protected] ~]# mkdir -p /mnt/primary
[[email protected] ~]# mkdir -p /mnt/secondary
[[email protected] ~]# mount -t nfs 192.168.100.69:/export/primary /mnt/primary
[[email protected] ~]# mount -t nfs 192.168.100.69:/export/secondary /mnt/secondary
5.配置iptables:
[[email protected] ~]# /etc/sysconfig/iptables
新增如下內容:
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m udp --dport 123 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m tcp --dport 123 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m udp --dport 111 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m tcp --dport 111 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m tcp --dport 2049 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m tcp --dport 32803 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m udp --dport 32769 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m tcp --dport 892 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m udp --dport 892 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m tcp --dport 875 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m udp --dport 875 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m tcp --dport 662 -j ACCEPT
-A INPUT -s 192.168.100.69/24 -p udp -m state --state NEW -m udp --dport 662 -j ACCEPT
6.安裝配置CloudStack Management
[[email protected] ~]# ls
anaconda-ks.cfg CloudStack-non-OSS-13.tar.bz2 install.log install.log.syslog
[[email protected] ~]# tar -jxvf CloudStack-non-OSS-13.tar.bz2
[[email protected] ~]# cd CloudStack-non-OSS-13
[[email protected] CloudStack-non-OSS-13]# ./install.sh
選擇"D",安裝Mysql資料庫;
[[email protected] CloudStack-non-OSS-13]# vi /etc/my.cnf
新增紅色標記的五行內容:
[mysqld]
datadir=/var/lib/mysql
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = 'ROW'
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[[email protected] CloudStack-non-OSS-13]# service mysqld restart
[[email protected] CloudStack-non-OSS-13]# chkconfig --level 345 mysql on
[[email protected] CloudStack-non-OSS-13]# ./install.sh
選擇"M",安裝CloudStack Management;
初始化資料庫,在此Mysql root密碼為空,CloudStack 資料庫 使用者cloud,密碼password;
[[email protected] CloudStack-non-OSS-13]# cloud-setup-databases cloud:[email protected] --deploy-as=root:
啟動管理服務:
[[email protected] CloudStack-non-OSS-13]# cloud-setup-management
WEB訪問:
使用者名稱:admin
密碼:password
********************************************************************************
新增系統映象檔案:
[[email protected] ~]# mkdir /vmfile
[[email protected] ~]# cd /vmfile
[[email protected] vmfile]# wget http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2
[[email protected] vmfile]# /usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary/ -f /vmfile/acton-systemvm-02062012.vhd.bz2-h xenserver -F
日誌記錄:
[[email protected] ~]# tail -f /var/log/cloud/management/management-server.log
********************************************************************************