A chronological documentation test project, nothing serious, really!

20 Mar 2019 Installing Vagrant on CentOS 7

This short post describes how to install the latest version of Vagrant using the libvirt provider on a fresh CentOS 7 (Minimal install). I will not do any security measures to harden this config, anyway not in this post. Vagrant supports different providers in addition to libvirt, like VirtualBox and VMware. I prefer libvirt because I am used to use virt-manager and KVM.

I assume you know what Vagrant is and basic usage of it. If you do not know what Vagrant is, please visit the Hashicorp website.

I used vagrant as a sandbox for my Puppet development several years ago, but somewhere along the way I stopped using it. The interest to start using Vagrant back again came after doing some Ansible playbook development. The easy way of setting up and tearing server boxes really helps when you develop and test.

My code examples usually starts with # or $, # tells you that I am using the root user account and $ as a normal user.

First we need to get the latest packages on our installation and reboot the server.

# yum -y update && shutdown -r

We are now ready to add the prerequisites to the installation.

It is easier to work with a graphical interface (GUI) with Vagrant, so we are installing the “Server with GUI” packages.

# yum -y group install "Server with GUI"

This command takes a while to finish, take a short break while it finishes the installation.

Now we are going to determine the latest version of Vagrant and install it. Open your web browser and visit and copy the URL to the latest version available. In my case version

Installing Vagrant

# yum -y install 

Package Arch Version Repository Size
vagrant x86_64 1:2.2.4-1 /vagrant_2.2.4_x86_64 110 M
Transaction Summary
Install 1 Package
Total size: 110 M
Installed size: 110 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:vagrant-2.2.4-1.x86_64 1/1
Verifying : 1:vagrant-2.2.4-1.x86_64 1/1
vagrant.x86_64 1:2.2.4-1

Please note that when we install a package using the yum command like this, there will not be any updates automatically available. You need to manually download a never version when desired.

Now we have Vagrant installed but we have not chosen the type provider type we would like to use running our VMs. I prefer libvirt (KVM) as a provider for my VMs based on stability. Installing KVM as provider.

# yum -y install libvirt libvirt-devel qemu-kvm virt-install virt-manager virt-top libguestfs-tools bridge-utils

The virt-manager package will give us a GUI to our VMs and gives us console access if needed.

Start the libvirt daemon and enable default KVM virtualization during startup.

# systemctl start libvirtd && systemctl enable libvirtd

As a convenience I usually install the Development Tools package as well

# yum -y group install "Development Tools"

It is now time to choose the Vagrant provider and start using Vagrant. We are using the vagrant-libvirt provider. Make sure to run the following command as the user you are going to use with vagrant. I am using a regular user to install the plugin.

$ vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes…
Fetching: excon-0.62.0.gem (100%)
Fetching: formatador-0.2.5.gem (100%)
Fetching: fog-core-1.43.0.gem (100%)
Fetching: fog-json-1.2.0.gem (100%)
Fetching: mini_portile2-2.4.0.gem (100%)
Fetching: nokogiri-1.10.1.gem (100%)
Building native extensions. This could take a while…
Fetching: fog-xml-0.1.3.gem (100%)
Fetching: ruby-libvirt-0.7.1.gem (100%)
Building native extensions. This could take a while…
Fetching: fog-libvirt-0.6.0.gem (100%)
Fetching: vagrant-libvirt-0.0.45.gem (100%)
Installed the plugin 'vagrant-libvirt (0.0.45)'!

It is now time to download an OS-image and create a VM using Vagrant. You can search for boxes to add on URL

It is now time to create an environment for our VMs to be configured.

$ mkdir vagrant-example
$ cd vagrant-example

We are now ready to start using Vagrant and it is time to get the OS of our choice. You can search for the available boxes in

I will download Ubuntu 18.04 (generic unmodified image) and CentOS 7 box images by issuing the following commands

$ vagrant box add generic/ubuntu1804 
==> box: Loading metadata for box 'generic/ubuntu1804'
box: URL:
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.
1) hyperv
2) libvirt
3) parallels
4) virtualbox
5) vmware_desktop
Enter your choice: 2

Choose option 2) libvirt as provider since that is what I installed earlier in this post.

==> box: Adding box 'generic/ubuntu1804' (v1.9.6) for provider: libvirt
box: Downloading:
box: Download redirected to host:
==> box: Successfully added box 'generic/ubuntu1804' (v1.9.6) for 'libvirt'!

Next we add a CentOS 7 box image

$ vagrant box add centos/7

==> box: Loading metadata for box 'centos/7'
box: URL:
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.
1) hyperv
2) libvirt
3) virtualbox
4) vmware_desktop

Choose option 2) libvirt

==> box: Adding box 'centos/7' (v1902.01) for provider: libvirt
box: Downloading:
box: Download redirected to host:
==> box: Successfully added box 'centos/7' (v1902.01) for 'libvirt'!

If you are behind a proxy, tell Vagrant to use it. If not, ignore the next line.

$ export

To create a Vagrant file and get starting with the Centos 7 image we just added

