FAQforge provides answers for frequently asked questions for the Linux-, MAC and Windows operating systems.

If you use a squid reverse proxy in front of your apache webserver to reduce the load, it might happen that pages are not cached correctly because the website script running on the apache webserver sends wrong caching headers. I had this problem with a wordpress install, wordpress had always send pragma no-cache headers with the pages so squid reported a cache miss for every page request. A simple solution for this is to use apache mod_headers to delete the no chache header and replace it with a header for 10 minute cache period.

First, ensure that mod_herders is enabled. To do this in Debian and Ubuntu, run the command:

a2enmod headers

Then create a .htaccess file in the website root directoyr which contains the following lines:

Header unset Pragma
Header set Cache-Control “must-revalidate, max-age=0, s-maxage=600″
Header set Vary “Accept-Encoding”

How to Update ISPConfig 3

Friday, February 19, 2010 - posted by Till

The ISPConfig update script is a easy way to update a ISPConfig 3 installation. If you want to create a manual backup of ISPConfig, take a look at the instructions at the end of the article.

To update ISPConfig 3, login as root user on the shell of your server and run the command:

ispconfig_update.sh

>> Update

Please choose the update method. For production systems select ‘stable’.
The update from svn is only for development systems and may break your current setup.

Select update method (stable,svn) [stable]:

You should always select “stable” on a production system. The “svn” version is only suitable for ISPConfig 3 development.

The updater will then check the version of your system, download the latest update and starts the update process.

This application will update ISPConfig 3 on your server.

Shall the script create a ISPConfig backup in /var/backup/ now? (yes,no) [yes]:

You should choose “yes” here. This will create a backup of the ISPConfig scripts (/usr/local/ispconfig), the /etc directory and the ISPC0nfig MySQL database in the directory /var/backup/

Creating backup of “/usr/local/ispconfig” directory…
Creating backup of “/etc” directory…
Checking ISPConfig database .. OK
Starting incremental database update.

The update script will then start to install incremental database updates for ISPConfig, if required.

Reconfigure Permissions in master database? (yes,no) [no]:

If this is a slave server in a multiserver setup, then choose “yes” here on at least one of the slave servers. For single server installations, choose ‘no’. Then you were asked if the services shall be reconfigured:

Reconfigure Services? (yes,no) [yes]:

You should choose “yes” here, only if you modified your system configuration manually, it might be better to choose no. But in this case, new features in ISPConfig might not work or functions might stop working until you adjusted the config files manually. So its always a good choice to select ‘yes’ here. In the next step, select the ispconfig port:

ISPConfig Port [8080]:

Port 8080 is the default, if you have not changed it, press enter. Otherwise enter the port number and then press enter. As the last step, you wre asked if the crontab shall get reconfigured, you can select yes here by just pressing return.

Create new ISPConfig SSL certificate (yes,no) [no]:

If your SSL certificate for the ISPConfig interface has been expired and you want to renew it or if you want to enable SSL encryption for the ISPConfig interface, then choose “yes”. If you dont need a new SSL certificate, take the default (no).

Reconfigure Crontab? (yes,no) [yes]:

The ISPConfig updater will then update the ispconfig files and restart services, if the configuration has been changed.

Backup before updates

(This backup procedure is now integrated into the ISPConfig updater and gets executed automatically when you choose to create a backup during update)

Before you update a software, it is always a good idea to backup all relevant data. This enables you to restore the software version that you had before in case of an error. The steps to create a backup of the ispconfig software and settings are:

Create a backup folder:

mkdir /home/backup
chmod 700 /home/backup
cd /home/backup

Backup the database

mysqldump -u root -p dbispconfig > dbispconfig.sql

Backup the ISPConfig software

tar pcfz ispconfig_software.tar.gz /usr/local/ispconfig

Backup the configuration files in /etc

tar pcfz etc.tar.gz /etc

This backup does not include the emails and website data.

Rerun the last command with sudo on the Linux shell

Friday, February 19, 2010 - posted by Till

Have you ever executed a command on the shell and noticed the that you had to run it with sudo? Instead of typing the command again with “sudo” in front of it, just run:

sudo !!

which will execute the command that was run before with sudo. Thanks to Planetfox for this tipp.

Keep the spamassassin filter rules up to date in ISPConfig 3

Friday, February 5, 2010 - posted by Till

To update the spamassassin rules regularily on your ISPConfig 3 server, add the following line to the root crontab by running:

