Solved: How to change hostname using nmtui or nmcli in redhat linux

In our last post we have seen how to change hostname manually or with hostnamectl .
In this post we will discuss how to change hostname with nmtui and nmcli tools.
nmtui
Let’s first try with nmtui tool
  • If you don’t have the nmtui tool installed, you can install it using yum
yum install NetworkManager-tui
  • Invoke the nmtui interface from the command line by executing as root user
nmtui
  • In the menu select “Set system hostname” .
  • Write the new hostname which you want to keep.  We want to change it to “prodvedas”.

  • To make it effective restart the “hostnamed” service
systemctl restart systemd-hostnamed
  • Now if you login with new session or do “su -” in same session you should see new hostname.
nmcli
Let’s try changing the hostname with nmcli tool in Redhat Linux.
  • To check the current hostname
nmcli general hostname
  • If you want to change the hostname
nmcli general hostname prodvedas
  • To make it effective restart hostnamed service
systemctl restart systemd-hostnamed
  • Now if you login with new session or do “su -” in same session you should see new hostname.
Hostname changed by any of the above method will be persistent across reboot.
If you are trying to change hostname of AWS EC2 linux instance the process will be slightly different. Refer this post to change AWS EC2 instance hostname.

Solved: Three options to convert ova to ovf files

Sometime you may have to open OVA files, which are actually just zip of OVF files.
You can extract or convert OVA to OVF file in three ways as mentioned below
Option 1
Tar Command
If you have access to Linux or Unix box you can use tar command to extract the file.
tar -xvf cloudvedas-OpenStackHOL.ova
Option 2
In Windows you can use a tool like like 7-Zip or winrar to extract the file.
Option 3
Vmware ovftool
Download Vmware OVF tool 
Once you have downloaded and installed the tool go to the command prompt and change the directory to where you have installed the ovf tool. You should see an exe called “ovftool.exe”.
Execute the command:-
ovftool.exe "E:\Software\Openstack\cloudvedas-OpenStackHOL.ova" "E:\Software\Openstack\cloudvedas-OpenStackHOL.ovf"

Check out our post on Most useful Tar command examples .

Solved: How to resize Docker Quickstart Terminal Window

By default in Windows 7 Docker Quickstart Terminal Window size will be small. But it can be very annoying to work in such small window.
Here we will show you how to increase the window size as per your requirement.
  • Open the Docker Quickstart Terminal as an Administrator.
  • Right Click on the Blue whale icon on top of  Docker Quickstart Terminal .
  • Click “Properties” and Select “Layout” tab.
  • Increase the “Width” and “Height” of “Window Size” as per your requirement.
  • Finally Click OK and try re-opening the Terminal.
That’s all folks!

Solved: How to restart a docker container automatically on crash

In this post we will see how we can restart a container automatically if it crashes.
If you want a Docker container to always restart use:-
docker run -dit --name cldvds-always-restart --restart=always busybox
But if you want container to always restart unless it is explicitly stopped  or restarted, use:-
docker run -dit --name cldvds-except-stop --restart unless-stopped busybox
In case you want the container to stop after 3 restart attempt use below command.
docker run -dit --name cldvds-restart-3 --restart=on-failure:3 busybox
You can see the logs of a container using
docker logs cldvds-restart-3
If you want to change the restart policy of running container you can do it with “docker update” e.g. here we are changing restart attempt from 3 to 4 of container cldvds-restart-3.
docker update --restart=on-failure:4 cldvds-restart-3

Solved: How to convert .usb file to .vmdk to .vdi to .vhd and vice versa

In this post we will see how we can convert a .usb file to .vmdk or .vdi  or .vhd
We will be doing this conversion using a free tool Oracle Virtualbox.
Pre-requisites:-
Download latest Virtualbox version
Once you have downloaded and installed the latest version of Virtualbox. Go to the directory in which virtual box is installed. There you will find a program "VBoxManage.exe".  We will be using "VBoxManage.exe" for the conversion.
Convert .usb to .vmdk 
First let's see how to convert .usb file to .vmdk . Syntax is simple:
VBoxManage.exe convertfromraw filename.usb filename.vmdk --format VMDK
In the below example we will be converting a Solaris 11 USB file  sol-11_2-openstack-x86_Copy.usb  to vmdk.
E:\>"C:\VBoxManage.exe" convertfromraw sol-11_2-openstack-x86.usb sol-11_2_cldvds-openstack-x86_Copy.vmdk --format VMDK
Converting from raw image file="sol-11_2-openstack-x86.usb" to file="sol-11_2_cldvds-openstack-x86_Copy.vmdk"...
Creating dynamic image with size 8655764992 bytes (8255MB)...
Convert  .usb to .vdi
Similarly you can convert a .usb file to .vdi . Refer below example.
E:\>"C:\VBoxManage.exe" convertfromraw sol-11_2-openstack-x86.usb sol-11_2_cldvds_openstack-x86_Copy.vdi --format VDI
Converting from raw image file="sol-11_2-openstack-x86.usb" to file="sol-11_2_cldvds_openstack-x86_Copy.vdi"...
Creating dynamic image with size 8655764992 bytes (8255MB)...
Convert .vdi to .vmdk
Now let's try converting a .vdi file to .vmdk
E:\>"C:\VBoxManage.exe" convertfromraw sol-11_2-openstack-x86_Copy.vdi sol-11_2_cldvds-openstack-x86_Copy.vmdk --format VMDK
Converting from raw image file="sol-11_2-openstack-x86_Copy.vdi" to file="sol-11_2_cldvds-openstack-x86_Copy.vmdk"...
Creating dynamic image with size 6624903168 bytes (6318MB)...
If you want to convert from vmdk to vdi the syntax will be:
VBoxManage.exe convertfromraw filename.vmdk filename.vdi --format VDI
Convert .vdi to .vhd
Same steps you can use to convert from .vdi to .vhd
E:\>"C:\VBoxManage.exe" convertfromraw sol-11_2-openstack-x86_Copy.vdi sol-11_2_cldvds-openstack-x86_Copy.vhd --format VHD
Converting from raw image file="sol-11_2-openstack-x86_Copy.vdi" to file="sol-11_2_cldvds-openstack-x86_Copy.vhd"...
Creating dynamic image with size 6624903168 bytes (6318MB)...
You can use similar steps to convert the other way round like convert .vmdk to .vdi  or .vhd to .vdi.
Hope this post is helpful to you. Do let me know if you have any query.