CloudStack安装
1.修改IP
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
BROADCAST=192.168.75.255
IPADDR=192.168.75.111
GATEWAY=192.168.75.2
NETMASK=255.255.255.0
HWADDR=00:0C:29:95:53:18
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
2.修改计算机名
vi /etc/hosts
192.168.75.111 server1 server1.smartmap
-------------------------------------------
vi /etc/sysconfig/network
HOSTNAME=server1.smartmap
3.配置时间同步
yum install ntp
4.修改Linux安全设置
vi /etc/selinux/config
SELINUX=permissive
setenforce permissive
5.更新yum仓库
vi /etc/yum.repos.d/cloudstack.repo
[cloudstack]
name=cloudstack
baseurl=http://cloudstack.apt-get.eu/rhel/4.1/
enabled=1
gpgcheck=0
6.安装管理节点
yum install cloud-client
7.配置数据库
yum install mysql-server
vi /etc/my.cnf
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format='ROW'
[mysql]
default-character-set=utf8
symbolic-links=0
innodb_rollback_on_timeout=100
innodb_lock_wait_timeout=60000
max_connections=1000
log-bin=mysql-bin
binlog-format='ROW'
[mysqld]
character_set_server=utf8
wait_timeout=31536000
interactive_timeout=31536000
bind-address=0.0.0.0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_rollback_on_timeout=100
innodb_lock_wait_timeout=60000
max_connections=1000
log-bin=mysql-bin
binlog-format='ROW'
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
service mysqld start
chkconfig mysqld on
---------------------------------------------------
设置MySQL的root密码为: gis
mysql_secure_installation
----------------------------------------------------
导入CloudStack的表及基础数据
cloudstack-setup-databases cloud:123456@localhost --deploy-as=root:gis
8.安装网络存储
yum install nfs-utils
------------------------------------------------------
vi /etc/exports
/export *(rw,async,no_root_squash)
-----------------------------------------------------
mkdir -p /export/secondary
mkdir -p /export/primary
------------------------------------------------------
vi /etc/sysconfig/nfs
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
RQUOTAD_PORT=875
STATD_PORT=662
STATD_OUTGOING_PORT=2020
------------------------------------------------------
vi /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 111 -j ACCEPT
-A INPUT -p udp -m udp --dport 111 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 2049 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 32803 -j ACCEPT
-A INPUT -p udp -m udp --dport 32769 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 892 -j ACCEPT
-A INPUT -p udp -m udp --dport 892 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 875 -j ACCEPT
-A INPUT -p udp -m udp --dport 875 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 662 -j ACCEPT
-A INPUT -p udp -m udp --dport 662 -j ACCEPT
service iptables restart
iptables -X
iptables -F
iptables -Z
iptables -L
chkconfig iptables on
---------------------------------------------------------
service nfs start
service rpcbind start
chkconfig nfs on
chkconfig rpcbind on
9.导入系统虚拟机模板
---------------------------------------------------
mount 二级存储到本地硬盘
mkdir /tmp/primarymount -p
mount -t nfs 127.0.0.1:/export/primary /tmp/primarymount
mkdir /tmp/secondarymount -p
mount -t nfs 127.0.0.1:/export/secondary /tmp/secondarymount
cd /usr/share/cloudstack-common/scripts/storage/secondary/
------------------------------------------------------
下载KVM类型的虚拟机模板
./cloud-install-sys-tmplt -m /tmp/iso/ -u http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2 -h kvm -F
当然,你也可以把文件下载到本地,然后用 -f 参数导入。
./cloud-install-sys-tmplt -m /tmp/iso/ -f /root/acton-systemvm-02062012.qcow2.bz2 -h kvm -F
10.登陆WEB-UI
先初始化一下管理节点
cloudstack-setup-management
----------------------------------------------------------------------
umount /tmp/primarymount
umount /tmp/secondarymount
启动CloudStack服务:
service cloudstack-management restart
----------------------------------------------------------------------
查看下它的日志,确保它正常启动
tail -100f /var/log/cloudstack/management/catalina.out
----------------------------------------------------------------------
写入权限
chown cloud:cloud /var/log/cloudstack/ -R
http://192.168.75.111:8080/client
默认的用户名为 admin 密码是 password
--------------------------------------------------------------------
登陆后点击“基础架构”,CloudStack资源管理的功能都在“基础架构”下。
其中,“区域”可以理解为一个机房;
“提供点”可以理解为一个机架;
“群集”是机架中主机的分组管理;
“主存储”是网络存储,主要用于存放虚拟机硬盘的,当然你也可以使用本地存储;
“二级存储”也是网络存储,主要用于存在虚拟机模板、快照的。
“系统VM”是CloudStack自带的专用虚机,用于管理二级存储及远程终端。其中二级存储虚机必须正常启动模板等一干功能才可用。远程终端虚机正常启动后,才能通过WEB页面直接访问虚机控制台。
“虚拟路由器”也是CloudStack自带的专用虚机。主要用于网络隔离、端口转发等网络相关功能。
注意:CloudStack有一个全局属性来控制二级存储所在的网段。如果这个网段没配或配置的不对,将无法成功能添加上二级存储。
在 CloudStack 管理页面上,选择“全局设置”,
在右上边的搜索框中输入 sites 搜索,修改 secstorage.allowed.internal.sites 为二级存储当前网段,如 192.168.75.0/24
搜索 local,修改system.vm.use.local.storage 为 true,允许系统虚机使用本地存储。
修改后,重启 CloudStack 生效。
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
1.安装KVM相关组件
yum install kvm kmod-kvm qemu kvm-qemu-img virt-viewer virt-manager libvirt vconfig
------------------------------------------------------------------------------
vi /etc/libvirt/libvirtd.conf
listen_tls = 0
listen_tcp = 1
tcp_port = "16509"
auth_tcp = "none"
mdns_adv = 0
------------------------------------------------------------------------------
vi /etc/sysconfig/libvirtd
LIBVIRTD_ARGS="--listen"
------------------------------------------------------------------------------
vi /etc/libvirt/qemu.conf
vnc_listen = 0.0.0.0
------------------------------------------------------------------------------
现在,可以启动虚拟机服务啦:
service libvirtd restart
------------------------------------------------------------------------------
测试一下是否成功:
lsmod | grep kvm
2.安装NTP时间同步
yum install ntp
3.配置yum仓库
vi /etc/yum.repos.d/cloudstack.repo
[cloudstack]
name=cloudstack
baseurl=http://cloudstack.apt-get.eu/rhel/4.1/
enabled=1
gpgcheck=0
4.安装agent
yum install cloud-agent
5.修改安全策略
vi /etc/selinux/config
SELINUX=permissive
setenforce permissive
---------------------------------------------------------
iptables -I INPUT -p tcp -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 1798 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 16509 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 5900:6100 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 49152:49216 -j ACCEPT
iptables-save > /etc/sysconfig/iptables