Centos 6.4 下 部署OpenNebula4.4

安装部署

环境说明
1
2
Front:192.168.10.101 Centos6.4 x 64 NF5120
Node1:192.168.10.102 Centos6.4 x 64 NF5120
部署OpenNebula4.4
1
2
3
4
5
6
7
8
9
10
11
12
13
下载相应版本 http://www.opennebula.org/software:software#from_official_repository_of_linux_distributions
CentOS-6-opennebula-4.4.0-1
安装Epel源
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
cd opennebula-4.4.0-1
yum -y localinstall *.rpm
Front控制器在此也作为节点使用,在计算节点上安装 kvm 和 opennebula-node-kvm:
yum localinstall opennebula-node-kvm-4.0.0-1.x86_64.rpm
yum install qemu-kvm qemu-kvm-tools libvirt
/etc/init.d/libvirtd start
以上OpenNebula的控制节点和计算节点所需软件包均以安装完,下面进行简单的配置( 事先关闭iptables和selinux,后续讲如何加固)

a. 更改Opennebula的front,即OpenNebula-sunstone服务的监听地址

1
sed -i 's#127.0.0.1#192.168.10.101#g' /etc/one/sunstone-server.conf

b. 默认会生成用户名和随机密码

1
2
3
cat /var/lib/one/.one/one_auth
oneadmin:6696d237e58221ae1eb39fdf3a01335f
访问http://192.168.10.101:9869 输入账号密码

c. 更改opennebula数据存储方式为mysql

1
2
3
4
5
6
7
8
9
10
11
12
vim /etc/one/oned.conf
修改仓库路径:
DATASTORE_BASE_PATH = /data/datastoress(注意目录权限为oneadmin)
注释DB = [ backend = "sqlite" ]
打开注释:
DB = [ backend = "mysql",
server = "localhost",
port = 0,
user = "oneadmin",
passwd = "oneadmin",
db_name = "opennebula" ]
(相关授权略)

d. 添加环境变量

1
2
3
export ONE_XMLRPC=http://localhost:2633/RPC2
export ONE_AUTH=$HOME/.one/one_auth
export PATH=$ONE_LOCATION/bin:$PATH

e. 为初次部署方便暂使用网络桥接模式
母机桥接配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
ifcfg-eth0:
DEVICE=eth0
TYPE=Ethernet
UUID=200f14a6-c347-4d4a-9564-257ccf4ebe8a
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=00:E0:81:DE:6C:CA
BRIDGE="br0"
ifcfg-br0:
DEVICE="br0"
TYPE="Bridge"
BOOTPROTO="static"
ONBOOT="yes"
IPADDR=192.168.10.102
NETMASK=255.255.240.0
DNS1=114.114.114.114
brctl show 可查询现有桥接的网络
bridge name bridge id STP enabled interfaces
br0 8000.00e081de6cca no eth0
重启网卡

f. 确定计算节点权限(Front安装时会自动配置)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/etc/libvirt/qemu.conf
user = "oneadmin"
group = "oneadmin"
dynamic_ownership = 0
/etc/libvirt/libvirtd.conf
listen_tcp = 1
listen_tls = 0
mdns_adv = 0
unix_sock_group = "oneadmin"
unix_sock_ro_perms = "0777"
unix_sock_rw_perms = "0777"
auth_unix_ro = "none"
auth_unix_rw = "none"
/etc/sysconfig/libvirtd(修改监听地址)
LIBVIRTD_ARGS="--listen"
/etc/sudoers
添加oneadmin ALL=(root)NOPASSWD:ALL
注释#Defaults requiretty
ln -s /usr/libexec/qemu-kvm /usr/bin/kvm
将Front的oneadmin的公钥拷贝到计算节点oneadmin下实现无密码认证

g .以上OpenNebula的部署已经完成,下面启动服务器进行简单操作

1
2
service OpenNebula start
service OpenNebula-sunstone start

s

坚持原创分享,您的支持将鼓励我继续创作