Exporting and Importing Virtual Box Images


Needed to save a virtual box image to be shared with someone else


Using vboxmanage command line to export the image and then test importing the image.


  • First list the virtual box images available

imela@whiscardz$ vboxmanage list vms
"test_default_1549514247520_18667" {6e29d56a-6531-4274-9d91-c6719e9fdaf3}
  • Then export the image you want to a file

imela@whiscardz$ vboxmanage export test_default_1549514247520_18667 -o test_default_1549514247520_18667.ova

  • Then copy it to the machine that you want to import the image.
  • Finally import the image.

imela@whiscardz2$ vboxmanage import test_default_1549514247520_18667.ova

Potential Issues

When I tried exporting to a file name other than the name of the image, it failed and threw the error below (it could be the extention):

imela@whiscardz2$ vboxmanage export test_default_1549514247520_18667 --output otherFileName.ovf
Progress state: VBOX_E_IPRT_ERROR
VBoxManage: error: Appliance write failed
VBoxManage: error: RTVfsFsStrmAdd failed for 'otherFileName.ovf' (VERR_ALREADY_EXISTS)
VBoxManage: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component ApplianceWrap, interface IAppliance
VBoxManage: error: Context: "RTEXITCODE handleExportAppliance(HandlerArg*)" at line 1263 of file VBoxManageAppliance.cpp


How to export and import VirtualBox VM images?

VBoxManage registervm/unregistervm

Export to OVF

VBoxManage export

VBoxManage import

virtualbox commandline options

Update 2019-01-15


Also needed to delete virtual box images that were not being used via the command line


  • First list the vms

$ VBoxManage list vms
"20180126" {00953737-12d0-49eb-a1d2-c749047ccacf}
"1519895285801_90671" {ac82a1dc-ef6b-40de-8a35-ce4dbee3e6e3}
"1522057779833_1088" {87021084-3202-4131-8f9c-5839774140a8}
  • Use the unregistervm flag along with the –delete option to delete the vm and it’s associated files.

$ vboxmanage unregistervm {ac82a1dc-ef6b-40de-8a35-ce4dbee3e6e3} --delete


Needed a way to be able to start and stop GuestOS on virtualbox using the commandline.


  • First list the vms

$ VBoxManage list runningvms
"academy_default_1522238466753_84362" {3a36e205-e8e2-4a96-b9c3-9f76f2ad17e5}

Here are some more options that can be used with the list command. NB If your vm was started with a specific user then running list without switching to the user that started the vm causes the result to be blank:

~$ vboxmanage list

VBoxManage list [--long|-l] [--sorted|-s] vms|runningvms|ostypes|hostdvds|hostfloppies|

  • Then shutdown the vms

~$ vboxmanage controlvm "academy_default_1522238466753_84362" poweroff
:~$ vboxmanage list runningvms


vboxmanage command line options

How to safely shutdown Guest OS in VirtualBox using command line

How to automatically start and shut down VirtualBox machines?

VBoxManage control and manage Virtualbox from command line

How to run VirtualBox virtual machines from the command line

VBoxManage registervm/unregistervm or delete vm


Pound Gateway Won’t Start on CentOS 7


I had Setup the pound gateway as per the steps here. The issue was that the gateway wasn’t starting. The following error was on the log:

Sep 7 15:09:49 localhost systemd: Starting Pound Reverse Proxy And Load-balancer...
Sep 7 15:09:49 localhost pound: starting...
Sep 7 15:09:50 localhost pound: get_host(, res, 0)
Sep 7 15:09:50 localhost pound: getaddrinfo OK
Sep 7 15:09:50 localhost pound: ret OK
Sep 7 15:09:50 localhost pound: done
Sep 7 15:09:50 localhost pound: get_host(, res, 0)
Sep 7 15:09:50 localhost pound: getaddrinfo OK
Sep 7 15:09:50 localhost pound: ret OK
Sep 7 15:09:50 localhost pound: done
Sep 7 15:09:50 localhost pound: get_host(, res, 0)
Sep 7 15:09:50 localhost pound: getaddrinfo OK
Sep 7 15:09:50 localhost pound: ret OK
Sep 7 15:09:50 localhost pound: done
Sep 7 15:09:50 localhost pound: get_host(, res, 0)
Sep 7 15:09:50 localhost pound: getaddrinfo OK
Sep 7 15:09:50 localhost pound: ret OK
Sep 7 15:09:50 localhost pound: done
Sep 7 15:09:50 localhost systemd: Failed to read PID from file /var/run/pound.pid: Invalid argument
Sep 7 15:11:19 localhost systemd: pound.service operation timed out. Terminating.
Sep 7 15:11:19 localhost systemd: Failed to start Pound Reverse Proxy And Load-balancer.
Sep 7 15:11:19 localhost systemd: Unit pound.service entered failed state.


