October 31 2018

Manage Virtual Machines

VMWare

Backup Guest on a Standalone ESXi Host

Using vSphere Client

  1. Shutdown the target Guest
  2. Select (Highlight) the Guest
  3. File->Export->Export OVF Template.
  4. Follow the prompts.

Using the command line ovftool to create thin backup

ovftool -dm=thin vi://<user>@<esxi-host>/<vm-name> <local-file>.ovf

More options can be found in http://www.virtuallyghetto.com/

Restore Guest on a Standalone ESXi Host

Using vSphere Client

  1. Deploy OVF Template

VirtualBox

Install VirtualBox in Ubuntu

# apt update
# apt install virtualbox
# apt install virtualbox-guest-additions-iso

Install VirtualBox in Fedora

# cd /etc/yum.repos.d/
# wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtulbox.repo
# dnf update
# dnf install patch kernel-devel dkms
# dnf install virtualbox

Operations from Command Line

' Display all VMs available on the computer
$ vboxmanage list vms
' Clone VM
$ vboxmanage clonevm --register <vm1> --name <vm2>
' Export VM to OVA format
$ vboxmanage export <vm1> -o <vm-filename>.ova
' Import OVA VM
$ vboxmanage import <vm-filename>.ova
' Get IP address assigned to the guest OS 
$ vboxmanage guestproperty get <UUID|Name> "/VirtualBox/GuestInfo/Net/0/V4/IP"    

LXC

Install LXC in Ubuntu

# apt update
# apt install lxc

Install LXC in Fedora / CentOS

' For CentOS
# yum install epel-release
# yum install libcap-devel libcgroup busybox wget bridge-utils
' For Fedora
# yum install debootstrap libvirt perl gpg
# yum install lxc lxc-templates lxc-extra

Modify Default Configuration /etc/lxc/default.conf

# Network configuration
lxc.network.type = veth
lxc.network.link = br0
lxc.network.flags = up

Manage LXC Containers in Command Line

' List container templates installed on system
$ ls -l /usr/share/lxc/templates
' Create new container with template
# lxc-create -n <container-name> -t <template>
' Check status of all containers on system
# lxc-ls --fancy
' Get status of one container with more details
# lxc-info -n <container-name>
' Access container root file system and change user password
# chroot /var/lib/lxc/<container-name>/rootfs/
# passwd <username>
' Start container
# lxc-start -d -n <container-name>
' Launch a root shell
# lxc-attach -n <container-name>
' Access container with console
# lxc-console -n <container-name>
' Display content of the container from host
$ ls -lh /var/lib/lxc/<container-name>/
' Stop the container
# lxc-stop -n <container-name> 
' Remove the container from system
# lxc-destroy -n <conatiner-name>

More information can be found in 
https://linuxcontainers.org/lxc/getting-started/

Parallels Desktop

Unable To Start Parallels Services (Non-Restricted Status)

' 1. Check the Restricted status
# ls -dlO /Library/StagedExtensions/
drwxr-xr-x  5 root  wheel - 160 Oct  9 10:18 /Library/StagedExtensions
' 2. Reboot in recovery mode using Command+R combination 
' 3. If FileVault is ON
'      a. Open Disk Utility before getting to the Terminal
'      b. Highlight the Macintosh HD volume in the left panel 
'      c. Press the Mount button in the Disk utility menu
'         (should be prompted for the Mac password)
'      d. From the Mac menu bar, Select Disk utility > Quit
' 4. Open Utilities > Terminal from Mac top menu. Type these commands in the terminal
# spctl kext-consent add 4C6364ACXT 
# spctl kext-consent enable 
# spctl kext-consent list
Allowed Team Identifiers: 4C6364ACXT
# chflags -R restricted /Volumes/Macintosh\ HD/Library/StagedExtensions/
' 5. Run First Aid under Disk Utility
' 6. Reboot the Mac
' 7. Verify Restricted status again
# ls -dlO /Library/StagedExtensions/
drwxr-xr-x  4 root  wheel  restricted 128 Oct 12 13:04 /Library/StagedExtensions/