VMWare ESXi Test Installation

January 30th, 2009 Category: VMWare

The Try

I’ve been using VMWare ESX for several years now in my company with great success. It made things really easier. Of course it’s not for free, but it’s really worth the money you pay for it. So it was really a surprise when I recognized that there is a new and free VMWare ESXi for download available from the VMWare homepage. Sounds interesting, OK let’s try it.

Just Download

So I went to the VMWare homepage and downloaded the ESXi ISO install image. After the short registration which is needed for download you will automatically receive the license key via e-mail. For installation the license key is not needed, ESXi will work fo 60 days after installation.

Installation

2-how-to-install-vmware-esx-server-3i-3.gif After writing the ISO to a CD-ROM and booting the PC from it I reconized that ESXi did not detect my good old 20 GB PATA hard disc. After putting a 160 GB SATA disc in and booting again my hard disc was detected correct and ESXi installed perfectly. But after first boot no IP adsress was assigned (0.0.0.0). After some Google research in found out that my onboard network card was not detected and that ESXi currently mainly supports Intel network cards. Fortunatly I found a old Intel Etherexpress 10/100  PCI card in the company, put it in my desktop and booted again. And oh surprise, the NIC was detected and a IP address was assigned via DHCP.

First Contact

vollbildaufzeichnung-30012009-190520.jpg After typing the IP address of the ESXi machine in the browser the VMWare Infrastructure Client can be downloaded and installed. New virtual machines are installed, managed and so on using the Infrastructure Client via Network. My first plan was to install Debian Etch from the net-install CD-ROM, but ESXi did not detect my CD-ROM (maybe I’ve disconnected the cable while installing the Intel NIC card, not sure). But it doesn’t matter because you can easily mount the CD-ROM of your client where Infrastructure Client is running or also just mount an ISO image. It worked and Debian Etch was installed. To check the performance on my Intel 2×3GHz 2GB RAM desktop I added Windows 2000 as second virtual machine. It also installed without problems. Very nice!

It’s Working

So far I’ve recognized command line tools like vcbMounter and vcbRestore are not available on the ESXi host like on ESX hosts which can be used for automated backups. But I’ll need to further investigate ESXi, for now it’s already running within a very short time – amazing. And it helps to warm up my living room when the 2xGHz desktop machine is running the whole day…

Screenshots

The Incredible Notebook Cooler

January 25th, 2009 Category: Fun, General

When my Dell notebook Latitude D820 warms up (means running for a few hours) I hear the fan louder than in the beginning also there is not much CPU load. It seems the whole notebook warms up. Cleaning the notebook with a vacuum cleaner did not help. I got this tip from a woman, for her notebook this works. Ok, a noisy fan is disturbing.

Before purchasing a notebook cooler I decided to check if such a external cooler with fan could really cool down the notebook. I tried several positions with a simple PC fan and finally found one position which cools down the CPU temperature in idle mode from 50°C to 38°C. Now the fans of the notebook are almost noiseless.

A incredible result! But I think I will purchase a more nice looking notebook cooler soon. Cooling down your notebook will also improve it’s life time since all electronic components really don’t like heat. You can read this e.g. from official statistical data from some hard disc vendors, which show how life time increases with higher environment temperature.

Putting the slow rotating fan as shown in the picture below decreased CPU temperature from 50°C to 38°C. Unbelievable!

img_5946.jpg

Annoyed of Blocked Inkjet Printers?

January 25th, 2009 Category: General

hp.jpg When you have ever owned a Inkjet printer and don’t use it every day you will know the problems: black text is printed pink (yes, in my opinion “pink” is where the name of Inkjet printers comes), nothing is printed, unwanted stripes through your text and so on. And why? Printer head is blocked.

Next what you will do is start the cleaning program of your Inket and print your page again. Fine fine, the stripes went less and pink got a different colour. Ok, cleaning program is started again. Very nice, stripes are gone but pink looses any color information. No idea why, cleaning program is started again. Hrmpf, now printer reports some colour cartridges are empty. You start searching in all available drawers for new cartdriges. Yes, found a new cyan cartdrige. So put it in the printer and wait until the printer initializes. What happens next? Printer reports magenta is empty! After searching all drawers again you recognize that you have all cartdriges available, except magenta…

