Linux

Murmur Server on CentOS5

To build a Murmur server on CentOS 5, we need:

Compiler

Remove "gcc-c++" if you have this package installed.

CentOS 5 SRPM location

The CentOS 5 source RPM files are no longer hosted on mirror.centos.org. According to the README file http://mirror.centos.org/centos/5/updates/SRPMS/readme.txt, the new location is at

http://vault.centos.org/5.7/updates/SRPMS/

Upgrade CentOS to 5.6 with Ext4 Support

Upgrading CentOS 5 to 5.6 is as simple as "yum update", and then reboot.

CentOS 5.6 / RedHat RHEL 5.6 has now the production ready Ext4 filesystem. To get this, simply run

# yum install e4fsprogs

Then you can create filesystem using 

# mkfs -t ext4 /dev/sdc1

At the end of the above "mkfs", there is a message as below:

 

Unix date in Bash

Show yesterday's date:

$ date -d yesterday
$ date -d yesterday +%Y-%m-%d

Show the UNIX timestamp:

$ date +%s
$ date --utc +%s
$ date -d yesterday --utc +%s

Convert a date string to timestamp:

function date2stamp () {
        date --utc --date "$1" +%s

Convert a timestamp to a date string:

function stamp2date () {
        date --utc --date "1970-01-01 $1 sec" "+%Y-%m-%d %T"

Fix NTP Configiration

I have a CentOS server that keeps changing the timezone to CDT whenever we upgrade the ntp rpm. It turned out the setting in /etc/sysconfig/clock is wrong. To have the ntp rpm upgrade stay at the desired timezone, just change the line for ZONE to the correct one.

Manually Rotate Log Files

Run this command to rotate system log files:

logrotate -vf /etc/logrotate.conf

The output will be rather verbose. If there is anything that might stop the logrotate, the error will be printed to screen, thus help us fix the system setup.

 

Gentoo Allows Switching PHP Version

Maybe they had it before, but I just noticed this today, that we can install more than one versions of PHP, and then use eselect to switch the version.

In short, we can set in /etc/make.conf:

PHP_TARGETS="php5-3 php-5-2"
PHP_INI_VERSION=production

Then call eselect to see what php versions we have available in apache:

# eselect php list apache2 

Without "PHP_INI_VERSION=production", a dev version of php.ini will be installed.

Use strace to Debug Chroot-MySQL Error

I built an RPM to chroot MySQL. All worked fine on one platform, but failed on the other. I got the following error:

Fatal error: Can't change to run as user 'mysql

This is not interesting at all. To find out what's missing, I ran

# strace -f mysqld_safe --chroot=/chroot/mysql

The option "-f" trace child processes as they are  created  by  currently  traced  processes.

Syslogs

Here are some links for syslog related software:

Search for More Recent PHP RPM Packages on CentOS-5

I found this guy http://www.atoomnet.net/php/  offers the RPM and SRPM for the more recent php packages on CentOS.

Another one here: http://www.jasonlitka.com, or http://www.jasonlitka.com/media/SRPMS/ for the SRPM.