SATA disks as AHCI
Fri, 10/31/2008 - 00:11 — sandipWhen converting from IDE to AHCI in the BIOS to include additional drives, I would get a kernel panic... as by default the bios was setup with the drives as IDE.
Booted using existing IDE and created a new kernel image with support for AHCI via the --preload option to manually specify modules support:
# mkinitrd --allow-missing --preload=ahci --force-scsi-probe /boot/initrd-`uname -r`-custom.img `uname -r`
Then create a new grub boot option to load the new custom kernel image and select it when grub boots up using AHCI.
Forcing apache to listen to ipv4
Mon, 10/27/2008 - 21:17 — sandipRecently, I've noticed that in ubuntu (6.06) dapper server with apache-2.0.55, apache by default listens to IPv6, thus was causing slow response times. The response times was much improved by having apache listen to IPv4 instead.
Edit /etc/apache2/ports.conf and specify an IPv4 address on all Listen directives:
Listen 0.0.0.0:80
Listen 0.0.0.0:443
Drupal 5.11 upgrade fixes
Fri, 10/17/2008 - 00:38 — sandipWith the upgrade to drupal-5.11 the caching feature seemed to have broken SecurePages and the GlobalRedirect modules.
Error:
Fatal error: Call to undefined function: drupal_get_path_alias() in /path/to/includes/common.inc on line 1196
Solution:
Added the below code to the beginning of the securepages_init function in "securepages.module" so paths get loaded if cache is enabled.
// If cache is enabled we need to load the path system
if (variable_get('cache';, CACHE_DISABLED) != CACHE_DISABLED) {
drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
}Reference:
http://drupal.org/node/119009
Error:
Fatal error: Call to undefined function: _menu_item_is_accessible() in /path/to/sites/all/modules/glo balredirect/globalredirect.mod ule on line 37
Solution:
Add "function_exists('_menu_item_is_accessible') &&" check in "globalredirect.module":
if (function_exists('drupal_
get_path_alias') &&
function_exists('_menu_it em_is_accessible') &&
_menu_item_is_accessible(menu_ get_active_item()) &&
isset($_REQUEST['q'] ) &&
empty($_POST)) { Reference:
http://drupal.org/node/301844
Sender Policy Framework (SPF)
Sat, 09/27/2008 - 00:56 — sandipSender Policy Framework (SPF) is an extension to the Simple Mail Transfer Protocol (SMTP). SPF allows software to identify and reject forged addresses in the SMTP MAIL FROM (Return-Path), a typical nuisance in e-mail spam.
The two direct benefits of SPF I found are:
-
ensuring a spammer/virus/trojan cannot send emails using your email address in the FROM field of the email.
get legitimate emails to go through hotmail (and others of course) junk filter, and not be detected as spam.
Setting up a SPF record
Here is an SPF record template for strict checking. For softfail, use "~all" instead.
v=spf1 a mx ptr ip4:<DomainIP> -all
Where 'DomainIP' is replaced with the IP address for what you're setting this record up for. It can also include a range in CIDR format.
You can read more about other SPF Record Syntax at OpenSPF.org .
So now when people receiving emails from your domain have their SPF checking rule to deny all emails that don't match with this SPF record they should only receive genuine emails from your domain.
If you are a Plesk user, "Switch on SPF spam protection" and next to 'SPF checking mode' select 'Reject mails when SPF resolves to "fail" (deny)'.
To check the SPF record for a particular domain:
$ dig domain.tld txt
analog filesize limit
Tue, 09/16/2008 - 16:05 — sandipI had some trouble with analog monthly stats not showing up for the last week and figured out that analog refuses to parse huge log files. I had one sitting at 3GB without being rotated and analog would error out with:
/usr/bin/analog: Warning F: Failed to open logfile
/var/log/httpd/access_log: ignoring it
After running gzip on the log file, analog was then able to produce the reports. I think I read somewhere that the limit may be 2GB but have not tested this.
Restoring Plesk server
Wed, 09/03/2008 - 01:27 — sandipI have recently had to restore plesk from an offsite filesystem backup due to disk drive failure and loss of data. Below are notes for reference and the corresponding list of important folder/files to be backed up for a successful restore.
It helps if you are restoring sites to the same version of OS and Plesk Control Panel, so reload the OS and version of Plesk as was running prior to the data loss.
SYSTEM:
1. Merge "/etc/passwd", "/etc/group" and "/etc/shadow" for domain user accounts.
2. Bring up all IP aliases:
ifconfig eth0:0 xxx.xxx.xxx.xxx
Note: Keep backup of "/etc".
MYSQL:
1. Reset Plesk "admin" user password to old one.
2. Copy over "/etc/mysql/debian.conf".
3. Import all mysql databases:
Export:
mysqldump --opt --all-databases | gzip > all_db.sql.gz
Import:
gunzip < all_db.sql.gz | mysql -u admin -p
4. Restart mysql.
Note: Keep backup of "/var/lib/mysql" and "/var/log/mysql" (if incase database is corrupted and need to be restored using binary log files).
PLESK:
1. Reload ssl certificates from "/opt/psa/var/certificates/" or reinstall the certs via the control panel.
2. Restore/Merge phpmyadmin config "/opt/psa/admin/htdocs/domains
$cfg['Servers'][$i][ 'controluser']
$cfg['Servers'][$i ]['controlpass']
$cfg['Servers'][$i ]['pmadb']
Note: Keep backup of "/opt/psa".
WEB:
1. Restore "conf.d/zz010_psa_httpd.conf".
2. Sync "/var/www/vhosts".
3. Check for psaserv and psacln folder permissions on "/var/www/vhosts/domains".
chgrp psaserv /var/www/vhosts/<domain> /httpdocs
chgrp -R psacln /var/www/vhosts/<domain> /httpdocs/*
Note: Keep backup of "/var/www/vhosts".
DNS:
1. Copy over "/var/named/run-root/etc/named
2. Copy over "/var/named/run-root/var".
3. Set the permissions correct:
chown bind /var/named/run-root/var
chgrp bind /var/named/run-root/var/run
Note: Keep backup of "/var/named".
MAIL:
1. Sync "/var/qmail".
Note: Keep backup of "/var/qmail".
Creating graph of Trac workflow
Fri, 08/15/2008 - 12:01 — sandipHere is how, I was able to generate graph of the workflow being used in Trac. This helps quite a bit when trying to visualize the workflow that is being setup.
The packages required were ghostscript (ps2pdf conversion) and graphviz (graph creation).
Graphviz is available in DAGs/rpmforge repository, so do an install via:
# yum --enablerepo=rpmforge install ghostscript graphviz graphviz-python
Once graphviz is installed generate config files:
# dot -c
Download the corresponding contrib files from the trac svn:
$ wget http://svn.edgewall.com/repos/ trac/tags/trac-0.11/contrib/wo rkflow/showworkflow
$ wget http://svn.edgewall.com/repos/ trac/tags/trac-0.11/contrib/wo rkflow/workflow_parser.py
Make the files executable and run:
./showworkflow /path/to/trac.ini
This should generate a pdf file in the same directory as trac.ini file.
Note: If doing this on a server xpdf will fail, so move the pdf to a web accessible directory to view it.
Bridge Networking On OpenVZ Containers Using VETH Devices
Wed, 08/13/2008 - 23:52 — sandip 1. Host will be open on LAN and guests on WAN. Additionally, there is a bridged LAN for guests.
2. We will be using bridge networking for protecting the Host Network and saving IP addresses, also giving flexibility with the guest network setup.
3. Configure LAN Eth1 port to 192.168.1.2
4. WAN Eth0 port is not assigned any IP address.
6. Install the required bridge-utils package via:
yum install bridge-utils
* Network:
# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=<host.domain.tld >
GATEWAY=192.168.1.1
GATEWAYDEV="eth1"
* WAN Bridge device br0:
# cat /etc/sysconfig/network-scripts /ifcfg-br0
DEVICE=br0
BROADCAST=xxx.xxx.xxx.xxx
/>NETMASK=255.255.255.24
NETWORK=xxx.xxx.xxx.xxx
ONBOOT=yes
GATEWAY=xxx.xxx.xxx.xxx
TYPE=Bridge
* WAN eth0 device:
# cat /etc/sysconfig/network-scripts /ifcfg-eth0
DEVICE=eth0
HWADDR=00:30:48:65:12:b4
ONBOOT=yes
TYPE=Ethernet
BRIDGE=br0
* LAN Bridge device br1:
# cat /etc/sysconfig/network-scripts /ifcfg-br1
DEVICE=br1
ONBOOT=yes
TYPE=Bridge
IPADDR=192.168.1.2
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
* LAN eth1 device:
# cat /etc/sysconfig/network-scripts /ifcfg-eth1
DEVICE=eth1
HWADDR=00:30:48:65:12:b5
ONBOOT=yes
TYPE=Ethernet
BRIDGE=br1
MySQL Server Performance Tuning
Mon, 08/04/2008 - 16:03 — sandipGet under the hood of MySQL to find out how you can speed up your database applications.
Jeremy Zawodny
In the open source world, truly great software starts in the hands of enthusiasts and hobbyists. Given time, it matures and develops a more robust community. Then, before most of us realize what is happening, it gains critical mass and moves into the broader industry. Companies that were using expensive commercial software just a year ago are suddenly using a free product — one of the rising stars from the world of Open Source.
Difference between bytes and bits
Sat, 07/26/2008 - 13:34 — sandipBits are 1s or 0s representing the state of a switch, in binary form.
A byte is a binary word, consisting of 8 bits.
8 bits equals one Byte.
1024 bytes equals one KiloByte (KB)
1024 KiloBytes equals one MegaByte (MB)
1024 MegaBytes equals one GigaByte (GB)
Sometimes people use 1000 instead of 1024, so numbers sometimes get screwy.
A bit is always represented by a small "b", a Byte is always represented by a large "B".
It is common practice to use bits in reference to interface speeds and bytes in reference to memory and storage capacities.