天天看點

CloudStack 4.4+KVM之KVM計算節點安裝 二、KVM計算節點安裝

CloudStack 4.4+KVM之管理伺服器安裝   

http://koumm.blog.51cto.com/703525/1558660

CloudStack 4.4+KVM之KVM計算節點安裝    

http://koumm.blog.51cto.com/703525/1558670    

CloudStack 4.4+KVM之CloudStack配置過程    

http://koumm.blog.51cto.com/703525/1558683    

CloudStack 4.4+KVM之通過ISO檔案建立CentOS虛拟機

http://koumm.blog.51cto.com/703525/1564958

CloudStack 4.4+KVM之虛拟機模闆建立

http://koumm.blog.51cto.com/703525/1565551

CloudStack 4.4+KVM之虛拟機線上動态遷移

http://koumm.blog.51cto.com/703525/1565556

本文出自:http://koumm.blog.51cto.com

二、KVM計算節點安裝

1. 修改主機名

在hosts中增加

1 2 3 4

# vi /etc/hosts 

192.168.10.190 node01.abc.com 

# vi /etc/sysconfig/network 

HOSTNAME=node01.abc.com

2. 關閉SELINUX設定

1 2

# vi /etc/selinux/config 

SELINUX=disabled

3. 關閉防火牆

1 2

# service iptables stop 

# chkconfig iptables off

4. 直接同步網際網路時間伺服器

1 2

# crontabc -e 

01 *

/3

* * * 

/usr/sbin/ntpdate

ntp.fudan.edu.cn

5. 配置系統YUM源

1)配置163 CentOS系統安裝源

1 2 3

# cd /etc/yum.repos.d/ 

# mv *.repo ../ 

# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

2)添加cloudstack軟體包的官方源

1 2 3 4 5 6 7 8 9

# vi /etc/yum.repos.d/cloudstack.repo

[cloudstack] 

name=cloudstack 

baseurl=http:

//cloudstack

.apt-get.eu

/rhel/4

.4/ 

enabled=1 

gpgcheck=0

# yum clean all 

# yum makecache 

# yum repolist

6. 安裝cloudstack agent

1

# yum -y install cloudstack-agent

7. 安裝KVM虛拟化環境

1)要支援KVM

1 2 3

# egrep '(vmx|svm)' --color=always /proc/cpuinfo

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq vmx ssse3 cx16 sse4_1 sse4_2 popcnt xsave hypervisor lahf_lm arat epb xsaveopt pln pts dts tpr_shadow vnmi ept vpid 

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperf unfair_spinlock pni pclmulqdq vmx ssse3 cx16 sse4_1 sse4_2 popcnt xsave hypervisor lahf_lm arat epb xsaveopt pln pts dts tpr_shadow vnmi ept vpid

2)安裝KVM軟體包

1

# yum -y install kvm python-virtinst libvirt tunctl bridge-utils virt-manager qemu-kvm-tools virt-viewer virt-v2v libguestfs-tools

3)配置QEMU

1 2 3

# vi /etc/libvirt/qemu.conf

# 去掉其注釋 

vnc_listen=0.0.0.0

4) 配置Libvirt

1 2 3 4 5 6

# vi /etc/libvirt/libvirtd.conf

listen_tls = 0 

listen_tcp = 1 

tcp_port = 

"16509"

auth_tcp = 

"none"

mdns_adv = 0

1 2 3 4 5

# vi /etc/sysconfig/libvirtd

取消如下行的注釋:

LIBVIRTD_ARGS=

"--listen"

# service libvirtd restart 

# chkconfig libvirtd on

5) 配置agent

1 2 3

# vi /etc/cloudstack/agent/agent.properties 

# cloudstack管理伺服器位址 

host=192.168.10.185

6) 配置nfs域名

1 2

# vi /etc/idmapd.conf 

Domain = abc.com

8. 配置橋接網絡   \\我測試時初始化cloudstack-agent時系統會自動建立橋接網卡,是以其實這步用不到

1)建立橋接網卡配置檔案

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

[[email protected] ~]

# cd /etc/sysconfig/network-scripts 

[[email protected] ~]

# cp ifcfg-eth0 ifcfg-cloudbr0 

[[email protected] ~]

# cat ifcfg-eth0 

DEVICE=eth0 

TYPE=Ethernet 

ONBOOT=

yes

NM_CONTROLLED=

yes

BOOTPROTO=none 

HWADDR=00:0c:29:21:27:ea 

IPADDR=192.168.10.190 

PREFIX=24 