According to this mailing list, the solution is to edit the file pound.service shown below and remove the line with something like PID.

After editing, the file should have the following:

[root@localhost ~]# cat /usr/lib/systemd/system/pound.service
Description=Pound Reverse Proxy And Load-balancer
After=syslog.target network.target




[Pound Mailing List] pound won’t start

When i try to logon to my WordPress Backend with pound in front it tells me this error “You do not have sufficient permissions to access this page.”


Load Balancing — Pound Gateway


Guest OS – CentOS 7

Configure Load Balancer

  • Enable the EPEL repository.
  • Install pound on the Load Balance Server. In my case this is on IP
[root@localhost ~]# yum install pound
  • Configure pound
[root@localhost ~]# vim /etc/pound.cfg
vim /etc/pound.cfg
pound config file

NB:// Remember to add the http service to the firewall as detailed below. Otherwise this will happen.

  • Add pound to chkconfig so it starts at bootup:
[root@localhost]# systemctl is-enabled pound
[root@localhost]# systemctl enable pound
ln -s '/usr/lib/systemd/system/pound.service' '/etc/systemd/system/multi-user.target.wants/pound.service'
[root@localhost]# systemctl is-enabled pound

Configure Back End Servers

  • Install apache and php
[root@localhost ~]# yum install --disablerepo="*" --enablerepo="LocalRepo" httpd

[root@localhost ~]# yum install --disablerepo="*" --enablerepo="LocalRepo" php
  • Edit apache config so webserver listens to traffic on static IP
[root@localhost ~]# vim /etc/httpd/conf/httpd.conf
vim /etc/httpd/conf/httpd.conf
Apache Config File
  • Create a sample web page on Backend server(s)
[root@localhost ~]# vim /var/www/html/index.html
  • change ownership of the index.html file:
[root@localhost ~]# chown apache:apache /var/www/html/index.html
  • Restart Apache
[root@localhost ~]# service httpd restart

Out of the box, enterprise Linux distributions such as CentOS or RHEL come with a powerful firewall built-in, and their default firewall rules are pretty restrictive. Thus if you install any custom services (e.g., web server, NFS, Samba), chances are their traffic will be blocked by the firewall rules. You need to open up necessary ports on the firewall to allow their traffic.

NB: We are adding the service to the public zone since its the active zone. Check active zones so you know which zone to add the service.  See this as well.

[root@localhost jeremy]# firewall-cmd --get-active-zones
 interfaces: enp0s3 enp0s8
[root@localhost jeremy]# firewall-cmd --permanent --zone=public --add-service=http
[root@localhost jeremy]# firewall-cmd --reload
  • Then start pound:
[root@localhost ~]# service pound restart
  • Go to the Host OS browser and enter IP of the Load balancer server IP. You should see Server 1 and Server 2’s webpages being served.


Pound (networking)


Pound : HTTP Load Balancing

Simple Apache Load Balancing – Pound RPM

Linux install and configure pound reverse proxy for Apache http / https web server

Pound Gateway & Config Directives Explained

Lighttpd & Config Directives Explained

A few ways to configure Linux firewalld

RHEL 7 / CentOS 7: How to get started with Firewalld

RHEL7: How to get started with Firewalld.

How to open a port in the firewall on CentOS or RHEL

Virtual Box Connect to HTTP Server on Guest OS


I have a Guest OS on Virtual Box, running on Ubuntu based Host OS. I can ping and ssh into my CentOS 7 Guest OS from the host after using the Host Only Networking option on Virtual Box.

The problem came in when I tried reaching the Guest OS’s IP on the Host OS web browser. I’d get this error:

Host OS Web Browser
Host OS Web Browser

Telnet from the host to the Guest IP gave the following error:

telnet 80 telnet: Unable to connect to remote host: No route to host
Telnet Result of Host-to-Guest


  • Check if port is Open and if firewall is running on Guest OS
check if-port is open-firewall-running-on-guest-OS
  • Tried to telnet port from Guest OS
telnet-from-guestOS successful
  • Tried to ping Guest IP from the Host IP and this was successful:


After some doodling, found this pointer.

Starting with CentOS and RHEL 7, firewall rule settings are managed by firewalld service daemon. A command-line client called firewall-cmd can talk to this deamon to update firewall rules permanently.

service firewalld status
centos firewalld was running

So after stopping firewalld, I was able to telnet to port 80 and also get a response on the web browser:

service firewalld stop
telnet-host-to-guest successful
telnet-host-to-guest successful

NB:// Another alternative to stopping the firewall, is open up the http service/port on the firewall. This can be achieved as explained here.