At this point I decided to buy a new colour laser printer. Printing photos is not important for me, but colour would be nice. After some research I purchased the HP LasterJet CP1515N for a little bit more than 200€. It’s definitly the best printer I’ve ever had. Somewhere I read that the CP1515N should be slow, but for me it’s really fast. When I want to print I turn the printer on, walk to the notebook and print my document. I don’t have to wait or start the cleaning program.

The CP1515N comes with network interface, so I can easily print from the desktop as well as from the notebook. This printer is definitly worth it’s money.

Howto Restart Apache Graceful

January 24th, 2009 Category: Apache

Sometimes when changing settings in your Apache config, adding virtual hosts and so on it’s needed to reload/restart the Apache daemon. Usually this is done with:

/etc/init.d/apache2 restart

But there two big disadvantages using this method:

  1. If your config is invalid, Apache will shutdown and not start again
  2. Users currently accessing your server will recognize that Apache will not answer request for a short time

Indeed there is a much more better method to restart the Apache “gracefully”:

apache2ctl -t
Syntax OK


apache2ctl -k graceful

The first command will tell Apache to check your config. If everything is correct, you will get “Syntax OK”, otherwise the error will be reported but Apache will still run with the old configuration.

The second command will tell Apache to restart gracefully with the advantage that currently open connections are not aborted and the users will not be annoyed.

iPhone User Manual

January 24th, 2009 Category: iPhone
img_0002.png

When you ever got a new iPhone you will have recognized that there is no user manual delivered. The manual with 174 pages is available for download at Apple’s support website:

And the PDF with a size of 15 MByte can also viewed on your iPhone, like on the picture besides. Also this maybe not very comfortable…

By the way, do you know how to generate screen shots of your iPhone? It’s possible with Firmware version higher than 2.0: Press and hold the home button. Now press the on/off button and a screen shot will be stored in the folder “Movies (I think it should be Movie, when the language is set to German it is “Film”).

iPhone G3 Connection Problems?

January 21st, 2009 Category: Latest Featured, iPhone
img_5857.jpg

A friend of me told about connection problems with his brand new iPhone G3 (I also have one, shrug. By the way, if anyone is wondering why I’m owner of G3: the responsible person was mentioned in the first sentence of this article. So I think in case of connection problems I’ll make him responsible – sue him, ha ha!). During phone calls it happens that the connection is lost and afterwards it may take some time to find the network again. So he went to a local store of a German provider (T-Mobile) and asked. They told him “Sure, disable G3 and it will work” (G3 means UMTS connection).

Went through the internet and found some articles which seem to approve this issue. Looks like that nobody is perfect. After checking the settings of my iPhone I’ve recognized that I’ve disabled G3 in order save battery run time. This would explain why I’ve not experienced such problems. At least it sounds reasonable, doesn’t it?

Give us back good old analogue telephones with cable! Just kidding of course. If you experience similar problems feel free to post them here.

A few related links I found regarding this issue:

Howto Beautify Ugly .PHP URL’s

January 17th, 2009 Category: Apache, PHP/MySQL

You probably know this ugly .PHP links with many parameters like

http://technitip.net/test.php?param1=p1&param2=p2&param3=p3


I really don’t like this look. Doesn’t the following URL look much better?

http://technitip.net/test/p1/p2/p3


I think yes. So here is tutorial how you can beautify your links using Apache and mod_rewrite.

The Test Script

We assume that mod_rewrite is loaded in your Apache config and generate a simple PHP script called “test.php”:

<?php
echo "Parameter 1: " . $_REQUEST['param1'] . "<br />";
echo "Parameter 2: " . $_REQUEST['param2'] . "<br />";
echo "Parameter 3: " . $_REQUEST['param3'] . "<br />";
?>

