Single box OpenNebula setup

Posted on: 2017-04-24

Every once in a while I rebuild my home lab. This time I decided to choose something other than oVirt for my virtualization needs. I went with Open Nebula and I got to say I'm impressed. It is fast, has a good install routine, good docs, a good UI and just generally doesn't suck.

This post will setup a single server to be all components of an Open Nebula install. VMs hosted by it will be exposed on your normal home network with no extra security added.

Start with a fresh minimal CentOS 7 install on some hardware that supports virtualization and pick out some IPs in your home network range that you want to devote to you lab VMs and then do the following.

Create your network bridge and open up a firewall hole. Substitute your network info and devices.

yum -y install bridge-utils

vim /etc/hosts
192.168.1.105 lab.lan

vi /etc/sysconfig/network-scripts/ifcfg-lan0
DEVICE="lan0"
BOOTPROTO="static"
IPADDR="192.168.1.105"
NETMASK="255.255.255.0"
GATEWAY="192.168.1.1"
DNS1=192.168.1.1
ONBOOT="yes"
TYPE="Bridge"
NM_CONTROLLED="no"

vi /etc/sysconfig/network-scripts/ifcfg-eno1
DEVICE=eno1
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
NM_CONTROLLED=no
BRIDGE=lan0

firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.0.0/16" accept' --permanent

firewall-cmd --reload
systemctl restart network

Do some system config. Do updates. Add repos. Install software.

vi /etc/selinux/config
SELINUX=disabled

cat << EOT > /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

yum -y install epel-release

yum -y update
reboot

yum -y install opennebula-server opennebula-sunstone opennebula-ruby opennebula-gate opennebula-flow opennebula opennebula-node-kvm opennebula-common nmap-ncat vim lsof screen net-tools telnet rsync

/usr/share/one/install_gems
1. CentOS/RedHat/Scientific
 Press enter to continue...

Set password. Start the services. Test the GUI

su - oneadmin
echo "oneadmin:test1234" > ~/.one/one_auth

ssh lab.lan #should get in without a password
Are you sure you want to continue connecting (yes/no)? yes

exit
exit

systemctl enable opennebula
systemctl start opennebula
systemctl enable opennebula-sunstone
systemctl start opennebula-sunstone
systemctl enable libvirtd
systemctl restart libvirtd

http://IP:9869 oneadmin/test1234

Configure networking, add a host and a user.

Network > Virtual Networks  > + 
General> 
    Name: lan0
Conf >
    Bridge: lan0
    mode:  Bridge
Addresses > IPv4 #put your info
    First: 192.168.1.200
    Size: 50
Context #user your info
    Network address: 192.168.1.0
    Gateway: 192.168.1.1
    DNS: 192.168.1.1
    Network mask: 255.255.255.0
    MTU: 1400
Create

Infrastructure > Hosts > +
    hostname: lab.lan 
Create
Refresh until Status = ON

System > Users > +
    username: dminnich
    password, confirm: test1234
Create

System > Groups > users > update
    User view > Group Users
Update

Login as your new user and create a VM

oneadmin > sign out
dminnich / test1234

dminnich > settings > add SSH key 
paste in your ssh-key from your client machine. ssh-keygen if you don't have one.

dminnich > views > user
    Storage > Apps > Check Debian 8 KVM
    OpenNebula
    Select default datastore
    Download

dminnich > views > cloud
    VMs > + > Debian 8 
    Network > lan0
    Create

Testing

Wait for the VM status to go green.
ssh root@ip. From the box that has your ssh-key

References: http://docs.opennebula.org/5.2/deployment/index.html