$ vagrant init centos/7
A Vagrantfile has been placed in this directory.
You are now ready to vagrant up your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on for more information on using Vagrant.

The content of the Vagrantfile

Vagrant.configure("2") do |config| = "centos/7"

It is now time to start our first virtual machine using Vagrant, but first we list the available boxes.

To start up our CentOS 7 box we run the following command

$ vagrant up

Bringing machine 'default' up with 'libvirt' provider…
==> default: Checking if box 'centos/7' version '1902.01' is up to date…
==> default: Uploading base box image as volume into libvirt storage…
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings…
==> default: -- Name: vagrant-example_default
==> default: -- Domain type: kvm
==> default: -- Cpus: 1
==> default: -- Feature: acpi
==> default: -- Feature: apic
==> default: -- Feature: pae
==> default: -- Memory: 512M
==> default: -- Management MAC:
==> default: -- Loader:
==> default: -- Nvram:
==> default: -- Base box: centos/7
==> default: -- Storage pool: default
==> default: -- Image: /var/lib/libvirt/images/vagrant-example_default.img (41G)
==> default: -- Volume Cache: default
==> default: -- Kernel:
==> default: -- Initrd:
==> default: -- Graphics Type: vnc
==> default: -- Graphics Port: -1
==> default: -- Graphics IP:
==> default: -- Graphics Password: Not defined
==> default: -- Video Type: cirrus
==> default: -- Video VRAM: 9216
==> default: -- Sound Type:
==> default: -- Keymap: en-us
==> default: -- TPM Path:
==> default: -- INPUT: type=mouse, bus=ps2
==> default: Creating shared folders metadata…
==> default: Starting domain.
==> default: Waiting for domain to get an IP address…
==> default: Waiting for SSH to become available…
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default: Inserting generated public key within guest…
default: Removing insecure key from the guest if it's present…
default: Key inserted! Disconnecting and reconnecting using new SSH key…
==> default: Configuring and enabling network interfaces…
default: SSH address:
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Rsyncing folder: /home/hanshj/vagrant-example/ => /vagrant

You have to type your password to complete this command.

We have now created a new VM using Vagrant and ut is available to our disposal. The access it we can run the command

$ vagrant ssh
[vagrant@localhost ~]$

We are now presented with the Vagrant box prompt logged in as the user vagrant. Default for all Vagrant boxes is username vagrant and password vagrant.

To exit the SSH session to the Vagrant box just press Ctrl+D or just logout as you normally do.

To list the available boxes that we have downloaded

$ vagrant box list
centos/7 (libvirt, 1902.01)
generic/ubuntu1804 (libvirt, 1.9.6

To get a list of all VMs running on libvirt run the following command

$ sudo virsh list --all
1 vagrant-example_default running

The Vagrantfile can be modified to add extra disks, nics, memory, several VMs. There are many options available but here are some of the basics I usually add.

Vagrant.configure("2") do |config| = "centos/7"
config.vm.hostname = "centos7-01.acme"
config.vm.define "centos7.acme"

When you have done some tests on your VM and you would like to start all over with a fresh VM, just destroy it and start all over.

$ vagrant destroy
default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Removing domain…

To start the VM again, fresh and ready just issue the command

$ vagrant up

Tags: , , , ,

Posted by

02 Nov 2015 How to mount LVM partitions from rescue mode

This is a short post about mounting LVM partitions when you are using a rescue CDROM or a desktop install CDROM. The whole process is only four easy steps.

  1. Boot your rescue media. This can be a CentOS, Ubuntu, Red Hat or other CDROM that gives you a console access to the server. Most newer linux distributions have LVM support available.Scan for volume groups
    # lvm vgscan -v
  2. Activate all Volume Groups
    # vgchange -a y “volume group name”
  3. List Logical Volumes
    # lvm lvs –all
  4. You have now activated the volumes and have all the information you need to mount them
    # mkdir /media/your-mount-point
    # mount /dev/volumegroup/logical-volume /media/your-mount-point

You can now look into /media/your-mount-point and see the content of your mounted LVM volume.

Tags: , , , ,

Posted by

21 May 2014 Using the USB31000SPTB (AX88179) on CentOS 6.5

This post is a short HOWTO and describes how to get the Startech USB31000SPTB network adapter working on CentOS 6.5. USB31000SPTB uses the AX88179 chipset and is a USB3.0 to 10/100/1000M Gigabit Ethernet Controller.  This adapter works without any modifications on Ubuntu 13.10 and 14.04 LTS.

I am using kernel version 2.6.32-431.17.1.el6.x86_64 in this post

Use the root user if sudo is unavailable.

Steps taken to download, compile and install the Axis kernel module

  1. Download the Axis linux kernel driver from;71;112. I downloaded the Linux kernel 3.x/2.6.x Driver V1.10.0 2014-04-22 For Android 1.x/2.x/3.x/4.x, Linux kernel 2.6.25 and later. The file downloaded was named AX88179_178A_LINUX_DRIVER_v1.10.0_SOURCE.tar.bz2
  2. Install the build tools
    $ sudo yum groupinstall “Development Tools”
  3. Install the kernel headers
    $ sudo yum install kernel-headers
  4. Unpack the Axis kernel driver
    $ tar xfj AX88179_178A_LINUX_DRIVER_v1.10.0_SOURCE.tar.bz2
    $ cd AX88179_178A_LINUX_DRIVER_v1.10.0_SOURCE
  5. Compile and install the Axis AX88179 kernel module
    $ make
    $ sudo make install
    The kernel module is now compiled and available in the /lib/modules/2.6.32-431.17.1.el6.x86_64/kernel/drivers/net/usb folder.
    $ cd /lib/modules/2.6.32-431.17.1.el6.x86_64/kernel/drivers/net/usb
    $ sudo chmod u+x ax88179_178a.ko
  6. The Axis module is now available on the system but not enabled. The easiest way to test it is to perform a reboot or you can modprobe usbnet and insmod ax88179_178a.ko kernel module

Network adapter eth0 is now available and ready to be used.

Tags: , , , ,

Posted by

26 May 2013 Remux MTS (AVCHD) files to MKV using mkvmerge in linux

This post came to life because I did not manager to get my newly aquired Raspberry Pi 512MB version revision 2 running raspbmc to play my MTS files without freeze/rebuffering. One solution was to overclock the Arm processor to 1000MHz, but then I struggled to find a way to get the CPU temperature down. The other solution was to convert or remux the MTS file to Matroska format using a Ubuntu linux server using the mkvmerge command.

From a console window install the required package to perform the remux operation
$ sudo apt-get install mkvtoolnix

Then I did a quick test to remux the MTS file to MKV
$ mkvmerge -o OutputFile.MKV InputFile.MTS
mkvmerge v6.1.0 ('Old Devil') built on Mar 4 2013 20:24:55
'InputFile.MTS': Using the demultiplexer for the format 'MPEG transport stream'.
'InputFile.MTS' track 0: Using the output module for the format 'AVC/h.264'.
'InputFile.MTS' track 1: Using the output module for the format 'AC3'.
'InputFile.MTS' track 2: Using the output module for the format 'PGS'.
The file 'OutputFile.MKV' has been opened for writing.
'InputFile.MTS' track 0: Extracted the aspect ratio information from the MPEG-4 layer 10 (AVC) video data and set the display dimensions to 1920/1080.
Progress: 100%
The cue entries (the index) are being written...
Muxing took 19 seconds.

This example remuxed a 339MB MTS file to Matroska in 19 seconds and is a quick and easy fix to perform on my video collection.
Muxing a 1.3GB MTS file took 2 minutes 9 seconds. The resulting MKV file is a little bit smaller than the original MTS file.

I have not experienced any playback problems using raspbmc connected to my Sony Bravidia KDL-40EX711 LED TV even though some people complain that older devices cannot play files remuxed using newer version of mkvmerge because of “Header compression” is enabled by default, ref

Playback of the MKV file is now without any freeze or rebuffering and the Raspberry Pi is now working as a power efficient media PC directly connected to my TV using a HDMI cable and using a external power suppply.

Playback has been tested on Raspbmc running XBMC 12.2 Git:20130502-32b1a5e using “System Performace Profile – Normal” without any advanced overclocking options enabled.

As a note .MTS files are AVCHD coded and can also end with the .M2TS file suffix.

Tags: , , , , , , , , , , ,

Posted by

17 May 2013 Howto enter VMware ESXi license key after it has expired

vmware-esxi-5-license-has-expired“Disable VMware ESX” is the warning message that is displayed when you open your VMware vSphere Client after the 60-day evaluation period has expired without typing in a new license key for your free VMware vSphere Hypervisor 5 install. You cannot type in the license key in the vSphere Client after the evaluation period has expired. If you do not type in the key before it expires you will not be able to power on VMs after they have been powered down.

This is a short howto describing how you can type in the license key for you free VMware Hypervisor after it has expired, since you cannot use the vSphere Client.
This requires that you have enabled the SSH service on your host before it expired and you can access it using your favourite SSH client to your ESXi host.
The file should look something like this if you have not entered any license information 00000-00000-00000-00000-00000.
This key should be replaced with the key you have gotten from VMware when you downloaded the installer file.

This is a step by step description of how you can update the license file

  1. Start a SSH session to your ESXi host using your favourite SSH client like Putty
  2. Log in with the username root (unless you have changed it to something else)
  3. Open the file /etc/vmware/vmware.lic using the vi editor
    ~# vi /etc/vmware/vmware.lic
  4. Delete the old license key with the dd command
  5. Insert a new license key by with the i command

    The key above is just an example and is not a valid key. Replace the key used above with the evaluation license key you received from VMware.

  6. Save the file using the write command w
  7. Now you can open a new vSphere Client window and see if the license warning windows appears again. If it does not, then you have successfully updated the license key. If not, then you need to check if the license key is typed in correctly.

All this can be done without a reboot of the ESXi host.

Tags: , , , , , , ,

Posted by