This script gets the parameters param1, param2, etc. which have been given to the PHP page and prints them out. To check it we put the URL into the browser:

http://technitip.net/test.php?param1=p1&param2=p2&param3=p3

And get the result:

Parameter 1: p1
Parameter 2: p2
Parameter 3: p3

Simple Rewrite

Fine, passing parameters to our PHP script is working but still looking ugly. Now we generate a .htaccess file in the root directory of your web directory:

RewriteEngine On
RewriteBase /
RewriteRule ^(test)/?(.*)$ test.php [L,QSA,NC]

What will happen? test.php will be redirected to test and all parameters will be parsed like before, we can test it:

http://technitip.net/test?param1=p1&param2=p2&param3=p3&param4=p4

First Parameter Rewrite

Nice, but not yet what we really want. So we put another line into the .htaccess (before our first RewriteRule, not after! It’s important):

RewriteRule ^(test)/([a-z0-9]+)(/[^/]+)?/?(.*)$ test.php?param1=$2 [L,QSA,NC]
RewriteRule ^(test)/?(.*)$ test.php [L,QSA,NC]

For every parameter we need a new expression /([a-z0-9]+)(/[^/]+)?/

This will convert the line /test/p1 into test.php?param1=p1. Note that only the characters a-z und 0-9 are allowed as parameters. For the first parameter $2 is used.

Second Parameter

We repeat this step for every further parameter we need to hand over, $4 is used for the second parameter (not $3!):

RewriteRule ^(test)/([a-z0-9]+)(/[^/]+)?/([a-z0-9]+)(/[^/]+)?/?(.*)$ test.php?param1=$2&param2=$4 [L,QSA,NC]
RewriteRule ^(test)/([a-z0-9]+)(/[^/]+)?/?(.*)$ test.php?param1=$2 [L,QSA,NC]
RewriteRule ^(test)/?(.*)$ test.php [L,QSA,NC]

Three Parameters

Or with 3 parameters. Note: Since the .htaccess is parsed from top to bottom the rewrite rule with the highest number of parameters must be located at the top of the .htaccess. $6 is used for the third parameter!

RewriteRule ^(test)/([a-z0-9]+)(/[^/]+)?/([a-z0-9]+)(/[^/]+)?/([a-z0-9]+)(/[^/]+)?/?(.*)$ test.php?param1=$2&param2=$4&param3=$6 [L,QSA,NC]
RewriteRule ^(test)/([a-z0-9]+)(/[^/]+)?/([a-z0-9]+)(/[^/]+)?/?(.*)$ test.php?param1=$2&param2=$4 [L,QSA,NC]
RewriteRule ^(test)/([a-z0-9]+)(/[^/]+)?/?(.*)$ test.php?param1=$2 [L,QSA,NC]
RewriteRule ^(test)/?(.*)$ test.php [L,QSA,NC]

We test again with 3 parameters:

http://technitip.net/test/p1/p2/p3


Parameter 1: p1
Parameter 2: p2
Parameter 3: p3

Looks better, indeed.

Hint

Be sure you have enabled “Options FollowSymLinks” or Options “SymLinksIfOwnerMatch” in your Apache or virtual host config. Otherwise mod rewrite will not work!

Domain Redirects

January 16th, 2009 Category: Apache

Avoid Double Content

There are two reasons to redirect e.g. mydomain1.de to www.mydomain1.de:

  1. It avoids detecting search machines “double content”
  2. I personally prefer having one unique URL for a homepage, also if a user enters mydomain1.de he will be redirected to www.mydomain1.de
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^mydomain\.de$ [NC]
RewriteRule ^(.*) http://www.mydomain.de/$1 [L,R=301]

The redirect is defined as 301 “permanent”. Please note that these rewrite settings only work if the correct setting for “AllowOverride” is done within the Apache settings of your host or virtual host configuration.

Redirect Domain to another Domain

If you want to redirect a complete domain, here mydomain1.de including subdomains to another domain e.g. mydomain2.de put the following code into the .htaccess of the web root directory of mydomain1.de:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.*)mydomain1\.de$
RewriteRule ^(.*)$ http://www.mydomain2.de/$1 [R=301,L,NC]

