一、介绍

OpenNebula 是一款为云计算而打造的开源工具箱。它允许你和 XenKVM  VMwareESX 一起建立和管理私有云, 同时还提供 Deltacloud 适配器与 Amazon EC2 相配合来管理混合云。

 

二、简单拓扑

openNebula 搭建_openNebula

     

三、安装

1、检查是否支持虚拟化:

grep -E 'svm|vmx' /proc/cpuinfo

2、环境设置:

Frond-end192.168.137.100

Node:     192.168.137.101

关闭防火墙:

# vi /etc/sysconfig/selinux

SELINUX=disabled

然后reboot

安装epel源:

yum install epel-release

设置yum源:

cat << EOT > /etc/yum.repos.d/opennebula.repo

[opennebula]

name=opennebula

baseurl=http://downloads.opennebula.org/repo/4.8/CentOS/7/x86_64/

enabled=1

gpgcheck=0

EOT

 4、安装:

yum install opennebula-server opennebula-sunstone –y

运行 install_gems 安装所有依赖:

# /usr/share/one/install_gems

 

0. Ubuntu/Debian

1. CentOS/RedHat

2. SUSE

(选择服务器版本)

 5、配置

修改OpenNebula守护进程ip

vi /etc/one/sunstone-server.conf

host: 127.0.0.1 改为host: 0.0.0.0

启动服务:

# service opennebula start

# service opennebula-sunstone start

 6、设置nfs

vi /etc/exports

添加:

/var/lib/one/ *(rw,sync,no_subtree_check,root_squash)

重启服务:

systemctl resatrt nfs

查看共享的挂载目录:

systemctl resatrt nfs

openNebula 搭建_虚拟化_02

 7、设置ssh证书认证(后面Frond-end部署kvm需要用ssh服务)

     su  oneadmin

$ cat << EOT > ~/.ssh/config

Host *

        StrictHostKeyChecking no

        UserKnownHostsFile /dev/null

EOT

$ chmod 600 ~/.ssh/config

 

四、node节点安装

yum install opennebula-node-kvm –y

# systemctl start messagebus.service

# systemctl start libvirtd.service

# systemctl start nfs.service

设置网络模式为桥接:

cd  /etc/sysconfig/network-scripts

cp ifcfg-eth0 ifcfg-br0

 

vi   ifcfg-eth0

     TYPE=Ethernet

BOOTPROTO=none

NM_CONTROLLED=no

DEVICE=eth0

ONBOOT=yes

BRIDGE=br0

 

   vi ifcfg-br0

DEVICE=br0

TYPE=Bridge

ONBOOT=yes

BOOTPROTO=static

NM_CONTROLLED=no

IPADDR=192.168.137.101

NETMASK=255.255.255.0

GATEWAY=192.168.137.1

    重启服务:

    systemctl restart network.service

   挂载nfs
   vi /etc/fstab

   192.168.1.1:/var/lib/one/ /var/lib/one/  nfs  soft,intr,rsize=8192,wsize=8192,noauto

   mount –a

   df –Th(查看)

openNebula 搭建_虚拟化_03


   

访问网页:

http://192.168.137.100:9869/

 openNebula 搭建_虚拟化_04

用户与密码:

cat /var/lib/one/.one/one_auth

oneadmin:306f53c9fdf5c51242e5a498c74b671d

openNebula 搭建_openNebula_05