Centos 7安装OpenNebula,创建KVM小鸡教程

lisahost.com

OpenNebula 是一套开源的云计算基础管理工具,用来方便管理员在数据中心统一部署、创建、分配和管理大量的虚拟机,如KVM、XEN、OpenVZ VPS等。

控制端:1.1.1.1
node端:2.2.2.2

一、控制端安装(基于Centos 7系统)
1、关闭SElinux
编辑/etc/selinux/config

SELINUX=disabled

opennebula1.jpg

然后,重启

2、添加opennebula官方源

cat  /etc/yum.repos.d/opennebula.repo
[opennebula]
name=opennebula
baseurl=http://downloads.opennebula.org/repo/5.2/CentOS/7/x86_64
enabled=1
gpgcheck=0
EOT

3、安装软件
a、

yum install epel-release

b、

yum install opennebula-server opennebula-sunstone opennebula-ruby opennebula-gate opennebula-flow

安装了如下软件:
opennebula: Command Line Interface.
opennebula-server: Main OpenNebula daemon, scheduler, etc.
opennebula-sunstone: Sunstone (the GUI) and the EC2 API.
opennebula-ruby: Ruby Bindings.
opennebula-java: Java Bindings.
opennebula-gate: OneGate server that enables communication between VMs and OpenNebula.
opennebula-flow: OneFlow manages services and elasticity.
opennebula-node-kvm: Meta-package that installs the oneadmin user, libvirt and kvm.
opennebula-common: Common files for OpenNebula packages.
以上软件配置位于/etc/one 和 /var/lib/one/remotes

4、安装Ruby Runtime

/usr/share/one/install_gems

选1,然后回车执行安装:
sqlite3 development library
mysql client development library
curl development library
libxml2 and libxslt development libraries
ruby development library
gcc and g++
make

5、启动OpenNebula

a、centos 7 用户 oneadmin 登录,并修改oneadmin密码

su oneadmin

修改密码(root模式下)

passwd oneadmin

b、启动opennebula

systemctl start opennebula
systemctl start opennebula-sunstone

或者

service opennebula start
service opennebula-sunstone start

6、检查是否安装opennebula成功

oneuser show

opennebula2.jpg

OpenNebula 日志位置 /var/log/one

7、关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd –state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

8、web登录
你的服务器IP:9869
用户名:oneadmin
密码:存放在 /var/lib/one/.one/one_auth

二、node端设置 (基于centos 7)
1、添加opennebula官方源

cat  /etc/yum.repos.d/opennebula.repo
[opennebula]
name=opennebula
baseurl=http://downloads.opennebula.org/repo/5.2/CentOS/7/x86_64
enabled=1
gpgcheck=0
EOT

2、安装kvm

yum install opennebula-node-kvm
service libvirtd restart

3、关闭SElinux
编辑/etc/selinux/config

SELINUX=disabled

4、交换SSH Key
a、更改设置,以便交互SSH
因为 OpenNebula Front 和 Nodes 之间是通过 SSH 通讯的,所以 front 和 nodes 之间要设置成 SSH 无密码登录避免 front 运行 node 上脚本或克隆镜像的时候输入密码,首先在 front 和 nodes 上配置 sshd(大约在47、48行):

vi /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
/etc/init.d/sshd restart

opennebula3.jpg

b、创建交互SSH
控制端操作:

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub 2.2.2.2

node端操作:

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub 1.1.1.1

或者

scp -rp /var/lib/one/.ssh :/var/lib/one/
scp -rp /var/lib/one/.ssh :/var/lib/one/
scp -rp /var/lib/one/.ssh :/var/lib/one/

c、创建网络桥接

官方教程http://docs.opennebula.org/

    所有主机信息仅是为及时分享并收录,不做推荐!