Using this rewrite condition all hosts *.mydomain1.de including mydomain1.de will be redirected to www.mydomain2.de. Everything behind .de/ will be kept.

Furthermore the redirect is defined as 301 which means permanent redirect. This will avoid that search machines like Goole will treat you with “double content”.

Hint

Be sure you have enabled “Options FollowSymLinks” or Options “SymLinksIfOwnerMatch” in your Apache or virtual host config. Otherwise mod rewrite will not work!

Working with Apache/2.2.3

MySQL Performance Tips

January 11th, 2009 Category: PHP/MySQL

Optimizing a MySQL server is probably not very easy. It depends on your database structure, how many users are accessing your server and so on.

Basics

But there are a few things which could help to improve your performance. On my configuration I’ve added skip-name-resolve in my.cnf:

[mysqld]
skip-name-resolve

Now the MySQL server will not do any DNS name resolves. Please note that permissions based on hostnames will no longer work!

For security reasons I would also recommend binding only to the localhost address. Using this the MySQL server is not reachable on the Ethernet interface. In earlier version of MySQL this was usually done with the skip-networking parameter.

[mysqld]
bind-address    = 127.0.0.1

And I’ve added skip-external-locking and skip-locking:

[mysqld]

skip-external-locking
skip-locking

This could also improve your performance.

Search Length

For text search queries with a allowed length of 2 characters add this line:

ft_min_word_len="2"

Otherwise default minimum length is 3 characters, which means that a search query “select * like ‘%AB%’” will never return any data.

Cache Settings

Caching seems to be a very important thing when optimizing your server. My feeling is that the standard configuration of a MySQL server is not really designed for machines with 1 GByte memory or above.

Below is my configuration, with a few cache settings increased.

[mysqld]
query_cache_limit    =  1M
query_cache_size     = 32M
thread_cache_size    =  8
join_buffer          =  1M
table_cache          = 16M
sort_buffer_size     =  2M
read_buffer_size     =  2M
read_rnd_buffer_size =  2M
tmp_table_size       = 48M
max_allowed_packet   = 16M
thread_stack         = 128K
key_buffer_size      = 32M

This configuration works on a machine with 1 GByte RAM and several databases running. Basically I recommend to increase the cache size settings. And memory helps almost always.

Applies to MySQL version: 5.0.32

Network Bandwidth Performance Measurement with Iperf

January 10th, 2009 Category: Linux

Another easy to use tool for measuring the network bandwidth is Iperf. On Debian it can be installed using:

apt-get install iperf

Optionally the source or the Windows binary is available from sourceforge.net/projects/iperf

Building and installing from source is done using a few commands:

tar xvfz iperf-2.0.4.tar.gz
cd iperf-2.0.4
./configure
make
make install

Once installed iperf the server is started on machine 1:

machine1:~# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------

Next the client is started on machine 2:

machine2:~# iperf -c machine1.mydomain.de
------------------------------------------------------------
Client connecting to machine1.mydomain.de, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local xx.xx.xx.xx port 45325 connected with yy.yy.yy.yyport 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  96.6 MBytes  80.9 Mbits/sec

Tested on two servers connected with 100 MBit/s located at two different providers in Germany we get a result of 80.9 MBits/sec.

This result is slightly higher compared to the result from our measurement done with NETIO in the article Network Throughput Measurement. So we start the test again with addtional parameters:

machine2:~# iperf -c machine1.mydomain.de -w 512k -l 512k
------------------------------------------------------------
Client connecting to machine1.mydomain.de, TCP port 5001
TCP window size:   256 KByte (WARNING: requested   512 KByte)
------------------------------------------------------------
[  3] local xx.xx.xx.xx port 40987 connected with yy.yy.yy.yyport 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  72.0 MBytes  60.3 Mbits/sec

Now using modified read/write buffer size and TCP windows size we get almost the same result as in our test with netio.

Definitely a tool which can be recommended to check your network throughput!