GATEWAY=192.168.10.254 

DNS1=202.100.192.68 

DEFROUTE=

yes

IPV4_FAILURE_FATAL=

yes

IPV6INIT=no 

NAME=

"System eth0"

BRIDGE=cloudbr0

1 2 3 4 5 6 7 8 9 10 11 12 13

[[email protected] ~]

# cat /etc/sysconfig/network-scripts/ifcfg-cloudbr0 

DEVICE=cloudbr0 

TYPE=Bridge 

ONBOOT=

yes

NM_CONTROLLED=

yes

BOOTPROTO=static 

IPADDR=192.168.10.190 

PREFIX=24 

GATEWAY=192.168.10.254 

DNS1=202.100.192.68 

DEFROUTE=

yes

IPV4_FAILURE_FATAL=

yes

IPV6INIT=no

2)重新開機網絡服務

1

# service network restart

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

# ifconfig 

cloudbr0 Link encap:Ethernet HWaddr 00:0C:29:1D:8A:F0 

inet addr:192.168.10.190 Bcast:192.168.10.255 Mask:255.255.255.0 

inet6 addr: fe80::20c:29ff:fe1d:8af0

/64

Scope:Link 

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 

RX packets:60 errors:0 dropped:0 overruns:0 frame:0 

TX packets:22 errors:0 dropped:0 overruns:0 carrier:0 

collisions:0 txqueuelen:0 

RX bytes:4294 (4.1 KiB) TX bytes:2752 (2.6 KiB)

eth0 Link encap:Ethernet HWaddr 00:0C:29:1D:8A:F0 

inet6 addr: fe80::20c:29ff:fe1d:8af0

/64

Scope:Link 

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 

RX packets:312744 errors:0 dropped:0 overruns:0 frame:0 

TX packets:56830 errors:0 dropped:0 overruns:0 carrier:0 

collisions:0 txqueuelen:1000 

RX bytes:447680883 (426.9 MiB) TX bytes:4767893 (4.5 MiB)

lo Link encap:Local Loopback 

inet addr:127.0.0.1 Mask:255.0.0.0 

inet6 addr: ::1

/128

Scope:Host 

UP LOOPBACK RUNNING MTU:16436 Metric:1 

RX packets:4 errors:0 dropped:0 overruns:0 frame:0 

TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 

collisions:0 txqueuelen:0 

RX bytes:240 (240.0 b) TX bytes:240 (240.0 b)

virbr0 Link encap:Ethernet HWaddr 52:54:00:2D:AD:E4 

inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0 

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 

RX packets:0 errors:0 dropped:0 overruns:0 frame:0 

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 

collisions:0 txqueuelen:0 

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

9. 初始化cloudstack-agent

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

# cloudstack-setup-agent

Stopping Cloud Agent: 

Starting Cloud Agent: 

[[email protected] network-scripts]

# cloudstack-setup-agent 

Welcome to the CloudStack Agent Setup: 

Please input the Management Server Hostname

/IP-Address

:[192.168.10.185] 

Please input the Zone Id:[default] 

Please input the Pod Id:[default] 

Please input the Cluster Id:[default] 

Please choose 

which

network used to create VM:[cloudbr0]  \\應該是eth0,cloudbr0是系統将要建立的

Starting to configure your system: 

Configure Cgroup ... [OK] 

Configure SElinux ... [OK] 

Configure Network ... [OK] 

Configure Libvirt ... [OK] 

Configure Firewall ... [OK] 

Configure Nfs ... [OK] 

Configure cloudAgent ... [OK] 

CloudStack Agent setup is 

done

!

1 2 3

# service cloudstack-agent restart 

Stopping Cloud Agent: 

Starting Cloud Agent:

1 2 3

# service libvirtd restart 

# /etc/init.d/cloudstack-agent status 

cloudstack-agent (pid 13952) is running...

[[email protected] ~]# /etc/init.d/cloudstack-agent status 

cloudstack-agent 已死,但是 subsys 被鎖

我啟動該服務時會提示報如上錯誤,但似乎不影響正常使用,是以初始化成功後沒有再去理會這個問題

排錯日志檢視位址:   

1 2

# tail -f /var/log/cloudstack/agent/cloudstack-agent.out 

2014-08-21 10:04:29,768{GMT} INFO [cloud.agent.AgentShell] (main:) Agent started

10. 按此配置安裝node02,這裡略過配置過程。

本文出自 “koumm的linux技術部落格” 部落格,請務必保留此出處http://koumm.blog.51cto.com/703525/1558670