Philipp's Computing Blog

Success is about speed and efficiency

Posts with the category Ubuntu 10.10

Resize Images from Context Menu on Gnome / Ubuntu Linux

Easiest way using the Ubuntu/Debian package nautilus-image-converter:

sudo apt-get install nautilus-image-converter

Using a Custom Photo Resize Script for the Nautilus File Manager

This context menu script can resize to 3 predefined sizes (more can be added) and it asks to put the resized pics in a folder or rename them. Put...

Read on

Install Python Library for WordPress XML-RPC integration

cd ~/Downloads
git clone git://
cd python-wordpress-xmlrpc
python install



Read on

Have a look into an .ipk file (used by the ipkg or opkg manager)

An .ipk file is basically just a .tar.gz file. So you can unpack it using the tar command:

tar xvfz some-package.ipk
# or with newer tar versions:
tar -xf some-package.ipk

Some .ipk files may also be of a different archive format so that you need the following command to unpack:

ar x some-awesome-package.ipk


Read on

Web Interfaces for the Bind DNS Server

API solutions:

Not a...

Read on

iSCSI on Ubuntu Linux

iSCSI is a software system (may be implemented in hardware) to mount remote block level devices locally. It does not provide a remote filesystem and thus is independent of the filesystem you might want to use on top of it.

iSCSI Target : PC that offers a block device to be...

Read on

Get your own DNS server up and running with Bind9 on Ubuntu or Debian

