Building and Configuring a Central Logging Server with syslog-ng

September 19th, 2006

http://www.zazzybob.com/syslog_ng.html


End of Life times (Fedora Core 1, 2, Red Hat Linux 7.3, 9)

July 26th, 2006

https://www.redhat.com/archives/fedora-legacy-list/2006-July/msg00028.html

The Fedora legacy project has announced that they will discontinue errata updates starting in October. I have a few clients with servers still running 7.3 and 9. RHEL or CentOS is the currently the obvious choice to replace these old Red Hat installs.

Red Hat will provide errata for RHEL4 until February 2010 and RHEL3 is covered until October of 2008. Red Hat has stated they will support each RHEL release for 5 years.

I determined the following release dates from the RHEL listing on http://www.distrowatch.com

RHEL3: 2003/10/22
RHEL4: 2005/02/15


Subversion and keyword substitution

July 24th, 2006

Last year I migrated a large CVS repository over to Subversion. One of the issues I missed during the migration was that unlike CVS, Subversion did not automatically set new files to expand keywords such as $Id$ to the very useful string:

$Id: MySpecialClass.java 12234 2004-05-21 00:23:08Z derek $

I did some research into the problem and unfortunately there wasn’t anything on the server side I could do to force this setting on all files as they are added and checked in to the SVN repository. To automatically enable keyword substitution you must do two things.

First, uncomment the enable-auto-props = yes line in ~/.subversion/config in each users home directory.

### Set enable-auto-props to 'yes' to enable automatic properties
### for 'svn add' and 'svn import', it defaults to 'no'.
### Automatic properties are defined in the section 'auto-props'.
enable-auto-props = yes

Then you must configure the file types to which you will apply keyword substitution:

### Section for configuring automatic properties.
[auto-props]
### The format of the entries is:
###   file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?').  All entries which match will be applied to the file.
### Note that auto-props functionality must be enabled, which
### is typically done by setting the 'enable-auto-props' option.
*.c = svn:eol-style=native;svn:keywords=Date Author Id Revision HeadURL

I appended ;svn:keywords=Date Author Id Revision HeadURL to the entry for .c files in ~/.subversion/config. Uncomment other file types in the file and adjust them as needed. Feel free to add new lines to the file for other source files such as .php and .java. These settings will take effect for all new files that you add to the repository.

If you happen to have existing files in the repository that need to have the keyword property set you can set it by running the svn propset svn:keywords “Author Date Id Revision HeadURL command.

svn:keyword documentation


Faster software RAID reconstruction

July 23rd, 2006

When creating or reconstructing a Linux software RAID there is a default reconstruction rate at which the RAID will be created. On RHEL the default max speed at which it will reconstruct the array is 10000 KB/sec. This setting can easily be adjusted for the impatient among us.

echo -n 500000 > /proc/sys/dev/raid/speed_limit_max

The above command will set the max reconstruction speed to 500000 KB/sec (which will essentially max out at the speed of your drives, usually in the 50MB/sec zone from my experience).

Bumping the value up will tax the disk subsystem more than the default but often it’s worth it to get that warm fuzzy of having a consistent RAID.


Mac OS X System Startup

July 7th, 2006

http://www.kernelthread.com/mac/osx/arch_startup.html

This page briefly describes the sequence of events that happen when Mac OS X boots.


Mount a firewire drive at boot on OS X

June 28th, 2006

I run OS X on my desktop (settle down now, more on this later).

The default behavior of OS X does not mount external drives at boot time. This is very frustrating. The following command will configure your mac to mount all connected disks at startup (not just upon a user logging in).

sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true

Reboot and you’ll find all your disks already mounted if you ssh in remotely (even without having logged in via the GUI).

If you want to reverse this setting just change “true” to “false” at the end of the line.


Is this the Last Day of the Month?

April 12th, 2006

http://www.itworld.com/nl/unix_insider/04062006/


Migrate RHEL to CentOS

April 11th, 2006

For those of you interested in using CentOS instead of RHEL you don’t need to reinstall. By following these instructions you will convert an existing RHEL4 server over to CentOS 4:

I downloaded the following files from a CentOS mirror into an empty directory:

centos-release-4-2.1.i386.rpm
centos-yumconf-4-4.3.noarch.rpm
python-elementtree-1.2.6-4.i386.rpm
python-sqlite-1.1.6-1.i386.rpm
python-urlgrabber-2.9.6-2.noarch.rpm
RPM-GPG-KEY-centos4
sqlite-3.2.2-1.i386.rpm
yum-2.4.0-1.centos4.noarch.rpm

Then ran:

rpm –import RPM-GPG-KEY-centos4
rpm -e –nodeps redhat-release
rpm -Uvh *.rpm

then

yum upgrade


Remote Conversion to RAID-1 for Crazy Sysadmins

February 16th, 2006

One of my clients purchased a dedicated server with 2 hard drives (very common configuration these days). Unfortunately their provider can’t/won’t configure their server to use software raid. My suggestion was to use the 2 matching drives in a software raid-1 configuration, but I’ve never remotely setup software raid after a server was already up and running.

Warren Togami provides a very detailed howto on remotely migrating 2 matching hard drives running Linux to a software RAID-1 configuration:
http://togami.com/~warren/guides/remoteraidcrazies/

This server was running RHEL4 and the above process worked great for me. I do have some notes that I’ll be sending back to Warren:

  • Step 5) My first drive was setup to use 255 heads whereas hdc was configured to use 16. I ran “sfdisk -H 255 /dev/hdc < partitions.txt" instead of "sfdisk /dev/hdc < partitions.txt" to reconfigure the 2nd disk to use 255 heads just like hda.
  • Step 25) Shouldn’t the commands for hdc be referencing (hd1) and (hd1,0) (where appropriate)?
  • Step 26) It says to most importantly change the root setting back to (hd0,0), yet the example still shows (hd1,0).
  • Step 27) Attempting to run “mdadm -A -s” resulted in a “mdadm: No arrays found in config file” error message. I was able to get rid of this error by creating /etc/mdadm.conf as listed in Step 22 (even though it says RHEL4 no longer requires that file, it seemed to help out in my situation).

Without Warren’s document it would have taken me much longer to figure out the best way to get this done remotely. I’m usually spoiled in that I have hardware raid on most machines and get to partition things just as I wish when I install them on-site.


How to Look Like a UNIX Guru

February 7th, 2006

http://www.cs.usfca.edu/~parrt/course/601/lectures/unix.util.html

Here’s a very useful set of instructions that every developer that deploys on unix/linux should know.

“If you want to be a serious server developer, you will need to have a certain facility with a number of UNIX tools; about 15. You will start to see similarities among them, particularly regular expressions, and soon you will feel very comfortable. Combining the simple commands, you can build very powerful tools very quickly–much faster than you could build the equivalent functionality in C or Java, for example.”

My favorite of all the commands mentioned is rsync. I use it daily to move things around between servers and even on the same machine. I’ll discuss rsync and how I use it later.