Donnerstag, 29. August 2013

Create Virtual Machine with Windows Guest using Qemu/KVM in Ubuntu Linux


I think Qemu/KVM represents a nice native alternative to Virtualbox or similar. Although all the GUI-tools (like aQemu or Qtemu) are broken in Ubuntu 13.04, it's really easy to setup a VM using the terminal. Precisely, you only need 3 commands to get a running VM:

  1. Create an image, where your VM is installed in. For Windows (>XP) take at least 18Gb:

    qemu-img create -f qcow2 ~/VMs/Windows\ 7/Windows\ 7.qcow2 18G

  2. Install your preferred OS in the created image:

    qemu-system-x86_64 -hda ~/VMs/Windows\ 7/Windows\ 7.qcow2 -cdrom ~/windows7_image_x64_.iso -boot d -m 4096 -cpu kvm64,+nx -enable-kvm

    Explanation for the parameters:
    This launches the typical Windows installation, whereas your new image represents your HDD to install to and -cdrom sets your installation media. The -boot parameter ensures that your VM boots the proper partition (you might can leave it out) and the option -m reserves 4096MB RAM for your VM (adapt it to your system). The -cpu parameter ensures that a 64-Bit CPU is emulated, because it's a KVM CPU you have to enable KVM in Qemu too.
    Note: Adapt the options to your system, especially in case your x86 user!
     
  3. After installation completed, launch your VM with:

    qemu-system-x86_64 ~/VMs/Windows\ 7/Windows\ 7.qcow2 -m 4096 -vga std -enable-kvm -cpu kvm64,+nx

    Of course you need to define the CPU again, enable KVM and set the memory. The option -vga std enables more and higher resolution within your VM, so use it if your are unsatisfied with low resolution.
     
That's it ! Of course you can also Linux VMs with it.

Two additional tips:
  • If your mouse pointer is caged within VM, free it with LEFT-[CTRL]+[ALT]
  • You can reach your Host from the Guest from the IP 10.0.2.2. This might be handy for web developers.

Dienstag, 27. August 2013

Enable Cover-Preview for Audio Files for KDE's Dolphin in Kubuntu 13.04


Unfortunately cover art preview is still not included in KDE (see Bug-report), you can enable that feature by yourself by building and installing the Preview Plugin of RazrFalcon from kde-look.org.

So, if you ever wanted a cover art preview for audio in Dolphin, e.g. like Nautilus has, here's my guide to make it work in Kubuntu (13.04):


  1. Install the necessary dependencies for building:

    sudo apt-get install cmake automake kde-workspace-dev libtag1-dev libqt4-dev libflac++6 libflac++-dev libtag-extras-dev

  2. Get the sources of the plugin:

    wget http://kde-look.org/CONTENT/content-files/145088-AudioThumbs-0.2.tar.gz

  3. and create a folder for it to unpack it:

    mkdir ~/audiothumbs;
    tar -zxvf 145088-AudioThumbs-0.2.tar.gz -C ~/audiothumbs


  4. Cd into the folder with sources and create a build dir and cd into it:

    cd ~/audiothumbs; mkdir build; cd build

  5. Now prepare building with cmake:

    cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ..

  6. Finally compile it with:

    make

  7. and install it with:

    sudo make install

  8. Update KDE's settings to find the new plugin:

    kbuildsycoca4

  9. End all open Dolphin windows and reopen it. Go to "Control -> Configure Dolphin... -> General -> Previews" and enable "Show previews for Audio files"

  10. Now move to your folder with music and enable preview for the folder and enjoy the cover art in dolphin

Dienstag, 20. August 2013

Completely encrypt your external HDD / USB-Key securely using Ubuntu Linux


If you ever wondered how to encrypt some external devices in Ubuntu or Linux in general, the following commands will guide you:

1. Create a crypted LUKS container for your device (replace /dev/xxx with your device):    

sudo cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-random --verify-passphrase luksFormat /dev/xxx

You can also spare the additional parameters, cryptsetup will fall back on the default  parameters. Further explanation of what each parameter means can be found here.  

2. Open you encrypted container:    

sudo cryptsetup luksOpen /dev/xxx crypt_container    

3. Create a file system within the opened container (e.g. ext4):

sudo mkfs.ext4 /dev/mapper/crypt_container


4. Close the container and unmount it:    

sudo cryptsetup luksClose crypt_container     
sudo umount /dev/xxx    

That's it. Finally, if you disconnect and replug you device, Dolphin or Nautilus  will ask you for you password and mount it as every standard device.   If you need to check your new encrypted device or partition for errors, read this.

Donnerstag, 15. August 2013

Create *.po translation files from Vala Sources with context information in Ubuntu / Linux

I recently tried to create a *.po-File for translations strings from Vala sources which include locale context information.
As it was not so easy to figure out the right command, I thought I would share it with the internet folks:

xgettext -o result.po -L C -k_ --keyword=C_:1c,2 src/*.vala

So how does this work ?
  • xgettext extracts the translatable strings from the sources 
  • ...and puts it into the output file (-o result.po)
  • ...it also requires a defined programming language in this case C (-L C)
  • ...and needs to know what are translatable keywords (_ for strings and C_:1c,2 for contextual information, in this case)
  • ...finally set the input files (src/*.vala)
It's not that hard if you understand how it works :)

Dienstag, 9. Juli 2013

Build Umbrello UML modeler from Git in K/Ubuntu 13.04

Umbrello is a neat KDE-tool to create UML diagrams. If you want to test the latest code, why not get the git version ?


Here's a small guide to build compile latest umbrello from git:

  1. Get prerequisites:

    sudo apt-get install cmake make kde-workspace-dev libboost-all-dev libxml2-dev git-core

     
  2. Get source from git:

    git clone git://anongit.kde.org/umbrello

  3. Configure umbrello:

    cd umbrello; cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix`

  4. Compile it:

    make

  5. Install it:

    sudo make install


Want to run dev version in parallel with the stable version ? No problem just change cmake according to the Umbrello FAQ


Montag, 8. Juli 2013

Download all PDF files from Springer Link or other websites in Ubuntu using wget



As a regulary visitor of Springer Link I was always bored to download every single chapter of a publication. So I put together a small wget-comment which allows me to automatically download multiple PDF files from a webpage:


wget -nd -e robots=off --wait 0.25 -r -A.pdf http://yourWebsite.net/


The option -nd stands for no-directories, which means no directories are downloade and -e robots=off forces to not download the robots.txt, because we only want PDFs. The wait command ensures that failed downloads are retried after 0.25 seconds. Additionally I use the r parameter to get PDFs from subpages recursively and -A.pdf to get PDF files only.

Got improvements ? Leave a comment !

Donnerstag, 4. Juli 2013

Kubuntu 13.04 - Enable proper auto spell-checking in KDE

Unfortunately Kubuntu does not install the required packages to enable proper application-wide spell-checking. Here is a guide to enable auto spell-checking for all applications in Kubuntu.

1. Install the required packages ($lang is your language shortcut, e.g. en or de):

sudo apt-get install kde-l10-$lang language-pack-kde-$lang aspell-$lang hunspell-$lang

2. Setup and enable auto spell-checking in KDE:


 Open the KDE system settings and go to Locale


There select Spell Checker and enable Automatic spell checking enabled by default and check your default language (in this case German (Germany)). If you finished set confirm with Apply.

In some applications spell-checking is now enabled by default, like LibreOffice Writer in other you have to enable it, like KMail (New Message -> Right-Click).

Enjoy !