crontab -e

then insert the following line:

23 4 */2 * * /usr/bin/sa-update –no-gpg &> /dev/null

and save the file. The path to the sa-update script is /usr/bin/sa-update on Ubuntu and Debian Linux, if you use a different linux distrubution, run the command:

which sa-update

to find the location of the sa-update script and adjust the path in the crontab line above so that it matches the path on your system.

How to kill processes in “D” state in Linux?

Tuesday, February 2, 2010 - posted by Till

If a process is shown with process state “D” in tools like ps or top, then its a zombie process. Example:

ps axl | grep D

F   UID   PID  PPID PRI  NI    VSZ   RSS WCHAN  STAT TTY        TIME COMMAND
4   104  2579  9109  20   0   5024  2116 refrig D    ?          0:00 cleanup -z -t unix -u -c

Zombie processes can not be killed with the normal commands like “kill -9 PID”, you will have to reboot the system to kill them.

Sometimes you need to know which debian package contains a specific file e.g. because you deleted a system file accidently or you try to install a new software that requires this file. The apt package management utility which is used in Debian and Ubuntu comes with a handy tool called apt-file which allows a saerch for filenames in the package database.

Install apt-file

apt-get install apt-file

Update the apt-file database

apt-file update

Search for a specific file name, e.g. “lcrypto”

apt-file search /bin/bash

apt-file search /bin/bash
bash: /bin/bash
bash: /usr/bin/bashbug
bash-minimal: /bin/bash-minimal
bash-static: /bin/bash-static
bashdb: /usr/bin/bashdb
mybashburn: /usr/bin/bashburn

Calibrate the screen colors and gamma in Windows 7

Wednesday, January 20, 2010 - posted by Till

To start the Windows 7 dccw application that calibrates the colors and gamma of your monitor, press the keys [Windows] + [R] to open the windows command line and enter:

dccw

Then click on “OK”.

and click on “next” and  follow the instructions on the screen.

Robocopy single- and multithreaded benchmark on Windows 7

Monday, January 18, 2010 - posted by Till

A commenter of my robocopy article asked me if a multithreaded copy tool like robocopy is really faster then a single threaded copy tool like xcopy as normally the harddisk is the bottleneck and not the CPU when copying files. As I did not found any benchmarks, I decided to do my own benchmark. Here are the results:

In my test, I copied a folder hierarchy with 429 directories and 6313 files with a overall size of 522 MB. I’ve run every test 2 times to ensure that the speed differences are not caused by filesystem caching. I know that this test was not made under scientific conditions, so if you have your own results, feel free to post them here as comment.

xcopy

Command:

xcopy D:\server\test D:\tmp\test /D /E /Y /Q

Time to copy files

First run: 42 seconds
Second run: 41 seconds

robocopy with 1 thread

Command:

robocopy D:\server\test D:\tmp\test /MT:1 /E /LOG:d:\tmp\robocopy.log

Time to copy the files

First run: 43 seconds
Second run: 41 seconds

robocopy with 10 threads

Command:

robocopy D:\server\test D:\tmp\test /MT:10 /E /LOG:d:\tmp\robocopy.log

Time to copy the files

First run: 38 seconds
Second run: 36 seconds

Conclusion: Using a multithreaded copy tool like robocopy with 10 threads speeds up file copying and makes sense if you have to copy a large number of files. At least on my system.

Copy files faster in Windows 7 with robocopy

Thursday, January 14, 2010 - posted by Till

Windows 7 comes with a new version of the robocopy command that is able to copy files much faster then the normal copy command or copy function of the file explorer by using several simultanious threads. So if you plan to copy a large number of files, e.g. to make a backup, use the robocopy command.

Example Copy files from C:\myFiles to F:\backup and use 10 simultanious threads. To execute robocopy, open the windows shell window or press the keys [Windows] + [R] to open the windows command line, then enter the command:

robocopy C:\myFiles F:\backup /MT:10

To get the full list of robocopy options, execute the command:

robocopy /?

For Windows XP or Vista, you can get the robocopy command from the Microsoft Resource Kit Tools

How to create a rescue CD in Windows 7

Thursday, January 14, 2010 - posted by Till

Windows 7 contains a application to create a rescue CD easily which can be used to boot the system and diagnose problems in Windows.

To create the rescue disc, press the keys [Windows] + [R] to open the windows command line and enter:

systemre