Redhat Linux

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 [ | | ]

Creating Redhat Init Scripts

Submitted by jkelly on Wed, 2007-02-14 17:26. 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 [ | | ]

Resolving Excessive Swapping in RHEL 4

RHEL4 tends to swap very heavily on some systems, even when there is plenty of free memory. This is due to the default setting of vw.swappiness (sysctl setting) being excessively high for most systems (60 is the default). If you encounter issues with this, try editing /etc/sysctl.conf to include:

vm.swappiness = 10

and run
sysctl -w vm.swappiness=10

This should be a better setting!

Submitted by jkelly on Thu, 2006-08-31 07:04. 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

Upgrading MySQL

This article relates to upgrading MySQL on Redhat linux, but may be applicable to other OSes as well.

Here's the short version:
* Add mysql to the up2date package skip list
* Do a full MySQL dump (mysqldump -Q -A --opt >mysqlbak.sql)
* Stop MySQL
* Upgrade MySQL from the appropriate mysql.com RPMs (including the shared-compat package)
* useradd -u 27 -d /var/lib/mysql -s /bin/bash mysql (if the user doesn't exist)
* comment out the basedir= line from /etc/my.cnf, or parse_server_arguments function call from /etc/init.d/mysql (for MySQL 5.0+)

Submitted by jkelly on Sun, 2006-08-13 08:02. 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
Syndicate content