Author: admin

Apache, Linux

LDAP Installation in Debian Lenny + Web LDAP Browser

NOTE: These instructions are assuming that the LDAP client runs on the same machine as the LDAP server runs. Environment: IP: 192.168.100.27 LDAP Client Machine names: ldapc.itmatrix.srv ldapc LDAP Server Machine names: ldaps.itmatrix.srv ldaps NOTE: This tutorial is a short and updated version of the one found at: http://techpubs.spinlocksolutions.com/dklar/ldap.html Edit /etc/hosts and se the content …

Linux, SVN

SVN + WebSVN(SSL) Installation in Debian Squeeze

These instructions show how to install the SVN system and the WebSVN via Apache SSL connection. These instructions don’t explain much, I hope your are Linux/Apache savvy enough to understand them. Install the needed Debian packages apt-get install subversion libapache2-svn openssl ssl-cert a2enmod ssl a2enmod dav_svn Everything in the dav_svn.conf configuration file is already disabled. …

Linux, XEN

Xen routed ext/int(virtual private) networking at Hetzner under Debian Lenny/Squeeze 64 Bit

At Hetzner(Germany) you can rent quite hot machines for a very good price. But what happens when you want to set-up multiple Xen virtual machines? You might get into trouble unless you follow these instructions. They are probably not the only solution for a well working xen machines farm but this one worked well for me.

Linux

Disabling the flood of kernel messages in Debian console

To disable permanently all low level kernel messages (iptables etc.) from flooding the console in Debian do the following changes: (you must be root for these changes) To make the changes permanent: Edit the file /etc/sysctl.conf add the following line: kernel.printk = 4 1 1 7 The above changes will be effective at reboot or …

Linux, Monitoring

Installing Zabbix 2.2.6 on Debian Squeeze

Debian Squeeze has still the Zabbix 1.8.2, if you want the install the 2.2.6, then one solution is to follow these instructions, the other is to do the hard work all the way(not shown here :-): The easy way: Zabbix has now Binary packages ready for Debian Wheezy to install: Reference: https://www.zabbix.com/documentation/2.0/manual/installation/install_from_packages Steps for version …

Linux, MAC OS X, Windows

Speeding up Firefox Browser

Google Chrome has now eclipsed Mozilla Firefox in the speed category. However, I still use Firefox as my main web browser because it is still better than Chrome in certain areas. But just recently, I tried a few tweaks that significantly improved the speed of Firefox making it a little bit snappier than the latest …

MAC OS X

Solution to aslmanager process high CPU usage

Since the new migration of log files management from syslogd to aslmanager it is possible to encounter some problems regarding the high CPU usage by aslmanager process. One of the solution is to restart the aslmanager indexing by moving the logs in a temporary directory and restarting the syslogd/aslmanager service. Here are the commands: Stopping …

XEN

Troubleshooting no root login possible from Xen console

If you can’t login as root from the Xen console on a DomU then do the following: – stop the DomU – Mounted it on a directory through loop mount -o loop,rw /where/my/DomU/image.is /mnt/domu/ – chroot to it chroot /mnt/domu/ – Install the udev package. (it complains at the end..but no worry) apt-get install udev …

Linux, XEN

chroot inside xen VM VDSO problem

