Feb 282011
 

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 at the btrfs future I was stunned by his current setup that I try to present in this image:

He combined mdadm, dm-crypt and lvs to have a server system with the following properties:

  • high availability by the use of a redundant array of disks (raid)
Sketch of an Advanced HDD / Partition Setup with high availability (mdadm software raid), encryption (dm-crypt) and high flexibility (lvm volume management)
Feb 282011
 

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

VN:F [1.9.22_1171]
Rating: 10.0/10 (2 votes cast)
Feb 282011
 
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.

Feb 282011
 

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 looks like this:

Feb 272011
 

/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 the init script shipping with Ubuntu and Debian, you can use a custom init script (/etc/init.d/lxc) as the one from this commit on github.com. It does not make use of /etc/default/lxc to set up the containers to be run at startup but a mark.

Feb 272011
 

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:
sudo dpkg --configure -a && sudo update-grub && sudo apt-get autoremove -f && sudo apt-get clean 

For example if you want to upgrade from Ubuntu maverick to natty then replace OLD_VERSION with maverick and NEW_VERSION with natty.

resources

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
Feb 222011
 
  • 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 it to /tmp.
  • Tell grub2 to boot the kernel without optimisation for regular HDDs by adding elevator=noop to the GRUB_CMDLINE_LINUX_DEFAULT= parameter in /etc/default/grub. Afterwards run sudo update-grub2.
    If you want to use the elevator deadline (not noop) you may enable the fifo_batch for sda: echo 1 > /sys/block/sda/queue/iosched/fifo_batch
Feb 202011
 

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

sudo sync; echo 4 | sudo tee /proc/sys/vm/drop_caches > /dev/null

Or use this the script below. It can be run on Ubuntu and Debian (without sudo) and with or without X and will also inform you about the amount of RAM cleared by the operation:

resources

VN:F [1.9.22_1171]
Rating: 8.0/10 (1 vote cast)
Feb 182011
 

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 mysql with the option --skip-grant-tables and then do the upgrade:

/etc/init.d/mysql stop
/usr/bin/mysqld_safe --skip-grant-tables&

mysql_upgrade

/etc/init.d/mysql stop 
/etc/init.d/mysql start

resources

VN:F [1.9.22_1171]
Rating: 10.0/10 (4 votes cast)
Feb 172011
 

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 the virtual network for virsh (libvirt):

sudo virsh --connect lxc:/// net-start default

If you want to know how the default network is configured, then run sudo virsh net-dumpxml default.

Now create the xml configuration file for the application container, let’s say application-test.xml: