Blog

Yum on RHEL4

First off, apologies for not have posting anything in the last few weeks.  I just got back from Manila, Philippines to visit my ill grandfather (read: father).  He made it, but is still weak.  I love you lolo!

Anyway, I personally run Red Hat Enterprise Linux 4 at work for any *nix tasks, and in this post I’ll show you how to install Yum for easier management.

According to Linux@DUKE: Yum is an automatic updater and package installer/remover for rpm systems. It automatically computes dependencies and figures out what things should occur to install packages. It makes it easier to maintain groups of machines without having to manually update each one using rpm.

So, without further adieu:

1.  Download yum-2.0.8-1.noarch.rpm from:

http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.8-1.noarch.rpm

2. Install it with the following command:

rpm –i yum-2.0.8-1.noarch.rpm

3.  Configure your yum.conf [in /etc/yum.conf] like so:

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1

#base]
#ame=Red Hat Linux $releasever – $basearch – Base
#aseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat

/$releasever/$basearch/
[base]
name=CentOS-$releasever – Base
baseurl=http://mirror.centos.org/centos/4.4/os/i386/
gpgcheck=1

[updates]
name=Red Hat Linux $releasever – Updates
baseurl=http://mirror.centos.org/centos/4.4/os/i386/
gpgcheck=1

4.  Download the GPG key for CentOS RPM packages with:

wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4

5.  Import the key like:

rpm –import RPM-GPG-KEY-CentOS-4

6.  Run yum -y update, sit back, relax, and enjoy watching your system being updated.

That’s it!  Now you can use yum to install anything you wish.  Ciao!

Let the seat guru help you out

I haven’t been blogging due to my hectic schedule for the past week.  Most time-consuming is the preparation and shopping I had to attend to for my trip to the Philippines to see my ill grandfather.

I’ve been confirmed to fly on Eva Air via Taipei, Taiwan – and…I found a resource that will be helpful to the readers of my blog: Seat Guru.

According to their website, they state that they’re the ultimate source for airplane seating, in-flight amenities and airline information. 

What I especially found helpful are the diagrams they provide for about 90% of the major airlines’ seating charts.  It lets you know what seats are good and bad, as well as other pertinent information, such as ammenities.

Check it out!  Hope this helps.  =0)

Your personal regex coach and more

If you’ve worked on text parsing projects – or an app that needed it – then you know what regular expressions are. It truly has been a lifesaver for me on many, many occassions. If, however, you haven’t dealt with it before, here’s some background on it:

According to Wikipedia, in computing, a regular expression is a string that is used to describe or match a set of strings, according to certain syntax rules.

For example, to capture the word Perl in the text below, you would use the following expression: .*(Perl).

Regular expressions are used by many text editors and utilities to search and manipulate bodies of text based on certain patterns. Many programming languages support regular expressions for string manipulation. For example, Perl and Tcl have a powerful regular expression engine built directly into their syntax.

How does it work?

  • . (dot) means match anything
  • * (asterisk) means match the previous character 0 or more times
  • (Perl) (open & close parenthesis) mean capture whatever’s in it

A tool that I personally use to learn, construct, and test regular expressions is called: The Regex Coach. This tool offers many views to show how the regex engine parses text, which garners you knowledge on how it works internally, so you can write more advanced expressions.

Here’s what the tool looks like:

The Regex Coach

To end this post, I highly recommend reading Master Regular Expressions by Jeffrey E. F. Freidl to learn how/when to use it and the text-processing power it offers. This book, in my opinion, reads like a novel and is the best book on regular expressions.Take care! =0)

Auto backup solution for your MySQL databases

I use MySQL as my database server, and thankfully, it’s been reliable and easy to use.  A qualm I have, however, is that it doesn’t include a daily backup feature, unlike Microsoft SQL Server.

The good thing is that the open source community has seen this problem and created a solution for it: AutoMySQLBackup.  (You can download it from here.)

According to the website on SourceForge.net:

A script to take daily, weekly and monthly backups of your MySQL databases using mysqldump. Features – Backup mutiple databases – Single backup file or to a seperate file for each DB – Compress backup files – Backup remote servers – E-mail logs – More..

Here are the quick-and-dirty set up steps (courtesy of debianhelp.co.uk):

1.  Download automysqlbackup.sh and place it into your /etc/cron.daily directory like so: cp /path-to-automysqlbackup/automysqlbackup.sh /etc/cron.daily/.

2.  Edit (at least) the following lines via vim automysqlbackup.sh:
USERNAME=dbuser
PASSWORD=password
DBNAMES=”DB1 DB2 DB3″

3.  Make the file executable by typing: chmod u+rwx automysqlbackup.sh.

4.  Create the following directory by typing: mkdir ./backups.

5.  That’s it!  You can either run the script via the command line: ./automysqlbackup.sh, or let it run its course since we’ve now put it in /etc/cron.daily; make sure the cron service is running, though.  ;0)

Peace. \m/

Free Windows PowerShell course book

The Schweizer IT Professional and TechNet Blog is sharing a free Windows PowerShell course book that they’ve translated to English.  The book seems to be pretty good.

From their blog entry:

 Due to its great popularity, we have decided to translate the Windows PowerShell course book to English. So if your mother tongue is not German, maybe you are interested in the English version instead. The book gives you a short introduction with many exercises about the interactive part of Windows PowerShell as well as some hints how to use other objects like WMI, .NET or COM objects like Excel or Internet Explorer.

The book is available for free and you can share it with all your colleagues or friends if you leave it as it is. The books can be used with or without the demo files available at this blog as well.

Enjoy!  =0)