Virtualbox: How to access web server on guest OS from the host OS?

A few ways to configure Linux firewalld

RHEL 7 / CentOS 7: How to get started with Firewalld

RHEL7: How to get started with Firewalld.

How to open a port in the firewall on CentOS or RHEL

Networking in Virtual Box


I needed to install packages from the Internet as well as from the Local Repository. I had only 1 Interface i.e. Host Only Interface on my Guest OS which is CentOS.


From the Host OS (In my case an ubuntu distro):

  • Open the Virtual Box Manager and select the Guest OS, e.g in my case Guest OS 1, then click on Settings, then Network.
Settings on Virtual Box Manager
Virtual Box Manager
Click on Adapter 2 and select attached to Host Only
Host Only Adapter 2
  • Click on ok and boot up your Guest OS and you should be able to connect to the internet as well as reach the Guest OS’s static IP.


Bridged Networking: Bridged Networking is used when you want your vm to be a full network citizen, i.e. to be an equal to your host machine on the network.

Internal Networking: When you configure one or more vm’s to sit on an Internal network, VirtualBox ensures that all traffic on that network stays within the host and is only visible to vm’s on that virtual network.

Port-Forwarding with NAT Networking


Host-Only Networking With VirtualBox

Networking in VirtualBox

VirtualBox: Configuring Static IPs for VMs

Virtual networking



Using Local YUM repository on CentOS 7


I have the CentOS 7 complete DVD ISO and need to install packages from this ISO instead of via the internet.


Only allow installations via DVD Rom:

  • Mount the DVD ROM as described here.
  • Create a Local Repository File called local.repo as below:
# vi /etc/yum.repos.d/local.repo

Add the following lines to the file:

Local Repository File Details
Local Repo File Details

NB:// gpgcheck is optional but you are advised to use it. To use it set value to 1 and add as shown below:


Also baseurl depends on where your cd/dvd is mounted in my case its as above.

  • Remove (# rm *.repo) the other .repo file(s) (all except local.repo) in the location /etc/yum.repos.d/
  • Then clear the repository cache and update using:
#yum clean all
#yum update
  • Test installing a package:
yum install screen
Testing Local Repository Installation

Disabling Other Repos and Only Using LocalRepo

    • Add the local.repo file to /etc/yum.repos.d/ with the details described above or as below:
Local Repository File
Local Repository File
    • Then clear the repository cache and then update using
#yum clean all
#yum update
#yum install --disablerepo="*" --enablerepo="LocalRepo" vim

NB:// The Name LocalRepo is case sensitive so it should be the same name as the name in the header [] tag in your local.repo file in /etc/yum.repos.d

yum install --disablerepo=
Installing Package from Local Repository


Setup Local Yum Repository On CentOS 7

Create Local YUM repository on CentOS 7 / RHEL 7 using DVD

Creating a Local Yum Repository Using an ISO Image

How To Enable EPEL Repository in RHEL/CentOS 7/6/5?

Installing Guest Additions on Linux Host


  • Download the Guest Additions ISO from here. You will need to select the Version you want from the list as suggested here.
  • On the Linux host, in my case an ubuntu based distro:
On Host OS install dkms
Virtual Box Host OS
  • On Guest OS, in my case CentOS 7 minimal install. You will need to install bzip2, gcc, kernel-devel:
# yum update
# yum install bzip2
# yum install gcc
# yum install kernel-devel
cd to /media/cdrom --> sh ./VBoxLinuxAdditions.run
Installing Guest Additions
Guest Additions Installation Progress
Guest Additions Installation Progress


Guest Additions for Linux

VirtualBox Guest Additions ISO Download?

Index of /virtualbox

Installing the VirtualBox Guest Additions on Windows Host

Switching Between Virtual Box ISO on Linux Host


Needed to switch between mounting 2 ISOs on a Centos Guest in Virtual Box without having to restart.


  • Umount drive from guest OS:
    #umount /media/cdrom
  • From the booted CentOS guest select “Devices” then:

Devices->CD/DVD Devices -> Remove Disk From Virtual Drives

  • Incase of Error Below, force unmount:
Click Force Umount Button
Umount Virtual Drive
  • Double Check that Drive has been unmounted:
Confirm Virtual Drive Umounted
Unmounted Virtual Drive
  • Mount New Image, From the Guest OS, select Devices, then:
Devices-->CD/DVD Devices-->
Mounting New Virtual Drive
  • From the terminal window on the guest OS, mount the New ISO in this case Guest Additions as described here and also shown below:
mount cd/dvd drive on guest OS
Run the above on Guest OS


How to Mount and Unmount an ISO Image in RHEL/CentOS/Fedora and Ubuntu

How to Mount CDROM Media on CentOS 5/CentOS 6/CentOS 7