Posts from 2011-02

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.

resources

...

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.

#!/bin/bash

PHPUSER=<span...

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 10.8.0.1:

whois 10.8.0.1

And the output...

Read on

Start Linux Containers (LXC) at Startup

/etc/default/lxc

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

RUN=yes
CONF_DIR=/etc/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...

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...

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...

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...

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 http://mytipsandtricson.blogspot.com/2010/12/kvm-failed-to-start-network-default-in.html.
Now let's create...

Read on

Firewalls on Mac OS X - alternatives to Little Snitch

Little Snitch is the classic user interface for the Mac OS X firewall. But it has a drawback: it costs ~30 EUR for a single licence.

The three notable alternatives are:

There are also some open source tools:

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 ./
wget http://sourceforge.net/projects/e107/files/e107/e107%20v0.7.24/e107_0.7.24_full.tar.gz/download
tar -xf download
echo "CREATE DATABASE e107;" | mysql -u root -p
echo "GRANT all ON...

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...

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...

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

Features:

  • 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...

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...

Read on