The goal of this article is to describe how to setup your own DNS server to serve the domain name service entries for a TLD ( In the last part of the article I describe how to increase the speed of the system and the security in...

Read on

[solved] /var/log/syslog missing inside LXC container

This can be solved by simply installing the package syslogd:

apt-get install syslogd



Read on

Create the latest FritzBox! Firmware for the Speedport W 900V

Installation of the Tool

First, get the script Run it and install all required tools.

cd ~/Downloads
tar -xf

Configuration and Firmware Creation


  • Choose Hardware Type → Speedport W900V
  • Select a special AVM firmware → yes, choose 7170 19138 - pre-release

Exit the menuconfig and the firmware creation will begin.

At first, I...

Read on

(Automated) Manual Backup of a Drupal 7 Website (Including the Database)

Did you ever want to create a backup of both, your drupal 7 installation files and the associated mysql database? Here is how you can do it with almost no configuration.


#                 ...

Read on

Create a git repo from .tar.gz files with versions as commits

Say you have a bunch of .tar.gz files, each representing a certain version of a program source code. If you want to compare their contents and see what changed, git would help a lot.

So I wrote a script that would do the work for me and create a repository for...

Read on

Install the Apache2 mod_pagespeed to Improve Performance

mod_pagespeed is an apache2 module made by Google to improve the speed of website delivery.

Download of the 32 bit version:


Download of the 64 bit version:


Installation of the package:

dpkg -i mod-pagespeed-beta_current_*.deb
apt-get -f install

Restart Apache:

/etc/init.d/apache2 restart

If you like, change /etc/apache2/mods-available/pagespeed.conf. according to the manual Using...

Read on

Install a Git Plugin for VIM: git-vim

To install git-vim run:

cd ~/Downloads
git clone
cd git-vim
# by default, the Makefile is set up for Mac OS. If you use a different OS change it using:
cat Makefile | sed "s|#INSTALL=install|INSTALL=install|g" | grep -v ginstall > Makefile
# then install the plugin:
make install

This will copy the following files to ~/.vim:

  • plugin/git.vim
  • syntax/:
    • git-diff.vim
    • git-log.vim
    • git-status.vim
  • doc/git-vim.txt


Read on

Set up Vim for Python



Read on

Set up sending emails on a local system by Transfering it to a SMTP-Relay-Server (Smarthost)

SMTP-Relay-Server = Mail-Relay-Server = Smarthost


A slim smtp forwarding tool can be installed via the package ssmtp (it provides /usr/sbin/sendmail):

# apt-get install ssmtp

The configuration file /etc/ssmtp/ssmtp.conf:

# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.

# The place where the mail goes. The...

Read on

Backup Google Contacts

Possible Choices


Read on

Make Piwik Detect the Header X-Forwarded-For or X-Real-IP (that for example nginx can set as reverse proxy for your site)

If you run a Piwik installation behind an nginx reverse proxy, you have to change a bit of your configuration because the remote IP has changed to that of the nginx reverse proxy.

For example if your nginx reverse proxy configurations includes:

proxy_set_header HOST $host;
proxy_set_header X-Real-IP  $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


Read on

Database abstraction with Python: SQLAlchemy

The SQLAlchemy SQL Toolkit and Object Relational Mapper is a comprehensive set of tools for working with databases and Python. It has several distinct areas of functionality which can be used individually or combined together. Its major API components, all public-facing, are illustrated below:

|     ...

Read on

documentation with user comments:

install on Ubuntu (German)

sudo apt-get install postgresql

pgAdmin III is a handy GUI for PostgreSQL, it is essential to beginners. To install it, type at the command line:

sudo apt-get install pgadmin3

Setup: Now you have to set the password for the admin user...

Read on

Sketch of an Advanced HDD / Partition Setup with high availability (mdadm software raid), encryption (dm-crypt) and high flexibility (lvm volume management)

Recently I found an interesting comment on an article about Fedora 16 maybe using btrfs as default file system: The author Vanger explained his current hard disk / partiton setup on a server and how he hopes to get a more efficient system with btrfs. More than the outlook...

Read on

Screen Resolution of gdm (Ubuntu Login Screen)

To set the screen resolution of gdm when you don't use a proprietary graphics card driver, go to System → Preferences → Monitors, choose the desired resolution, test it (by applying it) and click on Make Default.



Read on

Making Apache2 run faster with less memory: Run it in worker mode

apt-get install libapache2-mod-fcgid php5-cgi apache2-common apache2-mpm-worker apache2-suexec
a2enmod fcgid
a2enmod suexec

If you want the document root to be something different to /var/www, you need apache2-suexec-custom instead of apache2-suexec.

Now let's create a user PHP will run as and create the directory structure for our new site.




apt-get update
apt-get install -y libapache2-mod-fcgid...

Read on

Whois for IP on the Command Line and Online

If you want to know who is behind an IP address (or a domain name) you should use the command line tool whois, which Mac OS X, most Linux and BSD distributions ship. For example, if you want to get information on the IP


And the output looks...

Read on

Start Linux Containers (LXC) at Startup


The built in possibility on Ubuntu / Debian is to change the configuration file /etc/default/lxc:

CONTAINERS="vm0 vm1"

In this example, vm0 and vm1 are LXC configuration files stored or linked in /etc/lxc. These containers will be started at startup.

custom init script /etc/init.d/lxc

Instead of the init script shipping with Ubuntu and...

Read on

Upgrade Ubuntu to Development Release

Run update-manager with the option -d for development release:

update-manager -d

Or if you don't want run that gui (because you are running an Ubuntu server) then you have to change your apt sources:

sudo sed -i 's/OLD_VERSION/NEW_VERSION/g' /etc/apt/sources.list
sudo apt-get dist-upgrade --fix-missing
# you also might want to run the following lines:

Read on

SSD optimizations on Linux

  • Use the mount option relatime (or noatime if you are brave) for the SSD partitions in /etc/fstab.
  • Replace several directories (those, the system writes to frequently) with a tmpfs file system as shown below.
  • Disable Firefox caching by setting browser.cache.disk.enable to false in about:config.
    Alternatively create the entry browser.cache.disk.parent_directory and set...

Read on

Clear Cached Memory on Ubuntu

To clear the cache / cached memory (free pagecache, dentries and inodes) on Ubuntu or Debian you can write the value 3 to /proc/sys/vm/drop_caches:

# You should be the superuser ('root') or become the superuser:
sudo su
# Now sync filesystem and clear the caches:
sync && echo 3 > /proc/sys/vm/drop_caches

Or use...

Read on

[solved] mysql_upgrade failes due to "1045: Access denied"

Error when trying to upgrade the mysql tables using mysql_upgrade:

root@fooserver:/root# mysql_upgrade 
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' 
mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect
FATAL ERROR: Upgrade failed

The solution is to run...

Read on

Create an LXC Application Container using libvirt

LXC application containers are good tools to isolate single applications. Instead of directly creating them using lxc-create you can also create them with libvirt / virsh.

If you have dnsmasq installed and running globally you will get into trouble running net-start default. So follow the advice on
Now let's create...

Read on

Install the CMS e107 from .tar.gz

e107 is a nifty content management system for websites. It has lots of extensions and is ideally suited for portal websites.

Installation log for e107 on Ubuntu 10.10:

sudo mkdir -p /var/www/e107
cd /var/www/e107
sudo chown $USER ./
tar -xf download
echo "CREATE DATABASE e107;" | mysql -u root -p
echo "GRANT all ON e107.*...

Read on

Communicate with Other Users on a Shared Linux Computer using the Command wall

If you work with multiple users on the same Linux computer remotely you might want to communicate with other users that are logged in. This could be the case for example if their processes slow down the computer and you want to ask them about it. A simple way to...

Read on

Install pfSense in KVM on Ubuntu 10.10

The blog post describes how to install the firewall distribution pfSense based on FreeBSD in a kernel based virtual machine (KVM) on Ubuntu 10.10.

Specialities: you either need two NICs or a single one with VLANs as pfSense requires you to define at least one WAN and one LAN interface.

First, get...

Read on

Installing Ubuntu 10.10 Netbook Edition on Asus eee PC 900

I was not successfull creating a bootable USB stick for the netbook using Mac OS X by following the steps described on the Ubuntu download page.

What worked: I started a virtual machine with Ubuntu and connected the USB stick to it. Then I ran the Startup Disk Creator. I...

Read on

Install FreeBSD 8.1 as a Virtual Machine in KVM on Ubuntu 10.10

Install KVM and libvirt:

sudo apt-get install kvm virtinst libvirt-bin

If you also want the graphical helpers (viewer via vnc and a manager of the installed virtual machines) install:

sudo apt-get install virt-viewer virt-manager

Now set up the connection to the local KVM hypervisor:

sudo virsh connect qemu:///system

Get the installation DVD (for...

Read on

Logical Volume Manager

sudo apt-get install lvm2

To create a logical volume on a loop device (/dev/loop1 stored in ~/.lvmcontainer):

dd if=/dev/zero of=~/.lvmcontainer bs=512 count=2048000
sudo losetup /dev/loop1 ~/.lvmcontainer
sudo pvcreate /dev/loop1 # initialize /dev/loop1 as a physical volume
sudo vgcreate volg1 /dev/loop1 # create the volume group volg1, consisting of /dev/loop1
sudo lvcreate -L 48M -n...

Read on

The btrfs File System

The btrfs file system is the future of linux file systems.

sudo apt-get install btrfs-tools     
sudo mkfs.btrfs /dev/sdXY


  • efficient snapshots (and subvolumes)
  • automatic calculation of hashes for data and metadata (better data integrity)
  • transparent compression (mount option compress)
  • solid state disk optimization (mount option ssd)
  • copy on write (better data integrity)
  • direct...

Read on

Loop Devices

It's called loop device not loopback device (which is related to networking)!

To create a file with 50 MiB of 0x00 (51,200 blocks with 1024 byte each = 50 MiB) and create the block device /dev/loop1 from it:

dd if=/dev/zero of=~/.lvmcontainer bs=1024 count=51200
sudo losetup /dev/loop1 ~/.lvmcontainer
## and to detach /dev/loop1 again...

Read on

Bind Multiple IPs To One Physical Interface on Linux

In advanced computing you may encounter situations where you want to bind multiple IP addresses on one physical network interface. This post describes how to do it with Ubuntu Linux (should work with Debian too).

Temporarily with ifconfig

This method is temporary only as the additional IP address will be gone after...

Read on

Automatically Update Packages on a Ubuntu or Debian Server

To automatically install updates on Ubuntu / Debian you can install the package cron-apt:

sudo aptitude install cron-apt

In /etc/cron-apt/config you can set up your email address for notifications by setting the value for MAILTO.



Read on

Backup of Webserver

The backup of a webserver is not always as straightforward as the backup of your computers at home or just a single website etc. This blog states how I do it.


### set to the server address of your server:

## login as root and create the file /serverbackup.tar.gz...

Read on

Usage of a Ramdisk on Linux

The older approach involves the creation of an ext3 filesystem on /dev/ram0 (a part of the RAM):

sudo mke2fs -t ext3 -m 0 -q /dev/ram0
sudo mkdir -p /media/ram0
sudo mount /dev/ram0 /media/ram0
sudo chown USERNAME /media/ram0
sudo chmod u+rwx /media/ram0

The newer and easier method to create a ramdisk is to make use...

Read on

Container Virtualization using LXC on Ubuntu

LXC (Linux Containers) is an operating system-level virtualization method for running multiple isolated Linux systems (containers) on a single control host. LXC does not provide a virtual machine, but rather provides a virtual environment that has its own process and network space. It is similar to a chroot, but offers...

Read on

Safe Modifications on WordPress Themes using Child Themes

All you have to do is to create a folder for your child theme in wp-content/themes/ and in there create a style.css file like this one (Template):

 * Theme Name: Suffusion modified by Philipp Klaus
 * Template: suffusion
 * Description: a customized version of the Suffusion theme.

Read on

Chinese OCR

OCR for Windows

OCR for Mac OS

Read on

Backup saved passwords in Ubuntu

To make a backup of the saved passwords in Ubuntu just make a backup of the folder ~/.gnome2/keyrings/. This is where Gnome stores its password keyrings (named something like somename.keyring).

You can also export all your passwords from the Gnome Keyring using the python module keyring as described in

Read on

Install WordPress on Ubuntu (Including Markdown Markup Support)

cd /var/www/
tar -xf latest.tar.gz
rm latest.tar.gz

Markdown for Wordpress
also nice but not working yet (at least on my installation):

Markdown is a great markup language for publications such as technical blogs as it keeps the structure of the text very readable, is fast...

Read on

calculate pi to a 1000 digits

Here is a shell / Bash script that calculates Pi to 1000 digits:

bc -l <<< 'scale=1000; 4*a(1)'
# which is shorter than the equivalent
echo "scale=1000;4*a(1)" | bc -l

One more calculation using bc: the golden ratio to 10 digits:

bc -l <<< 'scale=10;(1 + sqrt(5))/2'


  • If you want...

Read on

control BOINC using the CLI boinccmd

boinccmd --join_acct_mgr user PASSWORD

If you get Authorization failure: -155 errors all the time, search for files named gui_rpc_auth.cfg and delete them if they are outside the /etc or /var directory.


Read on

Launch Ubuntu 10.10 maverick in the EC2 cloud

sudo apt-get install ec2-api-tools
cat <<'EOM' >~/.bashrc
######## modifications by Philipp Klaus:
export EC2_URL=
export EC2_CERT=$HOME/.ssh/amazon-x509_cert-ODKN47NWKLVFADJVDU2PJUEIFHLZSGFJ.pem
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
ec2-authorize default -p 22
ec2-run-instances ami-29b0855d --instance-type t1.micro --region eu-west-1 --key mykey
ec2-add-keypair ec2-keypair > amazon-ec2-keypair.pem
chmod 600 amazon-ec2-keypair.pem

you may now log in using

ssh -i ./amazon-ec2-keypair.pem

Read on

Boot Info Script

T get the boot_info_script, run:

cd ~/Downloads
wget -O

To execute the boot_info_script and thus get information about your bootable partitions etc., run:

sudo bash ~/Downloads/



Read on

Convert a String of Hex Values to its Binary Representation Using sed

Suggest you have data in a hex format that you want to convert back to binary (like an MBR) with newline characters in the middle:


Like this you can convert it back to its binary content:

cat datafile.txt | echo -n -e $(tr -d '[:space:]' | sed 's/../\\x&/g')



Read on

Use Ghostscript to create PNG Images from a PDF

ghostscript -dNOPAUSE -dBATCH -r300 -sDEVICE=pnggray -sOutputFile="test.png" "TestFile.PDF"

Read on

fix bad resolutions with Ubuntu as guest in VMware Fusion 3.1.2

Problem during run of sudo /usr/bin/

Skipping X configuration because X drivers are not included.

This fixed it:

sudo apt-get remove xserver-xorg-video-vmware
sudo apt-get install xserver-xorg-video-vmware

Read on

reset Fonts to defaults

Sometimes your fonts can get messed up when you use Ubuntu for more than one release cycle. So to reset the proper fonts used with todays distributions of Ubuntu without creating a new user account go to Preferences → Appearance Preferences.
For all Fonts choose size 10. Chose Sans for all but...

Read on

Install JVerein (including Jameica and Hibiscus)

Install the Requirements: Jameica and Hibiscus

Manual Installation (German)

sudo aptitude install sun-javadb-client
# or if you are on a 64bit OS:
sudo unzip

Read on

Get the latest Skin for Mediawiki: Vector

This commands gets you the latest skin for Mediawiki:

svn checkout

But be reminded that you will only be able to use the plugin with Mediawiki 1.16 and above so just upgrading to the latest Mediawiki release is usually enough to get the skin. I could not get...

Read on

change a value in a MySQL database BY HAND on the terminal

mysql -u dbusername -p

now you are on the MySQL prompt. So to change all option_value in the table firestats_firestats_options to en_US where the option_key equals current_language do:

USE dbname;
SELECT * from firestats_firestats_options;
UPDATE firestats_firestats_options SET option_value="en_US" where option_key="current_language";

Read on

Use pandoc To Convert LaTeX to Markdown

Pandoc is a tool to convert documents from one format to another and it supports quite some formats! You can test it and convert small docs online:

Supported input formats include

  • markdown,
  • html,
  • latex, and rst.

Note that the rst reader only parses a subset of reStructuredText syntax. (The latex and html input readers...

Read on

Install TaskFreak!

Here is how you can install the TaskFreak! System:

# Get the Taskfreak bundle from
tar xzf /tmp/taskfreak-multi-mysql-0.6.tgz -C /var/www
mv /var/www/taskfreak-0.6.4/ /var/www/taskmanagement

Then create the database:

echo "CREATE DATABASE taskfreak;" | mysql -u root -p
echo "GRANT all ON taskfreak.* TO 'taskfreak'@'localhost' IDENTIFIED BY 'passwordXYZ';" | mysql...

Read on

Task Management Tools

Task Management Tools with a Graphical User Interface

Web Based Task Management Tools

Calendar Tools

For the Command Line

Read on

install latest version of non-free Virtualbox


sudo add-apt-repository "deb maverick non-free"
wget -q -O- | sudo apt-key add -
sudo apt-get update
sudo apt-get install virtualbox-3.2

I got an error, so I had to run

sudo apt-get clean

and delete the following line from my /etc/apt/sources.list:

deb-src maverick non-free



Read on

Chinese input using iBus

Starting with 10.04 lucid and also on 10.10 maverick you should switch over from scim to the ibus input method. This is described in the links stated below.



Read on

Have a Deep Look into the File System

Tools you might want and/or need:


Read on

Install Latest Version of WINE

sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine1.3

Read on

Mount T-Online Mediencenter via WebDAV

This blog post describes how to mount the T-Online Mediencenter via WebDAV on Ubuntu Linux and on Windows 7 (64bit).


How To for Mac OS X

  1. Open Finder.
  2. Press [⌘]-[k].
  3. Connect to
  4. Enter email address and password.

How To for Ubuntu Linux

First, install the required package davfs2:

sudo apt-get...

Read on

Install QlandkarteGT

sudo add-apt-repository ppa:mms-prodeia/ppa
sudo aptitude update
sudo aptitude install qlandkartegt

Read on

gedit Markdown plugin

For an up-to-date version of the information about the gedit Markdown plugin go to the new blog post Markdown for the Gedit Text Editor on Ubuntu 11.04.

If you frequently have to create Markdown documents, you might want your text editor of choice to support you. M Fleury developed...

Read on

AqBanking CLI

AqBanking is used as a backend for gnucash and therefore very mature. It features a CLI to query CSV files of transactions and more.

There is a newer blog post on this subject: AqBanking CLI on Mac OS...

Read on

OfflineIMAP - have a local copy of your mail

While it is very convenient to have all mail available online and it is cheap (Google Mail offers a lot of storage for free), you might sleep better at night if you were sure to have a copy of you mail on your own hard disk drive at home. offlineimap...

Read on


This blog post has grown to large. Please refer to the more detailed posts on IPv6 tagged with ipv6:

DNS entries for IPv6 ready web sites

  • A record: normal domain to ip address resolution
  • MX record: email server lookup, must resolve to a server address that is resolved to an IP...

Read on

Network Traffic Counters Like vnstat And ntop


Install the command line program vnstat, a network traffic counter, on Ubuntu:

sudo aptitude install vnstat

Set up vnstat for your (e.g. dial-up: ppp0) internet connection:

sudo vnstat -u -i ppp0

View traffic:


Set up a PHP based vnstat frontend


cd ~/Downloads
git clone git://
sudo cp -R vnstat-php-frontend /var/www/vnstat

change the configuration...

Read on