If inside a xen machine you try to do a chroot into a directory and get this error: Inconsistency detected by ld.so: rtld.c: 1192: dl_main: Assertion `(void *) ph->p_vaddr == _rtld_local._dl_sysinfo_dso’ failed! One of the possible solutions is to use the following command before issuing the chroot. echo 0 >/proc/sys/vm/vdso_enabled It is supposed to have …

Linux

Some useful Linux commands

Display the content of administrative text-based databases getent {ahosts|ahostsv4|ahostsv6|aliases|ethers|group|hosts|netgroup|network|spasswd|protocols|rpc services|shadow|gshadow} Generate secure passwords Install the tool apt-get install pwgen Generates a list of 8 char. passwords pwgen Generates 1 password of 10 char long pwgen 10 1 Get the filesystem type of a partition Get the filesystem type of /dev/sda2 file -sL /dev/sda2 Get the …

MySQL

Various MySQL useful commands

Repairing all MySQL tables mysqlcheck –repair –extended –all-databases ————- Dumping the content of all databases in SQL format. (can be used for backup/migration purposes) mysqldump -p –user=root –add-drop-table –all-databases > all_my_databases.sql Import all databases from above saved file mysql -u root -p < all_my_databases.sql ------------- Dumping the content of a single database in SQL format.(can ...

XEN

Troubleshooting PTY allocation request failed on channel 0

This is an extract from a tip from ‘Xen Virtualization community support and Howto’s.‘. Thanks guys. It saved my but. When installing new virtual machine on a Debian “Lenny” host, You might get the following error message once you try SSH the new domU: PTY allocation request failed on channel 0 stdin: is not a …

XEN

Installing Windows 2003/XP/7 32 Bit on Xen in Debian Squeeze 64 Bit.

The task here is to install, run and administrate Windows 2003/XP/7 on a remote server in Internet where Xen 4.x is already installed and HVM is supported in hardware. The steps to install and run Windows are slightly different than for Linux Guests OS. In these cases Q Emu virtualization drivers are needed to complete …

MySQL

Retrieving lost MySQL root password

It often happens. You are given the job of administrating a MySQL server where the root password was lost. What to do? Here is the solution I found in Internet at the link below. Thanks for the useful tip. http://www.cyberciti.biz/tips/recover-mysql-root-password.html by Vivek Gite · 121 comments You can recover MySQL database server password with following …

Linux

10 Steps to Beautiful Shell Scripts

This is a copy of the following wonderful short and helpful site. Thanks. http://bashcurescancer.com/10-steps-to-beautiful-shell-scripts.html October 16th, 2007 Linux gurus don’t use cut, awk, and sed when they want to replace or strip out a portion if a variable. They use parameter substitution. You can learn parameter substitution in less than 2 minutes. Here is the …

Linux

Useful sed commands

USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) Dec. 29, 2005 Compiled by Eric Pement – pemente[at]northpark[dot]edu version 5.5 Latest version of this file (in English) is usually at: http://sed.sourceforge.net/sed1line.txt http://www.pement.org/sed/sed1line.txt This file will also available in other languages: Chinese – http://sed.sourceforge.net/sed1line_zh-CN.html Czech – http://sed.sourceforge.net/sed1line_cz.html Dutch – http://sed.sourceforge.net/sed1line_nl.html French – http://sed.sourceforge.net/sed1line_fr.html German – http://sed.sourceforge.net/sed1line_de.html Italian …

Bash, MAC OS X

Replacing the missing ‘tac’ command in MAC OS X

After looking into Fink Command and Porticus I could not find the GNU command ‘tac’ for writing bash scripts. So I found these replacements which works well from the following link (Thanks guys :-)) http://trac.osgeo.org/grass/ticket/181 Normal use of tac: …..| tac |……. Replacement Nr. 1 …..| awk ‘{print NR,$0}’ | sort -nr | sed ‘s/^[0-9]* …

Linux

Recover Grub for Linux after Windows re-install

After I installed Linux Mint 8 with ext4 filesystem on /, I happned to have to reinstall Windows which whipped out my grub Boot loader of Linux Mint 8 from MBR. So after I googled around I finally found a site that explains how to recover a grub2 from an installed Linux. In my case …

Apache

Apache Log format codes

Extracted from: http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#logformat Format String Description ============= ============================================================================================================ %% The percent sign %a Remote IP-address %A Local IP-address %B Size of response in bytes, excluding HTTP headers. %b Size of response in bytes, excluding HTTP headers. In CLF format, i.e. a ‘-‘ rather than a 0 when no bytes are sent. %{Foobar}C The contents of …

Linux

Remote logging with rsyslogd

In the sender rsyslog configuration (/etc/rsyslog.conf) ——————————————— local0.* @syslog-server.com ——————————————— In the receiver rsyslog configuration (/etc/rsyslog.conf) Example: ——————————————— # provides UDP syslog reception $ModLoad imudp $UDPServerRun 514 $AllowedSender UDP, 127.0.0.1, 192.168.10.0/24 ———————————————

Apache, Linux

IP List of China and Korea for IPTABLES

Just download: http://www.okean.com/antispam/iptables/rc.firewall.sinokorea This script that can be downloaded regularly needs to be converted before it can be used. In this list the destination ports is 25 (SMTP). For web access blocking, the port needs to be changed to 80,443,25,110,22,995 etc. . A small script can be used to get the list, convert it before …

Linux

Problem: The ssh public key authentication doesn’t work

Try changing the permissions on .ssh/authorized_hosts to restrict READ AND WRITE to your user eg. chmod go-rw ~/.ssh/authorized_hosts SSH doesn’t like it when these files are world-readable Assuming that you wish to login to the machine called mystery from your current host with the id_rsa and id_rsa.pub files you’ve just generated you should run the …

Linux

Installing ZABBIX on Debian(Etch and Lenny)

ZABBIX ====== http://www.zabbix.com [^] This is an open source and seems quite good. It is available through Debian Repository as packages: zabbix-frontend-php (for central monitoring host) installed in monitoring server zabbix-server-mysql (for central monitoring host) installed in monitoring server zabbix-agent (for each monitored host) Installed in ALL 8 Hosts The mysql data: DB: zabbix user: …

Linux, XEN

Stop/Start a single XEN virtual machine

Assuming that the virtual machine is running, to stop the machine: – Make a list of the running virtual machines and note the ID of the one concerned. xl list Lets suppose the ID of the virtual machine concerned is 15 – Shutdown the machine. xl shutdown 15 – Make a few xm list commands …

Apache

Compile Apache 2 in Debian/Ubuntu/Mint/..

Introduction: Steps to compile Apache: – Installation of needed development packages – Prepare the directories needed – copy the config file and script below – Run the script below Installation of needed development packages Needed for Apache mod_deflate libzip-dev (sources) libzip1 (bin libs.) zlib1g-dev (sources) Needed for Mod_security libpcre3-dev libpcrecpp0 libxml2-dev Compiling script Configuration file …

Linux, MAC OS X

Using iTERM – The best terminal program for Linuxers

Configuration file: The full Config Plist is ~/Library/Preferences/com.googlecode.iterm2.plist it seem that it may be used to store the defaults values at startup, but the main one is the first one. Modifying/replacing the configuration file: Preferences are cached in 10.9. See http://hints.macworld.com/article.php?story=20130908042828630. If you edit a plist file directly or replace the plist of an application, …

Apache

Compiling a new standard Apache DSO module

# Build and install a distributed Apache module, say mod_foo.c, into its own DSO mod_foo.so: * Build and install via configure (preferred): $ ./configure –prefix=/path/to/install –enable-shared=foo $ make install * Build and install manually: – Edit src/Configuration: > SharedModule modules/xxxx/mod_foo.so $ make $ cp src/xxxx/mod_foo.so /path/to/install/libexec – Edit /path/to/install/etc/httpd.conf >> LoadModule foo_module /path/to/install/libexec/mod_foo.so # Build …

Apache

MOD GZIP Configuration in Apache 1.3.x

NOTE: The size of the zipped content(not header) is about 1/3 of original size. mod_gzip_command_version ‘/mod_gzip_status’ mod_gzip_temp_dir /tmp/mod_gzip_httpd mod_gzip_keep_workfiles No mod_gzip_minimum_file_size 1000 mod_gzip_maximum_file_size 100000 mod_gzip_maximum_inmem_size 60000 mod_gzip_min_http 1000 mod_gzip_handle_methods GET mod_gzip_item_include file \.html$ mod_gzip_item_include file \.jsp$ mod_gzip_item_include file \.do$ mod_gzip_item_include mime text/html mod_gzip_item_include mime text/plain mod_gzip_item_include mime application/x-javascript mod_gzip_item_include mime text/css mod_gzip_item_include mime text/xml mod_gzip_item_include …

Apache

Problem with openssl and Compiling Apache 2.2.11

Ursache ist, dass die Pfade richtig gesetzt werden müssen, damit ld den Parameter -lssl kennt. export LD_LIBRARY_PATH=”/www/hans/src/openssl-0.9.8j/” export LIBS=”-L/www/hans/src/openssl-0.9.8j” export CPPFLAGS=”-I/www/hans/src/openssl-0.9.8j/include/openssl” echo $LD_LIBRARY_PATH /www/jamba/src/openssl-0.9.8j/:/usr/lib/ echo $LIBS -L/www/jamba/src/openssl-0.9.8j echo $CPPFLAGS -I/www/jamba/src/openssl-0.9.8j/include/openssl

Apache

Issues on MaxClients Directive

WARNING: MaxClients of 3000 exceeds compile time limit of 2048 servers, lowering MaxClients to 2048. To increase, please see the HARD_SERVER_LIMIT define in src/include/httpd.h. Why increase MaxClients to 2048? Apache 1.x is non-threaded, so increasing MaxClients beyond 256 usually results in lower performance; often dramatically lower performance. At a prior job I worked with a …

Apache

GZIP Log Format

LogFormat “\”%h\” \”%{HOST}i\” \”%u\” \”%t\” \”%r\” \”%>s\” \”%b\” \”%{Referer}i\” \”%{User-Agent}i\” \”%{Connection}i\” \”%{Connection}o\” \”%{Content-Type}o\” \”%T\” \”PID:%P\” \”%{mod_gzip_result}n\” \”%{mod_gzip_input_size}n\” \”%{mod_gzip_output_size}n\” \”%{mod_gzip_compression_ration}n\”” JAMBA_BASIS_LOGFORMAT_GZIP

Apache

Using mod_cband to limit bandwidth per vhost

mod_cband (http://cband.linux.pl) can do this from 0.9.6.0 version! You should use CBandExceededSpeed directive to slow down pages when the bandwidth is exceeded 🙂 See: http://www.howtoforge.com/mod_cband_apache2_bandwidth_quota_throttling http://www.icewalkers.com/Linux/Software/524590/mod_cband.html http://www.montanalinux.org/mod_cband.html http://www.uno-code.com/?q=node/64

Apache

MPM ‘worker’ configuration (Apache2)

Directive Description Default (worker.MPM) ===================== =============================================================================== ==================== ListenBackLog Maximum length of the queue of pending connections 511 . MaxClients Global maximum number of connections that will be processed simultaneously 400 MaxClients SHOULD NOT be lower than (ServerLimit) x (ThreadsPerChild). Normally they should be equal. . ServerLimit Upper limit on configurable number of processes (children) 16 …

Apache

Logging Apache Access logs through syslogd

Error logs can be logged very easyly to syslig using the following ErrorLog syslog:local1 Access logs must use a pipe-to-script trick as follows: In Apache config: CustomLog |/usr/local/apache/bin/apache_syslog combined As script in system: Content of /usr/local/apache/bin/apache_syslog ——————————————— logger -i -p local3.info -t TEST-APACHE ——————————————— chmod 755 /usr/local/apache/bin/apache_syslog

Apache

Running mod_gzip, mod_rewrite, and mod_proxy together in Apache 1.3.x

When using RewriteRule ….[P] with mod_gzip there are often problems To resolve this add the following directive to mod_gzip ———————————————– mod_gzip_item_include handler proxy-server ———————————————– mod_gzip_item_include mime “application/x-httpd-php.*” mod_gzip_item_include mime httpd/unix-directory mod_gzip_item_include handler ^server-status$ mod_gzip_item_exclude file \.css$ mod_gzip_item_exclude file \.js$ mod_gzip_item_exclude reqheader “Via:.*1\.0 PROXY” mod_gzip_item_exclude reqheader “Via:.*1\.0 lavoisier \(NetCache NetApp\/5\.0\.1R2\)”

Apache

Examples of mod_security diretives

SecFilterEngine On SecFilterScanPOST On SecFilterSelective “POST_PAYLOAD” “BoesesWort” “deny,log,status:412” # Ersetze BoesesWort durch das Wort, welches du sperren willst. # Speichere die Textdatei unter dem Namen .htaccess (den führenden Punkt nicht vergessen) SecFilterSelective “POST_PAYLOAD” “AnderesBoesesWort” “deny,log,status:412” # Alternative SecFilterSelective “POST_PAYLOAD” “BoesesWort” “deny,log,redirect:http.//www.deinedomain.de/seite.html”

Apache

MOD_JK configuration directives

see: http://tomcat.apache.org/connectors-doc/generic_howto/timeouts.html The following directives are normally inserted in workers.properties file connection_pool_minsize (default 0) defines, how many idle connections remain when the pool gets shrinked. By default this is half of the maximum pool size. connection_pool_size (default 0) We generally do not recommend to use this attribute in combination with Apache httpd. For Apache httpd …

Apache

Logging gzip compression factor of files

LogFormat “%h %l %u %t \”%r\” %>s %b mod_gzip:%{mod_gzip_result}n In:%{mod_gzip_input_size}nOut:%{mod_gzip_output_size}n:%{mod_gzip_compression_ratio}npct.” full_plus_gzip [17:29:14] CustomLog /var/log/httpd/mod_gzip.log full_plus_gzip Example of log entry: /reviews/cooling/HSR2_4.html HTTP/1.1″ 200 6289 mod_gzip: DECHUNK:OK In:23352 Out:6289:74pct.

MySQL

Tool to unstick MySQL Replicators.

# I’m managing an infrastructure with a number of databases who # (for codified reasons that I cannot influence) suffer from this situation often. # So, I’ve written a cron script to manage the situation. # Does anyone see any foreseeable issues with this logic (see below)? # —————————————– SCRIPT —————————————– #!/bin/bash ## Tool to …

MySQL

PROBLEM: Could not find target log during relay log initialization

SOLUTION: delete relay bin file in slave and try slave stop ; CHANGE MASTER TO master_log_file=’name_of_current_file_on_master’,master_log_pos=4; slave start; it will download play again the file IMPORTANT: Make sure the master log file is the one that was being read by the slave when the error occured, otherwise you loose data.

MySQL

FULL Manual rebuilding of SLAVE MySQL server mysql02 from Master mysql01

On mysql01 (MASTER): ——————– mysqldump -u root -p –single-transaction –flush-logs –master-data=2 –all-databases –delete-master-logs | gzip | ssh mysql02 ‘cat | gunzip >/var/lib/mysql_temp.sql’ echo “SHOW MASTER STATUS;” | mysql -p -u root Note the filename eg. mysql-bin.000299 we will use it later on mysql02 On mysql02 (SLAVE): ——————- – Changed the following config is in /etc/mysql/my.cnf …

MySQL

MySQL replication issues

Good links: =========== http://www.howtoforge.com/how-to-repair-mysql-replication MySQL recover from Backup .sql data ====================================== mysql -u root -p dbName backup-dbNameDump.sql ———– Very useful in slave ————————————————————– slave-skip-errors=126,1062 126 = the ambiguous ‘unknown error on master’ typically caused by tables in dis-repair on master. 1062 = duplicate entry (happens all the time on high capacity db in master-master setup)