NiceToHave tool for monitoring from the command line with Saidar

With Saidar you can display and view all your system statistics.

For an installation in Ubuntu or Debian you can install this with following command:

sudo apt-get install saidar

After having installed it, you can type in the command saidar:

saidar

Now you see in the following screen a complete view of your CPU, processes, load, memory, swap network I/O and disks I/O along with their free space.

The following options are supported:

-d    (Wait DELAY seconds between updates (default 3))

-v   (Prints the version number)

-h   (Display help and exits)

That's it! Thanks to Planetfox for this tipp.

How to solve the ClamAV error “This version of the ClamAV engine is outdated” on Debian 5.0 (Lenny)

As of today, all ClamAV 0.94 or older installs will stop working. The Debian project has not released updates for their current stable release (5.0) yet to solve this, but there is a workaround. The Debain volatile project provides newer clamav versions. The installation steps to install ClamAV 0.95.3 on Debian lenny are:

1) Add the debian volatile repository to the sources list:

echo "deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free" >> /etc/apt/sources.list

2) Update the sources and install the new clamav package:

apt-get update
apt-get install clamav
apt-get -u upgrade

3) If you use amavisd-new (e.g. if you use a ISPConfig 3 server) then restart amavisd:

/etc/init.d/amavis restart

Apache webserver: redirect requests for domain.com to www.domain.com

Many webmasters want to redirect users that access their websites with "domain.tld" automatically to "www.domain.tld". If you use the Apache web server, you can do this by using Apache rewrite rules.

Add a .htaccess file with the following content in the root directory of the website:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule (.*) http://www.domain.com/$1 [L,R=301]

If you use ISPConfig as hosting control panel, you can add these rules also in the Apache directives field of the website instead of a .htaccess file

Get a list of all virtual hosts which are defined in all apache configuration files

Have you ever searched where the virtual host of a website is defined in the apache config files? There is a handy option of the apache2ctl script which might help then. When you run the command:

apache2ctl -S

on the shell, you will get a list of all virtual hosts and default servers incl. the line number where it is defined. Example:

~# apache2ctl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:8080                 is a NameVirtualHost
default server ispconfig.local (/etc/apache2/sites-enabled/000-ispconfig.vhost:10)
port 8080 namevhost ispconfig.local (/etc/apache2/sites-enabled/000-ispconfig.vhost:10)
*:8081                 is a NameVirtualHost
default server ispconfig.local (/etc/apache2/sites-enabled/000-apps.vhost:10)
port 8081 namevhost ispconfig.local (/etc/apache2/sites-enabled/000-apps.vhost:10)
*:80                   is a NameVirtualHost
default server ispconfig.local (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost ispconfig.local (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost example.com (/etc/apache2/sites-enabled/example.com.vhost:7)
Syntax OK

Thanks to Planetfox for this tipp.

How to disable Apache mod_security for a website in ISPConfig 3.

If you use mod_security on your server you might encounter that a website script is not compatible with mod_security. To disable mod_security (v2) for a website, add the following code into the apache directives field:


SecRuleEngine Off

For the older mod_security 1 version, use these configuration directives:


SecFilterEngine Off

Thanks to Planetfox for this tipp.

How to remove old java versions from Windows

When you install the latest java runtime enviroment, it gets installed beside your existing java installation. With every java update, more space is used on the harddisk. To remove old java versions, there is a tool named JavaRa which can be downloaded here:

https://sourceforge.net/projects/javara/files/javara/JavaRa/JavaRa.zip/download

Unpack the JavaRa.zip file and double click on the JavaRa.exe to start JavaRa. Select the language:

and click on "Remove older versions".

How to convert RPM software packages to Debian (.deb)

Maybe you had this problem already: you use Debian or Ubuntu Linux and a software package that you like to install is only available in RPM format. The solution is a handy tool called alien, which converts .rpm files to .deb. Installing alien:

apt-get install alien

Converting a rpm package to debian format:

alien --to-deb /tmp/mysoftwarefile.rpm

Conversions from .deb to rpm are also possible:

alien --to-rpm /tmp/mysoftwarefile.deb

How to force caching headers with apache and squid reverse proxy

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

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.