Thursday, 16 August 2018

Vbox autostart on CentOS 7

The basic steps is as follows: 
1. Install Virtualbox through the following commands: 
  • # yum install epel-release -y
  • # yum update -y
  • # yum install gcc make patch  dkms qt libgomp kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel  -y
  • # wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
  • # yum install VirtualBox-5.2
  • # /usr/lib/virtualbox/vboxdrv.sh setup
  • # usermod -a -G vboxusers USERNAME
2. Configure Vbox for Autostart: 
  • # cd /etc/vbox/
  • vim /etc/default/virtualbox
       Enter the following in the file virtualbox: 
          VBOXAUTOSTART_DB=/etc/vbox
          VBOXAUTOSTART_CONFIG=/etc/vbox/autostart.cfg
  • # vim autostart.cfg 
         Enter the following in the file autostart
         (Can enter more users depending on access):
         # Create an entry for each user allowed to use autostart
          USERNAME = {
            allow = true
          }

Change access permissions of Vbox folder:
  • sudo chgrp vboxusers /etc/vbox
  • sudo chmod 1775 /etc/vbox
Provide acess right for USENAME to the group:
  • sudo usermod -aG vboxusers USERNAME


3.  vboxmanage is the command comes with VirtualBox software for management. Few handy Vbox command for practice is as follows:

  • vboxmanage list vms                      # list the names of all VMs
  • vboxmanage list runningvms # list currently running VMs
  • vboxmanage list systemproperties | grep folder            # Display current setting repository
  • vboxmanage startvm NAME-OF--VM --type headless     # Command to start VM from the shell
  • VBoxManage controlvm NAMEOFYOURVM savestate  # Command to hibernate VM from the shell

4. Enable autostart for individual machines: 
  • vboxmanage setproperty autostartdbpath /etc/vbox
5. Set a particular VM to start on boot:
  • vboxmanage modifyvm {UUID-or-Name-of-VM-Here} --autostart-enabled on --autostop-type poweroff

6. Enable vboxautostart-service to run at start up:

  • sudo systemctl enable vboxautostart-service
  • sudo systemctl start vboxautostart-service

















No comments: