vagrant box to libvirtd (QEMU) VM

2018-03-26 1 min read Fedora Vurtualization

Like ova images, you can use box images as well with Qemu. After all, both have the disk images, so here is the script to do that. Just put the script somewhere in your path and run with ova or box image name :

 

#!/bin/bash - 
#===============================================================================
#
#          FILE: ova2vm.sh
# 
#         USAGE: ./ova2vm.sh 
# 
#   DESCRIPTION: 
# 
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka),
#  ORGANIZATION: Mobileum
#       CREATED: 12/28/2017 13:59
# Last modified: Sun Mar 11, 2018  12:01PM
#      REVISION:  ---
#===============================================================================

set -o nounset                              # Treat unset variables as an error
dest='/mnt/Backup/VM'
ORIG=${PWD}

if [[ $# == 0 ]]
then
    echo "You need to provide ova/vmdk filename"
    exit
fi
if [[ $1 == *ova || $1 == *box ]]
then
    tmp=$(mktemp -d /tmp/amitXXXXXXX)
    cd  $tmp
    tar xvf $ORIG/$1
    file=$(echo $PWD/*vmdk)
else
    file=$1
    echo "Not a OVA file"
fi
dfile="$dest/$(basename $file)"

read -p "Enter the name for VM :: " vmname
qemu-img convert $file $dfile -p -c -O qcow2
virt-install --disk $dfile --ram 512 \
    --virt-type kvm --vcpus 1 --name "$vmname" --import

Send history of current host to some other host over ssh

2018-02-26 1 min read Fedora Learning

Sometimes I want to save the history of current host on another host. This is to ensure that I can use copy/paste on other host to run the commands. To this, I found a simple solution –

history| ssh <user>@<host> 'cat - > /tmp/history'

And on the new host, you can find the history in file “/tmp/history”, cool :). Now I can quick edit this file to create this as shell script as well if required. How cool is that.

Continue reading

asciinema – video for your terminal session

2017-10-16 1 min read Fedora Uncategorized

Info about asciinema:

Name         : asciinema
Version      : 1.4.0
Release      : 1.fc26
Arch         : noarch
Size         : 144 k
Source       : asciinema-1.4.0-1.fc26.src.rpm
Repo         : @System
From repo    : fedora
Summary      : Command line client (terminal recorder) for asciinema.org service
URL          : http://asciinema.org
License      : GPLv3
Description  : Asciinema is a free and open source solution for recording the terminal sessions
and sharing them on the web.

To install, you can do:

Continue reading

remind – set and manager reminders the easy way

2017-10-09 1 min read Fedora

remind – is a calendar and alarm program. Its simple to use from CLI. To install:

dnf install remind

and some details about it:

Name : remind
Version : 03.01.15
Release : 3.fc26
Arch : x86_64
Size : 440 k
Source : remind-03.01.15-3.fc26.src.rpm
Repo : @System
From repo : fedora
Summary : A sophisticated calendar and alarm program
URL : http://www.roaringpenguin.com/en/penguin/openSourceProducts/remind
License : GPLv2
Description : Remind is a sophisticated calendar and alarm program. It includes the following
features:
  • A sophisticated scripting language
  • Plain-text, PostScript and HTML output
  • Timed reminders and pop-up alarms

Fedora – change from one edition to some other

2017-03-27 1 min read Fedora

You will need to install convert-to-edition, description

Name        : convert-to-edition
Arch        : noarch
Epoch       : 0
Version     : 25
Release     : 1
Size        : 9.7 k
Repo        : fedora
Summary     : Script for converting between Fedora Editions
URL         : https://pagure.io/fedora-release
License     : MIT
Description : Provides a script to convert the running system between Fedora Editions

So, all you need to do to convert from one edition to another is :

convert-to-edition -e <edition>

flatpak – get latest libreoffice

2017-03-20 1 min read Fedora

flatpak is tool similar to 0install. You can find more details here.

# Get the gnome-sdk gpg keys
wget https://sdk.gnome.org/keys/gnome-sdk.gpg
# Add the keys to trusted keys
flatpak remote-add --user --gpg-import=gnome-sdk.gpg gnome https://sdk.gnome.org/repo/

# Install pre-requisite gnome
flatpak install --user gnome org.gnome.Platform 3.20

# Download the flatpak file and install it. Or you can follow the next step.
wget 'http://download.documentfoundation.org/libreoffice/flatpak/latest/LibreOffice.flatpak'
flatpak install --user --bundle LibreOffice.flatpak

# Install flatpak without downloading
flatpak install --user gnome org.gnome.Platform.Locale 3.20

# Run you brand new shiny latest libreoffice
flatpak run org.libreoffice.LibreOffice

# At a later date, when you want to update libreoffice.
flatpak update --user org.libreoffice.LibreOffice

systemd – start service when you enable it

2017-03-13 1 min read Fedora

More often than not for any service, I end up doing :

systemctl enable <service>
systemctl start <service>

But there is shorcut to this. In systemctl command when you enable the service, you can use “–now” to start the service as follows:

systemctl enable --now <service>

quite a timesaver 🙂

Older posts Newer posts