Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install VirtEngine Ubuntu 16.04 & OpenNebula 5.6
Information:
[VirtEngine Website](https://virtengine.com)
[Public Cloud.tc Multi-Provider](https://cloud.tc)
[VirtEngine Installation](https://docs.virtengine.com)
[OpenNebula 5.6 Installation](https://docs.opennebula.org/5.6/deployment/node_installation/kvm_node_installation.html)
# Prep System:
apt-get update
apt-get install -y software-properties-common
sudo apt-get install -y apt-transport-https
# OS: Ubuntu 16.04
# The following commands are used to install VirtEngine:
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get -y install openjdk-8-jre-headless
sudo apt-add-repository "deb [arch=amd64] http://get.virtengine.com/repo/1.5.2/ubuntu/16.04/stable xenial stable"
sudo apt-get -y update
sudo apt-get -y install ruby2.3 ruby2.3-dev
# Two methods of installing cassandra, Datastax & Apache
# 1
sudo echo "deb http://debian.datastax.com/datastax-ddc 3.9 main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
sudo curl -L https://debian.datastax.com/debian/repo_key | sudo apt-key add -
sudo apt-get -y install python-pip
sudo apt-get update
sudo apt-get -y install datastax-ddc
pip install cassandra-driver
# 2 (RECOMMENDED METHOD) 3.11 instead of 3.9
echo "deb http://www.apache.org/dist/cassandra/debian 311x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl https://www.apache.org/dist/cassandra/KEYS | sudo apt-key add -
sudo apt-get update
sudo apt-get install cassandra
# Install VirtEngine
export MEGAM_HOME="/var/lib/detio/"
sudo apt-get -y --allow-unauthenticated install virtenginenilavu virtenginegateway nsqd virtengine virtenginevnc
# Prepare Cassandra
wget https://raw.githubusercontent.com/VirtEngine/gateway/1.5.2/db/base.cql
cqlsh -f base.cql
# Modify cassandra.yaml in /etc/cassandra/ -> authenticator: PasswordAuthenticator, authorizer -> CassandraAuthorizer
nano /etc/cassandra/cassandra.yaml
service cassandra restart
wget https://raw.githubusercontent.com/VirtEngine/gateway/1.5.2/db/1.5.cql
wget https://raw.githubusercontent.com/VirtEngine/gateway/1.5.2/db/1.5.1.cql
wget https://raw.githubusercontent.com/VirtEngine/gateway/1.5.2/db/1.5.2.cql
wget https://raw.githubusercontent.com/VirtEngine/gateway/1.5.2/db/ee.cql
cqlsh -u vertadmin -p vertadmin -f 1.5.cql
cqlsh -u vertadmin -p vertadmin -f 1.5.1.cql
cqlsh -u vertadmin -p vertadmin -f 1.5.2.cql
cqlsh -u vertadmin -p vertadmin -f ee.cql
# Setup assets
export MEGAM_HOME="/var/lib/detio/"
cd /var/www/virtenginenilavu
bundle exec rake assets:precompile RAILS_ENV=production
sudo sv restart unicorn
#Here you might encounter an error with vendor not being able to create a map, this in return leaves the vendor file saved as _vendor inside /var/www/virtenginenilavu/public/assets/_vendor-HASHCODE.js
#You must rename it from _vendor-*.js -> vendor-*.js
# Start VirtEngine
sudo systemctl start nsqd
sudo systemctl start nsqadmin
sudo systemctl start nsqlookupd
sudo systemctl start virtenginegateway
sudo systemctl start virtenginevnc
sudo systemctl start virtengine
sudo service nginx stop
sudo sv start nginx
sudo sv start unicorn
# Create Admin Account
rake admin:create
-> Enter details of Admin Account to create.
# Restart VirtEngine
sudo sv restart unicorn
sudo systemctl restart nsqd
sudo systemctl restart nsqadmin
sudo systemctl restart nsqlookupd
sudo systemctl restart virtenginegateway
sudo systemctl restart virtenginevnc
sudo systemctl restart virtengine
sudo systemctl restart opennebula
sudo systemctl restart opennebula-sunstone
# Debug VirtEngine
journalctl -u virtenginegateway > /var/log/detio/virtenginegateway.log
journalctl -u virtengine > /var/log/detio/virtengine.log
#in VM
journalctl -u verticegulpd > /var/log/megam/gulpd.log
# Setup Front-End OpenNebula - Instructions for 5.6 Blue Flash - for 5.4 Medusa change '5.6' -> '5.4':
https://docs.opennebula.org/5.6/deployment/opennebula_installation/frontend_installation.html#
Follow instructions to install OpenNebula-Node + Master
wget -q -O- https://downloads.opennebula.org/repo/repo.key | apt-key add -
(Ubuntu 16.04)
echo "deb https://downloads.opennebula.org/repo/5.6/Ubuntu/16.04 stable opennebula" > /etc/apt/sources.list.d/opennebula.list
apt-get update
apt-get install -y opennebula opennebula-sunstone opennebula-gate opennebula-flow
/usr/share/one/install_gems
sudo apt-get install -y mysql-server
# Setup MySQL (Optional, better performance)
mysql -u root -p
GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin' IDENTIFIED BY 'YOUR_PASS';
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
exit
nano /etc/one/oned.conf
# Replace DB = SQLITE -> MYSQL
### BE very careful with changing pass. If the installation automatically started opennebula
# THEN DO NOT RUN THIS COMMAND
# Change pass of oneadmin -> Only run this prior to starting OpenNebula
sudo su oneadmin
echo "oneadmin:mypassword" > ~/.one/one_auth
exit
#To get password:
cat /var/lib/one/.one/one_auth
oneadmin:password
# Back to root & start opennebula
systemctl start opennebula
systemctl start opennebula-sunstone
# Setup Compute OpenNebula (Can be run in the same node)
https://docs.opennebula.org/5.4/deployment/node_installation/index.html
sudo apt-get install opennebula-node
sudo service libvirt-bin restart # ubuntu
# Connect SSH-keyless between front-end and nodes..
sudo su oneadmin
cd ~/.ssh
cp id_rsa.pub authorized_keys
ssh oneadmin@localhost
exit -> goes to oneadmin
exit -> goes to root
#Test OpenNebula deployment
oneuser show
#Login to OpenNebula Admin Area
http://SERVER_IP:9869
# If it doesn't load then:
nano /etc/one/sunstone-server.conf
#Change :host: 127.0.0.1 -> :host: SERVER_IP or 0.0.0.0
systemctl restart opennebula-sunstone
#Still doesn't work OR installed wrong version? wanna reinstall opennebula:
rm -rf /var/lib/one
rm -rf /usr/lib/one
rm -rf /etc/one/
sudo apt-get purge --auto-remove opennebula opennebula-sunstone opennebula-gate opennebula-flow
userdel oneadmin
#Install again - make sure you add new repository if you installed wrong version
sudo apt-get install opennebula opennebula-sunstone opennebula-gate opennebula-flow
# Show bridges (you need to create one if there isn't a bridge to main port)
brctl show
# Configuire OpenNebula
mkdir /virtengine
cd /virtengine
wget https://virtenginepub.blob.core.windows.net/gulpd/init.sh
chmod 755 /virtengine/init.sh
# Modify init.sh so that it can connect to VirtEngine API's (you can find settings around the bottom)
# under [meta]
# vertice_api = # Change to VirtEngine API Location: port 9000
# nsqd = # Change to VirtEngine NSQD Location: port 4150
# everything below these settings is updated in the VM Automatically in Deployment.
# such as api key, account id, assembly id, and hostname.
nano /etc/one/oned.conf
Ctrl + _ (Line 711)
VM_HOOK = [
name = "poweroff_hook",
on = "CUSTOM",
state = "ACTIVE",
lcm_state = "SHUTDOWN_POWEROFF",
command = "hook_virtengine.rb",
arguments = "$ID $TEMPLATE poweroff stopped" ]
VM_HOOK = [
name = "delete_hook",
on = "DONE",
command = "hook_virtengine.rb",
arguments = "$ID $TEMPLATE destroyed destroyed" ]
VM_HOOK = [
name = "suspend_hook",
on = "CUSTOM",
state = "SUSPENDED",
lcm_state = "LCM_INIT",
command = "hook_virtengine.rb",
arguments = "$ID $TEMPLATE suspended suspended" ]
VM_HOOK = [
name = "boot_suspend_hook",
on = "CUSTOM",
state = "BOOT_SUSPENDED",
lcm_state = "RUNNING",
command = "hook_virtengine.rb",
arguments = "$ID $TEMPLATE running running" ]
VM_HOOK = [
name = "running_hook",
on = "CUSTOM",
state = "ACTIVE",
lcm_state = "RUNNING",
command = "hook_virtengine.rb",
arguments = "$ID $TEMPLATE running running" ]
VM_HOOK = [
name = "snapshots_hook",
on = "CUSTOM",
state = "ACTIVE",
lcm_state = "DISK_SNAPSHOT",
command = "hook_backup_snapshot.rb",
arguments = "$ID $TEMPLATE snapshots snapshots" ]
VM_HOOK = [
name = "backups_hook",
on = "CUSTOM",
state = "ACTIVE",
lcm_state = "HOTPLUG_SAVEAS",
command = "hook_backup_snapshot.rb",
arguments = "$ID $TEMPLATE backups backups" ]
wget https://raw.githubusercontent.com/VirtEngine/gitpackager/master/support/hook_virtengine.rb
cp hook_virtengine.rb /var/lib/one/remotes/hooks
chmod 755 /var/lib/one/remotes/hooks/hook_virtengine.rb
chown oneadmin:oneadmin /var/lib/one/remotes/hooks/hook_virtengine.rb
Create master_key in /var/lib/detio/:
#If you want to modify the master key, you must modify the gateway configuiration file and set your own master key (recommended in production) - /var/lib/detio/virtenginegateway/gateway.conf
cat >/var/lib/detio/master_key << EOF
host=http://YOUR_IP:9000/v2
masterkey=3b8eb672aa7c8db82e5d34a0744740b20ed59e1f6814cfb63364040b0994ee3f
EOF
# Download images to OpenNebula Data Store:
# Missing but will be uploaded soon:
# Centos 6.8
# Windows 2012
# Windows 2008
# Freebsd
wget the folllowing images to /var/tmp/images
wget https://virtenginepub.blob.core.windows.net/iso/centos.tar.gz
wget https://virtenginepub.blob.core.windows.net/iso/coreos_latest.tar.gz
wget https://virtenginepub.blob.core.windows.net/iso/debian.tar.gz
wget https://virtenginepub.blob.core.windows.net/iso/dockermachine.tar.gz
wget https://virtenginepub.blob.core.windows.net/iso/fedora.tar.gz
wget https://virtenginepub.blob.core.windows.net/iso/ubuntu_16.04.tar.gz
wget https://virtenginepub.blob.core.windows.net/iso/ubuntu14.tar.gz
tar -zxvf ubuntu_16.04.tar.gz
tar -zxvf centos.tar.gz
# centos_7.2.img
tar -zxvf ubuntu14.tar.gz
tar -zxvf coreos_latest.tar.gz
# coreos_latest
tar -zxvf debian.tar.gz
# debian_8.5.img
tar -zxvf dockermachine.tar.gz
# dockermachine.img
tar -zxvf fedora.tar.gz
# fedora_24.img
#Image with Centos/Ubuntu named: 'megam' in Image DS. (for app launcher)
The untar them individually and add them to the opennebula datastore with the following slugs (titles)
osname_version
for examples, ubuntu_14.04, windows_2008, centos_7.2, centos_6.8
add image named 'megam' with either ubuntu 16.04 OS or Centos, this will be used for deploying apps.
https://github.com/VirtEngine/gitpackager/tree/master/support
#Setup network bridge from eth0 -> br0
#Add network to OpenNebula
#Add images to OpenNebula
#Add VM Template to OpenNebula
#Add empty template first, update the template with the following settings.
CONTEXT = [
FILES = "/virtengine/init.sh",
NETWORK = "YES",
NODE_NAME = "$NAME",
SET_HOSTNAME = "$NAME",
SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" ]
CPU = "0.5"
CPU_COST = "0.022222"
DESCRIPTION = "common template for all images"
DISK = [
IMAGE = "megam",
IMAGE_UNAME = "oneadmin" ]
DISK_COST = "0.0044444"
GRAPHICS = [
LISTEN = "0.0.0.0",
TYPE = "VNC" ]
LABELS = ""
MEMORY = "1024"
MEMORY_COST = "0.011111"
NIC = [
NETWORK = "public-1",
NETWORK_UNAME = "oneadmin" ]
NIC_DEFAULT = [
MODEL = "virtio" ]
OS = [
ARCH = "x86_64" ]
SCHED_REQUIREMENTS = "CLUSTER_ID=\"100\""
VCPU = "1"
#Config files:
/var/lib/detio/site_settings.yml - VirtEngine UI Settings
/var/lib/detio/regions.yml - VirtEngine UI region Settings
/var/lib/detio/vertice/vertice.conf - Vertice Engine config settings, such as connectors for each region to OpenNebula, Docker, or Rancher connections.
Check to make sure Vertice master_key is set for Gateway
OpenNebula connections go here.
/var/lib/detio/virtenginegateway/gateway.conf - VirtEngine Gateway API Settings
(Change master_key in gateway for security)
# Centos 7 Instructions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment