General Linux

Basic LAMP Performance Tuning

Linux:
(2.6 kernel only)
Check vm.swappiness: sysctl -A|grep swap
The default is 60, which is generally too high... if it is still the default, set it to 20:

sysctl -w vm.swappiness=20
echo "vm.swappiness = 20" >> /etc/sysctl.conf

Submitted by jkelly on Thu, 2007-07-05 19:14. categories [ | | | | ] read more

A Practical Introduction to Bash Scripting

The class is available as a pdf or an rtf. All examples and exercise solutions can be found in the scripts tarball. When I have time, I'll get a decently-formatted HTML version together and put that up here :)

Submitted by jkelly on Wed, 2007-06-20 20:11. categories [ | | ] 3 attachments

Creating a loopback swap partition

dd if=/dev/zero of=swapfile bs=1M count=1024
note: replace count with the appropriate size
mkswap swapfile
swapon swapfile
edit /etc/fstab to include the appropriate entry e.g.
/root/swapfile swap swap defaults 0 0

Submitted by jkelly on Wed, 2007-06-20 19:43. categories [ | | ]

Process accounting

More to come

up2date psacct
chkconfig psacct on
service psacct start
cd /usr/local/bin
wget wackyfunster.com/leet/sa-analysis
wget wackyfunster.com/leet/sa-report
chmod +x sa-*

Submitted by jkelly on Fri, 2006-09-15 01:53. categories [ | | ]

Extracting files from an RPM

In order to perform operations on a .rpm file, we use the rpm2cpio and cpio utilities. In order to list the files in an rpm:

rpm2cpio (rpm name) |cpio -itv

To extract an individual file from an rpm (into the current directory):
rpm2cpio (rpm name) |cpio -idv (filename)

And to extract all files from the rpm (once again, into the current directory):
rpm2cpio (rpm name) |cpio -idv

Submitted by jkelly on Fri, 2006-08-18 06:48. categories [ | | ] read more

Changing the system's timezone

In order to change the timezone, you need to link /etc/localtime to the appropriate timezone file in /usr/share/zoneinfo... e.g. to change the time to CST, you would do:

rm -f /etc/localtime
ln -s /usr/share/zoneinfo/CST6CDT /etc/localtime
date
Sun Aug 13 01:18:21 CDT 2006

In Redhat, you also need to edit the /etc/sysconfig/clock file (specifically the ZONE= line) to reflect the appropriate timezone. This will be set to the corresponding file in /usr/share/zoneinfo, e.g.

Submitted by jkelly on Sun, 2006-08-13 01:20. categories [ | | ] read more

Remaking ext3 journals

Sometimes, ext3 journals go bad. Typically this will be evident in journal or dma errors in dmesg (I'll provide some examples next time I come across one of these). In order to resolve it, perform the following:
* Take the server down and boot it into the rescue environment (this means KVM time for support)... do NOT mount any of the partitions.
* fsck the affected partition.
* Remove the journal from the affected partition
* re-fsck the affected partition
* Readd the journal to the affected partition

Submitted by jkelly on Fri, 2006-08-11 10:37. categories [ | ] read more
Syndicate content